diff --git a/playbooks/code-deploy.yml b/playbooks/code-deploy.yml index 5f7c8f6..35b2214 100644 --- a/playbooks/code-deploy.yml +++ b/playbooks/code-deploy.yml @@ -9,10 +9,15 @@ tasks: - name: Refresh code command: chdir=/root/wrestlingApp git pull origin master - - name: Restart and rebuild docker container - command: chdir=/root/wrestlingApp bash rails-prod.sh wrestlingdev-app - - name: Wait 5 seconds for server to warm up - command: sleep 5s + + - name: Create apache docker image + command: chdir=/root/wrestlingApp docker build -t wrestlingdev-web -f rails-prod-Dockerfile . + + - name: Kill running docker container + command: docker kill wrestlingdev-web + + - name: Start docker container + command: docker run -h {{ansible_hostname}} -d --restart=always --env-file /root/prod.env -v /srv/docker/apache2/logs:/var/log/apache2 -v /etc/localtime:/etc/localtime -p 80:80 -p 443:443 wrestlingdev-web - hosts: workers remote_user: root @@ -21,8 +26,12 @@ tasks: - name: Refresh code command: chdir=/root/wrestlingApp git pull origin master - - name: Restart and rebuild docker container - command: chdir=/root/wrestlingApp bash rails-worker-prod.sh wrestlingdev-worker - - name: Wait 5 seconds for server to warm up - command: sleep 5s + + - name: Create apache docker image + command: chdir=/root/wrestlingApp docker build -t wrestlingdev-web -f rails-prod-Dockerfile . + - name: Kill running docker container + command: docker kill wrestlingdev-web + + - name: Start docker container + command: docker run -h {{ansible_hostname}} -d --restart=always --env-file /root/prod.env -v /etc/localtime:/etc/localtime wrestlingdev-worker bundle exec rake jobs:work RAILS_ENV=production