Skip to content

Instantly share code, notes, and snippets.

@curranabell
Last active February 25, 2018 15:17
Show Gist options
  • Save curranabell/69fa723c9ce66c2fc3e4ba0f48968810 to your computer and use it in GitHub Desktop.
Save curranabell/69fa723c9ce66c2fc3e4ba0f48968810 to your computer and use it in GitHub Desktop.
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!
@mavais
Copy link

mavais commented Feb 25, 2018

@curranabell, I followed the same exact steps but i'm having issues, one is service temporarily unavailable and other letsencrypt certification failure. I'm deploying my custom reaction image. Can you please guide me here if i missed anything?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment