By Michal Hantl
Hi, I deployed my app to droplet with rails, postgre, docker and dokku.
All was running smoothly, until I restarted the server today and I got into two problems:
One rails app said it was already running. The app said, there was /app/tmp/pids/server.pid file but I couldn’t find the server.pid file in the image though using find / | grep 'server.pid'
Other app couldn’t connect to the postgres, which after an inspection shows that is running on a different port. I tried re-deploying, re-establishing the postgre link through dokku and nothing happened, same error.
Eventually, I restarted the app2 with bad postgre through docker, that made things even worse and I have now two apps that won’t start.
Also I am trying to figure out why the hell I have unnamed images which seem to contain the Rails app and database, even tried to erased them and start fresh, but the deeper I dig, the more weird problems I get.
For instance removing the image says a different image is not there:
root@michal-do:~# docker rmi 44ce0ececdb4
Error response from daemon: No such id: ed09b33bb766f286542a2e7b7a71333bfff409f7bac78e42cf35302e29982a24
2014/10/07 09:10:40 Error: failed to remove one or more images
root@michal-do:~# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<none> <none> 44ce0ececdb4 24 minutes ago 1.264 GB
dokku/fulcrum latest c10d700243b2 4 hours ago 1.242 GB
<none> <none> cc27ac49e4a6 4 hours ago 1.264 GB
postgresql/fondio latest fdf7f34be819 5 hours ago 310.5 MB
postgresql/fulcrum latest dbc9d1eb0ced 7 weeks ago 310.5 MB
<none> <none> cca64120d443 7 weeks ago 310.5 MB
kloadut/postgresql latest 9ed9651b7b98 7 weeks ago 310.5 MB
ubuntu trusty c4ff7513909d 8 weeks ago 225.4 MB
progrium/buildstep latest cbac8f84e925 11 weeks ago 1.151 GB
ubuntu 14.04 e54ca5efa2e9 3 months ago 276.5 MB
I seem to run into some newbie stuff I can’t even google answers for so any help is greatly appreciated.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I had a similar issue where I got 502 bad gateway error after powering off droplet and back on. I was able to easily fix it by ssh into droplet, and run: dokku ps:rebuildall See my answer (lacostenycoder) at: https://stackoverflow.com/questions/21056911/error-502-bad-gateway-on-nginx-rails-dokku and up-vote if it helps!
Dokku can be a great way to deploy apps because it hides a lot of complexities. Though when it breaks down, that same quality can be quite frustrating. Hopefully, I can help point you in the right direction.
The way Dokku itself restarts apps after a change is by issuing:
dokku release myapp
dokku deploy myapp
This blog post deals with problems relinking apps to postgres after a reboot, and suggests creating this script to help:
#!/bin/bash
APP="$1";
CURRENT_URL=`dokku config:get $APP DATABASE_URL`
dokku postgresql:create $APP
ID=$(docker ps -a | grep "postgresql/$APP":latest | awk '{print $1}')
IP=$(docker inspect $ID | grep IPAddress | awk '{ print $2 }' | tr -d ',"')
NEW_URL=$(echo $CURRENT_URL | sed -e "s/@.*\//@$IP\//g")
dokku config:set $APP DATABASE_URL=$NEW_URL
Let us know if that gets you any further.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.