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

Tracks 2.6.1 Container won't start after it has ran once #2844

Open
john2exonets opened this issue Oct 6, 2022 · 12 comments
Open

Tracks 2.6.1 Container won't start after it has ran once #2844

john2exonets opened this issue Oct 6, 2022 · 12 comments
Labels
bug 🐛 Problems with the code that result in unexpected or bad behavior

Comments

@john2exonets
Copy link

You can start the Tracks 2.6.1 Container just once.....after that, it won't start and a 'docker logs tracks' dump will show this error when you try and start it again:

=> Booting Puma
=> Rails 6.0.5.1 application starting in production
=> Run `rails server --help` for more startup options
A server is already running. Check /app/tmp/pids/server.pid.
Exiting

@ZeiP
Copy link
Member

ZeiP commented Oct 6, 2022

Which installation method and which commands are you using?

@john2exonets
Copy link
Author

john2exonets commented Oct 6, 2022

i am following the Installation guide from this repo: https://github.com/TracksApp/tracks/blob/master/doc/installation.md

My DB install script:

docker run -d -p 3306:3306 --name tracks-db -e MYSQL_ROOT_PASSWORD=blank123 -d mariadb

My DB Setup script:

docker run --link tracks-db:db --rm -t -e "DATABASE_PASSWORD=blank123" -e "DATABASE_TYPE=mysql2" -e "DATABASE_PORT=3306" tracksapp/tracks:2.6.1 bin/rake db:reset --trace

My Tracks install script:

docker run -d -p 3000:3000 --name tracks --link tracks-db:db -t tracksapp/tracks:2.6.1

@cosmoneer
Copy link

I'm having the same problem with a Docker container running on UNRAID 6.9.2, using the UNRAID Community Apps feature to install it. It appears to be using this repository: https://hub.docker.com/r/tracksapp/tracks

This is the error I get:
=> Booting Puma
=> Rails 6.0.4.6 application starting in production
=> Run rails server --help for more startup options
A server is already running. Check /app/tmp/pids/server.pid.

There is an installation note with the container, which reads:

NOTE: After installing, you must console into the container and run the following command to initialize the database first!
rake db:reset
After running that command, you should see the database has tables in it and the app should be usable at that point.

I successfully executed this command and have not had any issues. A reboot of the host server will restore functionality, but only so long as the container is not stopped.

@blacktav
Copy link

I am also experiencing this problem.
I am using

  • the latest tracksapp on docker (tho the problem existed on a previous image as well)
  • an external postgreSQL database (14.6)
  • an ArchLinux host (updated @ 28/12/2022)

The container can be created fine but after stopping and attempting to restart, the following is logged:

=> Booting Puma
=> Rails 6.0.5.1 application starting in production 
=> Run `rails server --help` for more startup options
A server is already running. Check /app/tmp/pids/server.pid.

Obviously I cannot reinitialise my database as @cosmoneer suggests
When the container is first run-up, it logs this...

=> Booting Puma
=> Rails 6.0.5.1 application starting in production 
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 6.0.0 (ruby 2.7.7-p221) ("Sunflower")
*  Min threads: 5
*  Max threads: 5
*  Environment: production
*          PID: 9
* Listening on http://0.0.0.0:3000
Use Ctrl-C to stop

@blacktav
Copy link

The container can be reliably rebuilt at anytime using the existing database.
It is just the start/stop cycle do not function

@nrybowski
Copy link

I had the same issue with the /app folder being a volume mounted from the host in the container. Removing the file /app/tmp/pids/server.pid before restarting the container solves the issue.

@LeeThompson
Copy link

LeeThompson commented Jul 15, 2024

Yup this happens to me too. The container version should probably not check to see if the server is running like this at all.
Especially since /app is mounted in a docker controlled volume, not a volume mapped to the host in the default case.

@ZeiP
Copy link
Member

ZeiP commented Jul 18, 2024

It indeed seems that for some reason the server doesn't remove the pid file when exiting. This is likely because of a failed exit; in a local environment this is easy to workaround just by removing the tmp/pids/server.pid file before restarting, but need to figure out why it's not exiting properly.

@ZeiP ZeiP added the bug 🐛 Problems with the code that result in unexpected or bad behavior label Jul 18, 2024
@LeeThompson
Copy link

Actually in a container it's not that easy to remove it especially if docker is running on an appliance (NAS, etc). It may be best to have the container version not check the pid at all. Currently, when it sees the pid is place the container fatals out making it difficult (unless you're really familiar with docker tools) to remove the pid from the volume since you can't attach a terminal to the container (since it's no longer running).

(I ended up working around this by mounting the pid file on the host file system and writing a bash script to remove it (if present) on system startup.)

Mostly this mechanism just make it harder to start Tracks if there is an abnormal shutdown or if it doesn't clean up the pid.

@john2exonets
Copy link
Author

Sadly, this is still happening in the latest version (2.7.1) ....two years later.....

@blacktav
Copy link

You can workaround this by removing the pid file immediately before the container is stopped, for example:
docker exec <NAME> rm /app/tmp/pids/server.pid

@LeeThompson
Copy link

You can workaround this by removing the pid file immediately before the container is stopped, for example: docker exec <NAME> rm /app/tmp/pids/server.pid

That doesn't work very well when the container stops nearly instantly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Problems with the code that result in unexpected or bad behavior
Projects
None yet
Development

No branches or pull requests

6 participants