DarkflameServer icon indicating copy to clipboard operation
DarkflameServer copied to clipboard

BUILD: Docker Compose file shows error with .env file

Open devix56 opened this issue 2 years ago • 11 comments

Make sure you've done the following:

DarkflameServer Version

66215da

Platform

Windows

Architecture

x86

Error Logs

When I try to run "docker compose up -d --build" while being in the server directory, it says either ACCOUNT_MANAGER_SECRET or CLIENT_PATH is missing a value. That is not true, because ACCOUNT_MANAGER_SECRET is empty as it is said in the Docker.md and I did put the right path to my client (I use the unpacked version if that maybe the error).

I get the following errors:

invalid interpolation format for services.account-manager.environment.[]: "required variable ACCOUNT_MANAGER_SECRET is missing a value: missing_account_secret". You may need to escape any $ with another $

invalid interpolation format for services.darkflame.volumes.[]: "required variable CLIENT_PATH is missing a value: missing_client_path". You may need to escape any $ with another $

devix56 avatar May 31 '22 21:05 devix56

Tagging @TheNoim and @aronwk-aaron since iirc that account manager secret is apart of his repositories.

EmosewaMC avatar Jun 01 '22 01:06 EmosewaMC

That is not true, because ACCOUNT_MANAGER_SECRET is empty as it is said in the Docker.md

This cannot be empty

aronwk-aaron avatar Jun 01 '22 01:06 aronwk-aaron

Both now ACCOUNT_MANAGER_SECRET and CLIENT_PATH are not empty and I still get the same error message.

I don't know what is meant by "You may need to escape any (Dollarsign) with another (Dollarsign)

devix56 avatar Jun 01 '22 09:06 devix56

An example file would be helpful :)

TheNoim avatar Jun 01 '22 11:06 TheNoim

.env File

CLIENT_PATH is this directory, in which there is a folder called "client" where all the client files are located.

image

# Full path to the LEGO Universe client
CLIENT_PATH=/Users/dan1088/LEGO_Universe
# Can improve build time
BUILD_THREADS=3
# Updates NET_VERSION in CMakeVariables.txt
BUILD_VERSION=171022
# make sure this is a long random string
# grab a "SHA 256-bit Key" from here: https://keygen.io/
ACCOUNT_MANAGER_SECRET=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
# Should be the externally facing IP of your server host
EXTERNAL_IP=localhost
# Database values
# Be careful with special characters here. It is more safe to use normal characters and/or numbers.
MARIADB_USER=darkflame
MARIADB_PASSWORD=dlu2022
MARIADB_ROOT_PASSWORD=dlu2022
MARIADB_DATABASE=darkflame

docker-compose.yml File (same as the from the rep)

version: "3"

services:
  setup:
    container_name: DarkflameSetup
    build:
      context: .
      dockerfile: ./docker/setup.Dockerfile
    environment:
      - DATABASE=${MARIADB_DATABASE:-darkflame}
      - DATABASE_HOST=database
      - DATABASE_USER=${MARIADB_USER:-darkflame}
      - DATABASE_PASSWORD=${MARIADB_PASSWORD:-darkflame}
      - EXTERNAL_IP=${EXTERNAL_IP:-darkflame}
    volumes:
      - ${CLIENT_PATH:?missing_client_path}:/client
      - shared_configs:/docker/

  database:
    container_name: DarkflameDatabase
    build:
      context: .
      dockerfile: ./docker/database.Dockerfile
    environment:
      - MARIADB_USER=${MARIADB_USER:-darkflame}
      - MARIADB_PASSWORD=${MARIADB_PASSWORD:-darkflame}
      - MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD:-darkflame}
      - MARIADB_DATABASE=${MARIADB_DATABASE:-darkflame}
    volumes:
      - database:/var/lib/mysql
    networks:
      - darkflame
    # You can expose these so that DB management tools can connect (WARNING: INSECURE)
    # ports:
    #   - 3306:3306

  darkflame:
    container_name: DarkflameServer
    networks:
      - darkflame
    build:
      context: .
      dockerfile: ./docker/Dockerfile
      args:
        - BUILD_THREADS=${BUILD_THREADS:-1}
        - BUILD_VERSION=${BUILD_VERSION:-171022}
    volumes:
      - ${CLIENT_PATH:?missing_client_path}:/client:ro
      - shared_configs:/shared_configs:ro
    depends_on:
      - database
    ports:
      - "1001:1001/udp"
      - "2000:2000/udp"
      - "2005:2005/udp"
      - "3000-3300:3000-3300/udp"

  brickbuildfix:
    container_name: DarkflameBrickBuildFix
    networks:
      - darkflame
    build:
      context: .
      dockerfile: ./docker/brickfix.Dockerfile
    ports:
      - 80:80
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:80"]
      interval: 2m
      timeout: 3s
      retries: 3
      start_period: 40s

  account-manager:
    container_name: DarkflameAccountManager
    networks:
      - darkflame
    build:
      context: .
      dockerfile: ./docker/AccountManager.Dockerfile
    environment:
      - DATABASE=${MARIADB_DATABASE:-darkflame}
      - DATABASE_HOST=database
      - DATABASE_USER=${MARIADB_USER:-darkflame}
      - DATABASE_PASSWORD=${MARIADB_PASSWORD:-darkflame}
      - ACCOUNT_SECRET=${ACCOUNT_MANAGER_SECRET:?missing_account_secret}
    ports:
      - 5000:5000
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:5000"]
      interval: 2m
      timeout: 3s
      retries: 3
      start_period: 40s
    depends_on:
      - database

networks:
  darkflame:

volumes:
  database:
  shared_configs:

I would believe there is something wrong with the docker-compose because of the "missing_account_secret" and "missing_client_path". I get thrown a syntax error:

docker compose up -d --build

invalid interpolation format for services.setup.volumes.[]: "required variable CLIENT_PATH is missing a value: missing_client_path". You may need to escape any (Dollarsign) with another (Dollarsign)

devix56 avatar Jun 01 '22 11:06 devix56

Ok, well this is weird. Which composer version are you using?

TheNoim avatar Jun 01 '22 11:06 TheNoim

Ok, well this is weird. Which composer version are you using?

I am using Docker Compose V2 as it is shown in the Docker_Windows.md

devix56 avatar Jun 01 '22 11:06 devix56

I would believe there is something wrong with the docker-compose because of the "missing_account_secret" and "missing_client_path". I get thrown a syntax error:

That does not seem to be a syntax error, but rather Docker's (slightly misleading) way of reporting that environment variable interpolation failed. I am seeing the same thing if I leave CLIENT_PATH blank.

Just to verify, your file is called .env (and not .env.txt with Windows hiding the .txt extension), and it is in the same folder where the docker-compose.yml file is and where you invoke docker compose .... Correct?

Marcono1234 avatar Jun 07 '22 21:06 Marcono1234

I checked on that and it says .env without .txt at the end.

And yes the docker-compose.yml file is in the same folder as the .env file

devix56 avatar Jun 10 '22 13:06 devix56

I checked on that and it says .env without .txt at the end.

you have the setting to show file extensions turned on in file explorer correct?

EmosewaMC avatar Jun 10 '22 14:06 EmosewaMC

Ive just tested this and can confirm the docker setup works and builds the server just fine. Please check your client path as it is in your C drive and needs to be specified as such. C:/Users/dan1088/LEGO_Universe

EmosewaMC avatar Jul 04 '22 04:07 EmosewaMC