mkaczanowski/pastebin

Docker-compose setup not working (network or host)

Closed this issue · 1 comments

Hi,

I am struggling with docker-compose configuration for this service. I will always refuses to connect (tried network_mode: host - same result).. any advice please?
image

docker-compose.yml:

version: "3.7"

services:
  pastebin:
    container_name: general.501.pastebin.13
    image: mkaczanowski/pastebin:latest
    restart: always
    command: --address localhost --port 8000
    #network_mode: host
    ports:
      - 50113:8000
    #volumes:
    #  - $PWD/config:/config:rw
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
    labels:
      # AUTOUPDATE
      - com.ouroboros.enable=true
      # TRAEFIK 2
      - traefik.enable=true
      - traefik.http.routers.pastebin.entrypoints=websecure
      - traefik.http.routers.pastebin.rule=Host(`pbin.example.com`)
      - traefik.http.routers.pastebin.service=pastebin
      - traefik.http.services.pastebin.loadbalancer.server.port=8000

networks:
  default:
    name: general.501.pastebin.13

Logs:

Attaching to general.501.pastebin.13
general.501.pastebin.13 | Configured for production.
general.501.pastebin.13 |     => address: localhost
general.501.pastebin.13 |     => port: 8000
general.501.pastebin.13 |     => log: normal
general.501.pastebin.13 |     => workers: 64
general.501.pastebin.13 |     => secret key: generated
general.501.pastebin.13 |     => limits: forms = 32KiB
general.501.pastebin.13 |     => keep-alive: 5s
general.501.pastebin.13 |     => tls: disabled
general.501.pastebin.13 | Warning: environment is 'production', but no `secret_key` is configured
general.501.pastebin.13 | Mounting /:
general.501.pastebin.13 |     => GET / (index)
general.501.pastebin.13 |     => POST /?<lang>&<ttl>&<burn>&<encrypted> (create)
general.501.pastebin.13 |     => DELETE /<id> (remove)
general.501.pastebin.13 |     => GET /<id>?<lang> (get)
general.501.pastebin.13 |     => GET /new?<id>&<level>&<msg>&<glyph>&<url> (get_new)
general.501.pastebin.13 |     => GET /raw/<id> (get_raw)
general.501.pastebin.13 |     => GET /download/<id> (get_binary)
general.501.pastebin.13 |     => GET /static/<resource> (get_static)
general.501.pastebin.13 | Rocket has launched from http://localhost:8000

Another concern I am having is where are stored all the previous bins and server settings so I can mount it as a volume to have it persistent.

Thanks, Michal

Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/focal64"
  config.disksize.size = '20GB'

  config.vm.provision "shell", inline: <<-SHELL
    apt-get update
    apt-get install -y git docker docker.io docker-compose

    echo 'curl https://sh.rustup.rs -sSf | sh -s -- -y;' | su vagrant
    sudo -u vagrant sh -c "echo 'source /home/vagrant/.cargo/env' > /home/vagrant/.bash_aliases"

    curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
    sudo dpkg -i minikube_latest_amd64.deb

    sudo usermod -aG docker vagrant

    sudo -u vagrant git clone https://github.com/mkaczanowski/pastebin /home/vagrant/pastebin 2>/dev/null

    curl -s "https://gist.githubusercontent.com/mkaczanowski/a8828bb6e17e2216afba57923b1a74e8/raw/b1a294e89a11838cfb84944d546dab998a0f25e3/docker-compose" > /home/vagrant/docker-compose.yml

    # docker-compose up -d
        # curl http://localhost/new -H "Host: pbin.example.com"
  SHELL
end

Docker-compose:

version: "3.7"

services:
  traefik:
    image: "traefik:v2.3"
    container_name: "traefik"
    command:
      - "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

  pastebin:
    image: mkaczanowski/pastebin:latest
    container_name: pastebin
    restart: always
    command: --address 0.0.0.0 --port 80
    ports:
      - "80"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.pastebin.entrypoints=web"
      - "traefik.http.routers.pastebin.rule=Host(`pbin.example.com`)"

Test:

vagrant@ubuntu-focal:~$ curl -s http://localhost/new -H "Host: pbin.example.com" | wc -l
284