Skip to content

Latest commit

 

History

History
70 lines (51 loc) · 1.63 KB

File metadata and controls

70 lines (51 loc) · 1.63 KB

Use 1GB Ubuntu DO Droplet

Log in as root

ssh root@<the new ip>

Create swapfile

  • fallocate -l 1G /swapfile
  • chmod 600 /swapfile
  • mkswap /swapfile
  • swapon /swapfile
  • echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
  • sysctl vm.swappiness=10
  • nano /etc/sysctl.conf
  • At the bottom of the file add vm.swappiness=10

Download and install node

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
apt-get install -y nodejs

Install yarn

npm install -g yarn

Install pm2

yarn global add pm2

Add app user

useradd -m -s bash -G sudo <app name>

Edit sshd_config to use authorized_keys

  • nano /etc/ssh/sshd_config
  • Find line about authorized_keys and home

Add authorized_keys

Add public key we will access server with

Verify you can connect to server with ssh

From your local machine ssh -v <app name>@<app domain or ip>

Add deploy key to Github

Generate a key for server and add to Github repo as deploy key

Connect to github with ssh to authorize host ssh git@github.com

You should see a message from github with the repo and then get disconnected

Install postgres

sudo apt-get install postgresql postgresql-contrib

Create user

adduser <app name>

Create db

createdb <app name>

Add user to db

  • su <app name>
  • psql
  • grant all privileges on database <app name> to <app name>;

Install caddy server

Gist with easy setup

Set pm2 to automatically start back up

pm2 startup systemd -u <app name> --hp <app home directory> pm2 save once the process is running to save it for restart