- Select plan eg Ubuntu, basic
- Click on 'Add public SSH key'
- Create new SSH key with
ssh-keygen
and save to/Users/USER/.ssh
- Paste contents of public key into field and name your key
- Create new SSH key with
- Install Dokku
wget https://raw.githubusercontent.com/dokku/dokku/v0.24.10/bootstrap.sh;
sudo DOKKU_TAG=v0.24.10 bash bootstrap.sh
- Go to server's IP address and finish set up for Dokku
open http://<SERVER_IP>
- Open Git Bash and go to ssh folder
cd ~/.ssh
- In
config
file (create one if not found), write:
#account- dokku
Host <SERVER_IP_ADDRESS>
HostName <SERVER_IP_ADDRESS>
IdentityFile ~/.ssh/<PRIVATE_KEY_FILE_NAME>
-
Create express app that listens on port 4000
-
Create Dockerfile
FROM node:15
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
ENV PORT 4000
CMD ["node", "./index.js"]
- Purchase domain on namecheap
- On digitalocean, go to
Networking
> your app >Manage
- On namecheap, go to
Dashboard
> your domain >Manage
>Nameservers
> selectCustom DNS
- Copy nameservers from digitalocean panel to namecheap's custom DNS
ns1.digitalocean.com.
ns2.digitalocean.com.
ns3.digitalocean.com.
- Wait a few hours for it to be set
SSH into server
ssh root@<SERVER_IP>
Create dokku app
dokku apps:create <APP_NAME>
(Optional) Set env vars
dokku config:set <APP_NAME> KEY1=VALUE1 KEY2=VALUE2
Configure domain
dokku domains:add <APP_NAME> <DOMAIN_NAME>
Check if domain is set
dokku domains:report
Remove old hostname
dokku domains:remove <APP_NAME> <APP_NAME>.dokku-s-1vcpu-1gb-fra1-01
TLS/SSL certificates
dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
Map container port from 80 to 4000
dokku proxy:ports-add <APP_NAME> http:80:<CONTAINER_PORT>
Config Letsencrypt email
dokku config:set --no-restart <APP_NAME> DOKKU_LETSENCRYPT_EMAIL=<EMAIL>
Enable Letsencrypt
dokku letsencrypt:enable <APP_NAME>
On local machine
git remote add dokku dokku@<SERVER_IP>:<APP_NAME>
Push to master
git push dokku master