Create an AWS Account, then open the console at EC2 and launch a bitnami couchdb
- Create an aws account
https://console.aws.amazon.com
- Go to the EC2 Service Link in the console
https://us-west-1.console.aws.amazon.com/ec2/v2/home?region=us-west-1#Home:
- Click Launch Instance
- Click AWS Market Place
- Search for CouchDB
- Select the Free Tier Eligible
- click continue
- select t2.micro
- add 20 GB storage
- add name tag with value
- make sure the security group has ports 22, 80, 443 open
- click launch and generate or use a keypair
- ssh into your instance
`ssh -i [your key] bitnami@[your public dns]
- run the following cmds:
sudo apt-get update -y
sudo apt-get install nginx -y
- edit the default nginx file
sudo nano /etc/nginx/sites-available/default
Comment out
root
andindex
Change the server_name to the sub-domain you will be using ex:db.example.com
Replace the location with the following proxy info
location / {
proxy_pass http://localhost:5984;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
}
location ~ ^/(.*)_changes {
proxy_pass http://localhost:5984;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
- save file, then reload
sudo nginx -t
sudo systemctl reload nginx
Using your DNS you need to create an A record pointing to the ip of your server
now dns add exampe.com db A [ip address]
Still in the ssh shell we need to run the following cmds:
sudo add-apt-repository ppa:certbot/certbot
- press ENTER
sudo apt-get update -y
sudo apt-get install python-certbot-nginx -y
- run the cert bot script
sudo certbot --nginx -d db.example.com
Should turn this into an automated script that can run automatically maybe compile a cli with pkg to ship from s3 to run