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
- Create a droplet with Dokku image from the marketplace
- Setup your SSH key and connect to your droplet
- Visit the initial dokku setup within your droplet (can follow the welcome message inside the terminal) then visit the initial page
- You’re ready to go!
Â
Deploy your App
- 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.
- Add the git remote target that points to Dokku
# 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
- push your git resource to the dokku instance
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
- Create aÂ
.github/workflow
directory inside your project root and create aÂdeploy.yml
file in it.
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.- Add private key
Open your repository on GitHub, and navigate to Settings > Secrets:
- Push the changes on what you’ve done on Step 1 and the deployment would be automatically run!
Â
Working with Monorepo
References:
Â