Example is at rails.koda.io using digitalocean.com and repo docker.io/dakotalightning/docker-rails
If you don't have docker on your local machine get started is a good place to start. It has gotten allot easier to get start, docker has managed to get everything you need in the Docker toolbox. Once you have docker all installed.
After clone run setup (you only need to run this once)
$ ./setup.sh
After any changes to the Dockerfile
docker-compose build
docker-compose up
check your docker-machine ip docker-machine env default
used to access the container locally
when ready to push to production, create the production image
$ docker build -t dakotalightning/koda-rails -f Dockerfile.production .
push the image to a repo, I'm using docker.io since its free for public repositories
docker push dakotalightning/koda-rails
This is what I did for digitalocean.com I'm not sure if it is the right way, it works I'm looking into it this ...
-
ssh into the server droplet
-
install docker-compose
pull the
docker-production.yml
on the serverwget https://raw.githubusercontent.com/dakotalightning/koda.rails/docker/docker-production.yml -O docker-compose.yml
-
start up docker-compose
docker-compose up
docker-compose will pull in the images automatically from the
docker-compose.yml
file -
in another window run this to get the database, this will run
rake
and--rm
remove the container once its done.docker-compose run --name rake --rm web rake db:setup
from my understanding you want to use
--rm
flag when runningdocker-compose run
. Everyrun
will start up a new container ex:web_run_1
web_run_2
web_run_3
etc. -
ctrl+c
to stop the containers -
run
docker-compose start
to start the containers in the background -
run
docker-compose ps
to see them runningName Command State Ports -----------------------------------------------------------------------------
dockerrails_db_1 /entrypoint.sh mysqld Up 0.0.0.0:13306->3306/tcp
dockerrails_nginx_1 nginx -g daemon off; Up 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp dockerrails_redis_1 /entrypoint.sh redis-server Up 0.0.0.0:6379->6379/tcp
dockerrails_web_1 bash -c rm -f tmp/pids/ser ... Up 0.0.0.0:3000->3000/tcp -
go to the url of the droplet provided on digitalocean
deploy-images | bash -s
this will be worked into job somwhere?
curl -sSL https://raw.githubusercontent.com/dakotalightning/docker-rails/master/deploy-server | bash -s
- circle ci for testing and deployment of images
- webhook? to deploy bot to pull new images and set new container?