assetto-corsa-web / acweb

Assetto Corsa Server Management Tool via Web Interface.
MIT License
58 stars 9 forks source link

docker container not starting #41

Closed theouteredge closed 6 years ago

theouteredge commented 6 years ago

Hi,

I'm just trying to use your docker container, but when I try and run the image is exits instantly.

I've installed mysql as a container and its up and running with port 3306 exposed. I've created an acweb database and run your db creation scripts.

I've tried the following commands: sudo docker run -d -p 80:8080 --name acweb --link mysql:latest -e ACWEB_DB_USER=root -e ACWEB_DB_PASSWORD=******* -e ACWEB_DB_HOST="tcp(10.1.0.4:3306)" -e ACWEB_DB=acweb -v /ac/install/path:/ac -v /log/dir/path:/logs kugel/acweb

sudo docker run -d -p 80:8080 --name acweb -e ACWEB_DB_USER=root -e ACWEB_DB_PASSWORD=******* -e ACWEB_DB_HOST="tcp(127.0.0.1:3306)" -e ACWEB_DB=acweb -v /ac/install/path:/ac -v /log/dir/path:/logskugel/acweb

sudo docker run -d -p 80:8080 --name acweb -e ACWEB_DB_USER=root -e ACWEB_DB_PASSWORD=***** -e ACWEB_DB_HOST=127.0.0.1 -e ACWEB_DB_PORT=3306 -e ACWEB_DB=acweb -v /ac/install/path:/ac -v /log/dir/path:/logs kugel/acweb

ac@assetto-corsa-server:~$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS               NAMES
e140e0bff739        kugel/acweb         "/app/main"              5 seconds ago       Exited (1) 4 seconds ago                       acweb
63a025a75a74        mysql               "docker-entrypoint.s…"   About an hour ago   Up About an hour           3306/tcp            elastic_montalcini
ee1d85aff4da        mysql:latest        "docker-entrypoint.s…"   About an hour ago   Up About an hour           3306/tcp            mysql

Any ideas why it exits immediately?

Kugelschieber commented 6 years ago

Have you looked at the log file? You can take a look at the docker image output by removing the -d option and adding -e ACWEB_LOGDIR= (empty) as well. It's most likely a database connection issue. I can run it on my machine (Ubuntu 16.04, MySQL running inside a container) like so:

sudo docker run -p 8077:8080 --rm --name acweb -e ACWEB_DB_USER=root -e ACWEB_DB_PASSWORD=root -e ACWEB_DB_HOST="tcp(172.17.0.1:3306)" -e ACWEB_DB=acweb -e ACWEB_LOGDIR= kugel/acweb

Notice the MySQL IP is set to the docker bridge IP. You can look it up by using ifconfig.

theouteredge commented 6 years ago

Thank you that was the issue! The mysql IP address is 172.17.0.2

The website is up and running :)

Kugelschieber commented 6 years ago

You're welcome :)

theouteredge commented 6 years ago

Another question. Sorry.

When an AC server is launched, its it launched within the docker container or on the host machine?

Kugelschieber commented 6 years ago

Huh good question. The instance is started inside the docker image but reads the application data from the host machine.

theouteredge commented 6 years ago

So I need to to forward the docker server ports, same as the web port?

Kugelschieber commented 6 years ago

Yes you need to expose the game ports.

theouteredge commented 6 years ago

Hi got everything almost setup

but when I try and start a server I get level=error msg="Error starting instance" err="fork/exec /ac/acServer: permission denied"

I've tried chmod 777 server

theouteredge commented 6 years ago

Fixed this, chmod for some reason didn't change the exe. I'm all up and running, thanks for this btw, it works well :)