Deploy ReactionCommerce with Docker, Digital Ocean/AWS, and Lets Encrypt SSL
1. Create mongodb with mLab and then link to reaction with url:
mongodb://username:password@host:port/database-name
docker-machine create \
--driver digitalocean \
--digitalocean-access-token access-token-here \
--digitalocean-size 2gb \
--digitalocean-region sfo1 \
reaction
eval "$(docker-machine env reaction)"
Build Dockerfile with:
Build by creating directory "example: mkdir dockerfile"
Then - cd dockerfile
Then - touch Dockerfile
Then - vi Dockerfile
Build Dockerfile with:
FROM jwilder/nginx-proxy:latest
RUN { \
echo 'fastcgi_buffers 4 256k;'; \
echo 'fastcgi_buffer_size 128k;'; \
echo 'fastcgi_busy_buffers_size 256k;'; \
} > /etc/nginx/conf.d/my_proxy.conf
RUN sed -i 's/^http {/&\n proxy_busy_buffers_size 256k;/g' /etc/nginx/nginx.conf && \
sed -i 's/^http {/&\n proxy_buffers 4 256k;/g' /etc/nginx/nginx.conf && \
sed -i 's/^http {/&\n proxy_buffer_size 128k;/g' /etc/nginx/nginx.conf
Then Build The Image:
# build
docker build -t custom-nginx .
# run
docker run -d -p 80:80 -p 443:443 \
--name nginx-proxy \
-v /opt/certs:/etc/nginx/certs:ro \
-v /etc/nginx/vhost.d \
-v /usr/share/nginx/html \
-v /var/run/docker.sock:/tmp/docker.sock:ro \
custom-nginx
# Let's Encrypt
# https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion
docker run -d \
--name lets-encrypt \
--volumes-from nginx-proxy \
-v /opt/certs:/etc/nginx/certs:rw \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
jrcs/letsencrypt-nginx-proxy-companion:latest
docker run -d \
--name reaction \
--restart always \
-e MONGO_URL="mongodb://username:password@host:port/database-name" \
-e ROOT_URL="https://example.com" \
-e VIRTUAL_HOST="example.com" \
-e VIRTUAL_PORT=3000 \
-e LETSENCRYPT_EMAIL="email-address" \
-e LETSENCRYPT_HOST="example.com" \
reactioncommerce/reaction:latest
docker logs "reaction-container-name"
Then you will get admin login info
*Direct domain name to instance IP address
*navigate to domain name
Done!