Self-hosted Installation
Install API
Dokku is an open source version of Heroku that can be installed on your own server.
Fortunately, DigitalOcean has an image based on Dokku, ready to be used after a few clicks.
In the next steps, we will setup the server with Dokku, install the backend services, add file persistence, and even configure SSL without extra cost.
Create an account in DigitalOcean
Go to DigitalOcean and create a new account, or login using an existing account.
Note
Sign up using our referral link to get $100 USD credit.
Create Droplet
Within your DigitalOcean account, click on Create and select Droplets. Then, select the Dokku image as shown in the following video:
After a couple of minutes, we should have our server running with Dokku.
In the video above, you will notice that the SSH key was already configured. In the opposite case, you will have to add your own SSH key, which will be necessary to access to the server without a password.
Note
We recommend to start with the $10/mo plan (2GB) and with the data center most closest to the location of your users. If the server load increases in the future you can increase the CPU, RAM and hard disk at any time through the DigitalOcean panel. It would also be a good idea to activate backups.
Setup Dokku
Configure an ssh key
Usually your key is already available under the current user’s ~/.ssh/authorized_keys
file
cat ~/.ssh/authorized_keys | dokku ssh-keys:add admin
Set your global domain
This domain should have an A record or CNAME pointing at your server’s IP.
dokku domains:set-global dokku.me
Setup DNS
Finally, add one A record in the DNS configuration of your domain to point to the IP of the Droplet/Server. This step varies depending on your domain provider.
Let’s start by access through SSH to the server. In your command terminal, type ssh root@server_ip
and press enter. Remember to replace server_ip
with the actually server IP.
Download and run our Dokku script
Download script
wget https://quanlabs.s3.us-east-2.amazonaws.com/dokku.sh
Run script
chmod +x dokku.sh
./dokku.sh
The script automates the creation and configuration of the app, database, storage, SSL certificate, and email.
You’ll be asked to enter your app name and your keys for services like Stripe, Mailgun, Firebase, etc.
If for some reason you don’t plan to use some of the services listed, press enter to continue.
You can update the app configuration at any time with the command dokku config:set
.
For instance, setting the Google Client ID is as easy as:
dokku config:set app_name GOOGLE_CLIENT_ID="1234567890"
Note
Replace app_name
with the app name entered during the script execution.
Once the script has finished, you should see the installation report and your App Keys. We recommend copying all the output to a safe file, especially the App ID and Master Keys. These keys are for connecting the app with the API.
Setup Git repository
The following commands should be executed with the terminal pointing to the api directory.
Initialize a new repository.
git init
Add all the files to the repository.
git add .
Commit changes made to the repository.
git commit -m "Initial commit"
Add a remote called Dokku where the code will be pushed.
git remote add dokku dokku@domain:app_name
Note: domain
should be equal to your domain configured with dokku domains:set-global dokku.me
, and app_name
should match with the value entered in the dokku script.
We are ready to push the changes to the server.
git push dokku master
Wait a few minutes and you should see a success message that the application has been successfully deployed.
If everything went well, open the app URL in your web browser, and the login page should appear.
Navigate to your app domain (ex.: https://cloud.yourdomain.com
), and fill out the form to create the Super Admin.
The Parse Dashboard should load. Enter your PARSE_DASHBOARD_USER
and the encrypted password.
Note
Every time we make a change in the source code, we have to push the code to reflect the changes in the server as follows: add the files to the repository, confirm the changes and finally push them with the command git push dokku master
Install Admin Portal
See here to learn how to install the admin portal in App Platform by DigitalOcean. Other good options to install it are Vercel, Netlify, or Firebase Hosting. Feel free to choose the provider more suitable for you.