- Run
yarn buildornpm run buildon your local machine.scpit over to the EC2 box (you can compress it into abuild.zipfile and thenunziponce it's copied). - Install
dockeranddocker-composeon the EC2 box following these instructions. - Create sym link for docker-compose:
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose - Install
giton the EC2 if you haven't already. Then clone this repo onto the box.cdinto the repo. - Following the
READMEfrom the above repo, update all necessary configurations (email address, server names). - Run
sudo "PATH=$PATH" sh init-letsencrypt.sh. - The generated certs should be at
./data/certbox/live/sub.mysite.com/fullchain.pemand./data/certbox/live/sub.mysite.com/privkey.pem. Look at thevolumessection in thedocker-compose.ymlin case the configuration is different. - Now, you can serve your React app with
nginx, or use a simple Go server to do it.
NOTE: The docker container contains a cron job (I think) that renews the certificates from time to time. I would probably run this separately, outside the container.