How to use the Dokku VPS template Drucken

  • Dokku
  • 0

How to use the Dokku VPS template


Dokku is an open-source Platform as a Service (PaaS) that simplifies application deployment using Docker containers. Installing the Dokku template on your VPS allows you to easily manage and deploy applications.
If you dont have a VPS yet, check the available options here:Dokku VPS hosting?
Heres a step-by-step guide to get you started, with a sample Getting Started Ruby App:

Step 1: Connect to Your VPS


Use SSH to access your VPS. Open your terminal and run:
<code>ssh root@your_vps_ip</code>

Replaceyour_vps_ipwith yourVPSs IP address. Enter your VPS password when prompted.

Step 2: Verify Dokku Installation


After logging in, ensure Dokku is installed by checking its version:?
<code>dokku version</code>

If Dokku is installed correctly, this command will display the installed version.

Step 3: Finish configuring Dokku for VPS


you can use any domain you already have access to, this domain should have an A record or CNAMEpointing at your servers IP:
<code>dokku domains:set-global example.vps</code>

or you can also use the IP of your server:
<code>dokku domains:set-global 222.222.22.22</code>

On yourlocal machine(not VPS) run:
<code>cat ~/.ssh/your_key.pub | ssh root@your_vps_ip dokku ssh-keys:add name</code>

replaceyour_key.pubwith your local SSH public key,your_vps_ipwith your VPS IP andnamewith a preferred name. Enter your VPS password when prompted.

Step 4: Create a Dokku Application


Download Ruby Getting Started application on yourlocal machine:
<code>git clone https://github.com/heroku/ruby-getting-started</code>

Return to yourVPS terminaland run this command:
<code>dokku apps:create ruby-getting-started</code>

This initializes an app on Dokku with the specified name (replaceruby-getting-startedwith your desired app name)
Dokku by defaultdoes notprovide datastores (e.g. MySQL, PostgreSQL) on a newly created app.
The Getting Started app requires a PostgreSQL service, so install the plugin and create the related service as follows:
<code>sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git</code>

After that, run the following:
<code>dokku postgres:create railsdatabase</code>

Replacerailsdatabasewith a preferred name.
Then link your app with a database:
<code>dokku postgres:link railsdatabase ruby-getting-started</code>

On yourlocal machinerun:
<code>cd ruby-getting-startedgit remote add dokku dokku@your_vps_ip:your_application_namegit push dokku main</code>

Replaceyour_vps_ipwith a your VPS IP address andyour_application_namewith your created application name.
Note: the remote usernamemustbe dokku or pushes will fail
After runninggit push dokku main, it should start building the app and give you a domain or IP address to enter your app.

Step 5: Access Your Application


Once Dokku completes the build and deployment, your app should be accessible at:
http://your_server_ip:portif you dont have a domain set up.

http://your_app_name.yourdomain.comif youve configured a domain for Dokku.

You can also check the terminal and search for the Application deployed:http://your_server_ip:port
That it! Your Getting Started application is ready to be accessed!
For comprehensive documentation and advanced configurations, visit theDokku Documentation.





















War diese Antwort hilfreich?

« Zurück