Technical Articles & Tutorials

Migrating from Heroku to Vultr with Dokku

Why Change?

Heroku is removing their free tier.

Vultr is inexpensive and fast.

Dokku makes it easy to self host.

TLDR; (Too Long Didn't Read)

Migration worked, costs are down, speed is up.

Setting Up Vultr

I use VULTR because they are cheaper than most other cloud providers and their VMs are more performant per core and with optional NVMe storage its blazing fast.

Choose Cloud Compute as Server Type.

AMD High Performance as CPU type.

Choose the location closest to you are your customers. Vultr has 25 locations around the globe.

Operating System: Ubuntu 22.04 LTS x64 or newer.

Server Size: 25 GB NVMe, 1 vCPU, 1 GB Memory, 1 TB Bandwidth

Auto Backups, only $1.20/month extra.

Create your server hostname and label. You'll have to wait until the system is created to update your DNS with the IP.

Logging in and Updating

ssh-copy-id [email protected]
ssh [email protected]
apt update
apt upgrade -y
shutdown -r now

Installing Dokku on the VM

wget https://raw.githubusercontent.com/dokku/dokku/v0.29.3/bootstrap.sh
DOKKU_TAG=v0.29.3 bash bootstrap.sh

dokku domains:set-global yourdomain.com


echo "your-public-key-goes-here" | dokku ssh-keys:add admin

dokku apps:create your-app-name

dokku plugin:install https://github.com/dokku/dokku-postgres.git
dokku postgres:create your-db-name-production

dokku postgres:link your-db-name-production your-app-name

# Open Firewall to Web Traffic
ufw allow from any to any port 80
ufw allow from any to any port 443

HTTPS with LetsEncrypt.org

Free https is easy with the Let's Encrypt plugin for Dokku.

dokku config:set app-name DJANGO_ALLOWED_HOSTS=hostname.com
dokku domains:add app-name your-domain.com
dokku domains:set app-name mydomain.com  www.mydomain.com
dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
dokku config:set --no-restart app-name [email protected]
dokku letsencrypt:enable app-name
dokku letsencrypt:auto-renew app-name

Deploy Code Via Git Push

pip install cookiecutter
cookiecutter https://github.com/Jean-Zombie/cookiecutter-django-wagtail/

git init .
git add .
git commit -m "Initial Commit"
git remote add dokku [email protected]:projectname
git push dokku main

# Depending on how you manage your static files you may want to generate and commit them
python manage.py collectstatic

If you don't already have a python app, you can start with the heroku python-getting-started.

# To add Existing Repo to git
git init .
git add .
git commit -m "Initial Commit"
git remote 
git push dokku main:master

Resources

Dokku Plugins

About

Why fear those copying you, if you are doing good they will do the same to the world.

Archives

  1. AI & Automation
  2. AI Filtering for Web Content
  3. Web Fundamentals & Infrastructure
  4. Reclaiming Connection: Decentralized Social Networks
  5. Web Economics & Discovery
  6. The Broken Discovery Machine
  7. Evolution of Web Links
  8. Code & Frameworks
  9. Breaking the Tech Debt Avoidance Loop
  10. Evolution of Scaling & High Availability
  11. Evolution of Configuration & Environment
  12. Evolution of API Support
  13. Evolution of Browser & Client Support
  14. Evolution of Deployment & DevOps
  15. Evolution of Real-time Capabilities
  16. The Visual Basic Gap in Web Development
  17. Evolution of Testing & Monitoring
  18. Evolution of Internationalization & Localization
  19. Evolution of Form Processing
  20. Evolution of Security
  21. Evolution of Caching
  22. Evolution of Data Management
  23. Evolution of Response Generation
  24. Evolution of Request Routing & Handling
  25. Evolution of Session & State Management
  26. Web Framework Responsibilities
  27. Evolution of Internet Clients
  28. Evolution of Web Deployment
  29. The Missing Architectural Layer in Web Development
  30. Development Velocity Gap: WordPress vs. Modern Frameworks
  31. Data & Storage
  32. Evolution of Web Data Storage
  33. Information Management
  34. Managing Tasks Effectively: A Complete System
  35. Managing Appointments: Designing a Calendar System
  36. Building a Personal Knowledge Base
  37. Contact Management in the Digital Age
  38. Project Management for Individuals
  39. The Art of Response: Communicating with Purpose
  40. Strategic Deferral: Purposeful Postponement
  41. The Art of Delegation: Amplifying Impact
  42. Taking Action: Guide to Decisive Execution
  43. The Art of Deletion: Digital Decluttering
  44. Digital Filing: A Clutter-Free Life
  45. Managing Incoming Information
  46. Cloud & Infrastructure
  47. AWS Lightsail versus EC2
  48. WordPress on AWS Lightsail
  49. Migrating from Heroku to Dokku
  50. Storage & Media
  51. Vultr Object Storage on Django Wagtail
  52. Live Video Streaming with Nginx
  53. YI 4k Live Streaming
  54. Tools & Connectivity
  55. Multi Connection VPN
  56. Email Forms with AWS Lambda
  57. Static Sites with Hexo

Optimize Your Website!

Is your WordPress site running slowly? I offer a comprehensive service that includes needs assessments and performance optimizations. Get your site running at its best!

Check Out My Fiverr Gig!

Elsewhere

  1. YouTube
  2. Twitter
  3. GitHub