Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env_file fails to find file on host machine when deployed #94

Open
ADRFranklin opened this issue Nov 5, 2021 · 2 comments
Open

env_file fails to find file on host machine when deployed #94

ADRFranklin opened this issue Nov 5, 2021 · 2 comments

Comments

@ADRFranklin
Copy link

after testing a little bit with this, it seems when deploying with pico, docker compose is unable to find env files on the host system, which can be confirmed when you copy pico's params that are passed to docker compose and run them yourself.

Pico's Attempt:

{"level":"debug","ts":"2021-11-05T21:44:48.560Z","caller":"executor/cmd.go:101","msg":"executing with secrets","target":"pico-pterodactyl-panel","cmd":["docker-compose","up","-d"],"url":"https://gitlab.com/xxx/pico-pterodactyl-panel","dir":"/cache/pico-pterodactyl-panel","env":{"DATA_DIR":"/storage","DOMAIN_NAME":"xxx","HOSTNAME":"local-01","MACHINE_NAME":"local-01"},"passthrough":false}
Couldn't find env file: /storage/pterodactyl/conf.d/panel.env

Manual Attempt:

 DATA_DIR=/storage HOSTNAME="local-01" DOMAIN_NAME="xxx" docker-compose up -d
Creating network "pico-pterodactyl-panel_default" with the default driver
Pulling cache (redis:alpine)...
alpine: Pulling from library/redis
a0d0a0d46f8b: Already exists

as seen from above, running manually works perfectly fine.

@Southclaws
Copy link
Collaborator

Can you provide an MVCE for this? A simple Docker compose config and Pico target

@ADRFranklin
Copy link
Author

ADRFranklin commented Nov 6, 2021

Sure,

Config

E("DATA_DIR", "/storage");
E("MACHINE_NAME", HOSTNAME);

var GITLAB_HOST = "https://gitlab.com/";

A({
  name: "gitlab",
  path: "/pico",
  user_key: "GIT_USERNAME",
  pass_key: "GIT_PASSWORD",
});

function Compose(name) {
  return {
    name: name,
    url: GITLAB_HOST + "user/" + name,
    up: ["docker-compose", "up", "-d"],
    down: ["docker-compose", "down"],
    auth: "gitlab",
  };
}

if (HOSTNAME === "local-01") {
  E("DOMAIN_NAME", "domain");
  T(Compose("pico-pterodactyl-panel"));
}

pico-pterodactyl-panel docker compose

version: '2.3'
networks:
  default:
    driver: bridge
  gateway:
    external:
      name: gateway
services:
  ##
  # --Pterodactyl Panel--
  # This is the container that provides the main web interface.
  ##
  panel:
    depends_on:
      cache:
        condition: service_started
    env_file: ${DATA_DIR:?required}/pterodactyl/conf.d/panel.env
    image: ccarney16/pterodactyl-panel:latest
    restart: always
    networks:
      - default
      - gateway
    volumes:
      - ${DATA_DIR:?required}/pterodactyl/panel:/data
      # Enable Let's Encrypt Support
      - ${DATA_DIR:?required}/pterodactyl/conf.d/letsencrypt:/etc/letsencrypt
      - ${DATA_DIR:?required}/pterodactyl/conf.d/letsencrypt/webroot/.well-known:/var/www/html/public/.well-known
      - ${DATA_DIR:?required}/pterodactyl/conf.d/certs:/etc/certs
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=gateway"
      - "traefik.http.routers.pterodactyl-panel.rule=Host(`panel-${HOSTNAME:?required}.${DOMAIN_NAME:?required}`)"
      - "traefik.http.routers.pterodactyl-panel.entrypoints=https"
      - "traefik.http.routers.pterodactyl-panel.tls.certresolver=default"
      - "traefik.http.services.pterodactyl-panel.loadbalancer.server.port=80"
      - "com.centurylinklabs.watchtower.enable=true"
  ##
  # --Worker--
  # These are required for schedules and other misc tasks to 
  # function correctly.
  ##
  worker:
    command: wait-for -t 5 panel:80 -- php /var/www/html/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
    networks:
      - default
    depends_on:
      panel:
        condition: service_started
    env_file: ${DATA_DIR:?required}/pterodactyl/conf.d/panel.env
    image: ccarney16/pterodactyl-panel:latest
    labels:
      ofelia.enabled: "true"
      ofelia.job-exec.pqueue.schedule: "@every 1m"
      ofelia.job-exec.pqueue.command: "php /var/www/html/artisan schedule:run"
      ofelia.job-exec.pqueue.user: "nginx"
    restart: always
    volumes_from:
    - panel
  cron:
    command: daemon --docker
    depends_on:
      panel:
        condition: service_started
      worker:
        condition: service_started
    image: mcuadros/ofelia:latest
    network_mode: none
    privileged: true
    restart: always
    volumes:
    - ${DOCKER_SOCKET:-/var/run/docker.sock}:${DOCKER_SOCKET:-/var/run/docker.sock}
  ##
  # --Redis--
  # Handles Session Data
  ##
  cache:
    networks:
      - default
    cpu_count: 2
    cpu_percent: 50
    image: redis:alpine
    mem_limit: 128m
    restart: always
  ##
  # --MariaDB--
  # Required for the control panel to work.
  # Stores Server/User information
  ##
  game_mysql:
    image: mariadb:10.4
    networks:
      - default  
    env_file: ${DATA_DIR:?required}/pterodactyl/conf.d/mariadb.env
    ports:
    - ${MYSQL_ADDRESS:-3306}
    restart: always
    volumes:
    - ${DATA_DIR:?required}/pterodactyl/db:/var/lib/mysql    

link to env files needed
https://github.com/ccarney16/pterodactyl-containers/tree/master/manifest/config/env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants