- Run
yarn build
ornpm run build
on your local machine.scp
it over to the EC2 box (you can compress it into abuild.zip
file and thenunzip
once it's copied). - Install
docker
anddocker-compose
on 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
git
on the EC2 if you haven't already. Then clone this repo onto the box.cd
into the repo. - Following the
README
from 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.pem
and./data/certbox/live/sub.mysite.com/privkey.pem
. Look at thevolumes
section in thedocker-compose.yml
in 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.