🦈

Dokku <> DigitalOcean

Tags
Cloud
Date
Apr 23, 2022
These steps are the guidance to setup your own PaaS using Dokku and powered by DigitalOcean for any side project.
 
Why Dokku?
  • Dokku itself is open-source and free, with features and control
  • supporting Git deployment and lifetime management out-of-the-box (plug and play)
  • Dokku can be hosted on a $5 DigitalOcean droplet, and so the more apps you can host
 
Initial Steps
  1. Create a droplet with Dokku image from the marketplace
    1. notion image
  1. Setup your SSH key and connect to your droplet
    1. notion image
      notion image
  1. Visit the initial dokku setup within your droplet (can follow the welcome message inside the terminal) then visit the initial page
    1. notion image
  1. You’re ready to go!
 
Deploy your App
  1. Create a new Git commit so that it can be pushed up to the Dokku server. Since Dokku uses Git to deploy applications, every change you make that you want to deploy to the server must exist in Git at some stage. Otherwise, the changes won't be pushed.
  1. Add the git remote target that points to Dokku
    1. # With a domain name (replace example.com with your domain) git remote add dokku dokku@example.com:dokku-demo
      The remote URL contains the application name we want to use
  1. push your git resource to the dokku instance
    1. git push dokku master
You’ll be able to reach it at http://<your IP address> (If not, make sure your Dockerfile is proper)
 
Github Integration
  1. Create a .github/workflow directory inside your project root and create a deploy.yml file in it.
    1. name: Deploy test on: push: branches: - master jobs: deploy: name: Deploy runs-on: ubuntu-latest steps: - uses: actions/checkout@master - id: deploy name: Deploy to dokku uses: idoberko2/dokku-deploy-github-action@v1 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} dokku-host: 'corazzon.com' app-name: 'corazzon-dokku-app'
      You should change dokku-host and app-name inputs to match your own Dokku app’s settings.
  1. Add private key
    1. Open your repository on GitHub, and navigate to Settings > Secrets:
      notion image
  1. Push the changes on what you’ve done on Step 1 and the deployment would be automatically run!
 
Working with Monorepo
References:
Â