Setting Up Dokku in AWS EC2
Dokku is a popular open-source platform that simplifies the process of deploying and managing applications. In this guide, we'll show you how to set up Dokku in an Amazon Web Services (AWS) EC2 instance.
Step 1: Pass the Public SSH Key to the AWS Server
Use the following command to pass the public SSH key to the AWS server:
# cat <public_key_dir> | ssh -i <aws_key_dir> <username>@<ip_add/domain> sudo dokku ssh-keys:add <KEY_NAME>
cat ~/.ssh/id_rsa.pub | ssh -i "intelli_masuk.pem" [email protected] sudo dokku ssh-keys:add admin
Step 2: Remote Dokku Command in a Server from Local Machine
To run a remote Dokku command in the server from your local machine, use the following command:
# ssh dokku@<ip_add> <DOKKU_COMMAND>
ssh [email protected] apps:create hobby
Step 3: Setting Up the Global Domain for a Dokku Server
To set up the global domain for a Dokku server, follow these steps:
- Remove the global domain:
# ssh dokku@<IP_ADD> domains:remove-global <SERVER_ADDRESS>
ssh [email protected] domains:remove-global example-address.compute.internal
- Add the global domain:
# ssh dokku@<IP_ADD> domains:add-global <DOMAIN_NAME>
ssh [email protected] domains:add-global example.com
Step 4: Setting Up the SSL Certificate Plugin for a New Dokku Server
To set up the Dokku Let's Encrypt plugin for the first time, use the following commands:
sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
dokku config:set --global [email protected]
Step 5: Deploying an Application in Dokku Server
To deploy an application in the Dokku server, follow these steps:
- Add a Git repository in the Dokku server:
# git remote add <repo_name> dokku@<ip_add/domain>:<app_name>
git remote add dokku [email protected]:hobby
- Create an app in the Dokku server from your local machine:
# ssh dokku@<ip_add> apps:create <app_name>
ssh [email protected] apps:create hobby
- Deploy the Git repository in the Dokku server:
# git push <REPOSITORY_NAME> <BRANCH_NAME>
git push dokku main
Step 6: Setting Up a Domain for an App
To set up a domain for an app, follow these steps:
- Report the app's domains:
ssh [email protected] domains:report hobby
- Set the domain for the app:
dokku domains:set hobby test-preview.intellidigital.com
- Add the domain remotely:
ssh [email protected] domains:add hobby hobby.theme-preview.intellidigital.com
Step 7: Enabling the SSL Certificate for an App
To enable the SSL certificate for an app, follow these steps:
- Set the email to get the SSL certificate:
ssh [email protected] letsencrypt:set hobby email [email protected]
- Enable the SSL for the app:
ssh [email protected] letsencrypt:enable hobby
- Automatically update the letsencrypt certificate
ssh [email protected] letsencrypt:cron-job --add
Top comments (0)