43
loading...
This website collects cookies to deliver better user experience
# for latest tag check Dokku git repo
# or https://dokku.com website
wget https://raw.githubusercontent.com/dokku/dokku/v0.24.10/bootstrap.sh
sudo DOKKU_TAG=v0.24.10 bash bootstrap.sh
npm init adonis-ts-app@latest hello-world
# If using yarn
yarn create adonis-ts-app hello-world
cd hello-world
# initiate git
git init
# stage all files
git add .
# create first commit
git commit -m 'Init commit'
# add Dokku server as a remote
git remote add dokku dokku@<YOUR_SERVER_IP_ADDRESS_OR_DOMAIN>:hello-world
hello-world
in git remote address corresponds to a server app name that we should create on the server:# on the Dokku host
dokku apps:create hello-world
-----> Creating hello-world...
# on your computer
# inside project folder
node ace generate:key
> iGyX0deixdW7DkdJ9G9PbyyT8QaizXuK
# on the Dokku host
dokku config:set hello-world \
HOST=0.0.0.0 \
APP_KEY=iGyX0deixdW7DkdJ9G9PbyyT8QaizXuK \
APP_NAME='Hello World' \
CACHE_VIEWS=true \
SESSION_DRIVER=cookie
Procfile
and describe how our PaaS should start our app, this file is a very common configurational file, read more about it here. Don't forget to commit it to the repo.web: node build/server.js
git push dokku master
http://<YOUR_SERVER_IP_ADDRESS>:<PORT>
, if you chose hostname based deployments, it will look like this: http://<APP_NAME>.<YOUR_SERVER_DOMAIN>
. You can add a domain to the app later if needed.# on the Dokku host
# install the postgres plugin
# plugin installation requires root, hence the user change
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
# create a postgres service
dokku postgres:create hello-world-database
# on the Dokku host
# each official datastore offers a `link` method to link a service to any application
dokku postgres:link hello-world-database hello-world
DATABASE_URL
that is a database connection string with all the credentials we need.npm install @adonisjs/lucid@latest
# or
yarn add @adonisjs/lucid
# and then
node ace configure @adonisjs/lucid
DATABASE_URL
that was provided before or split it to separated values, connection string url follows a well known format, so it is not a problem to identify credentials and host address.Procfile
by adding new values:web: node build/server.js
release: node build/ace migration:run --force
git push dokku master
# on Dokku host
sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
dokku letsencrypt hello-world
and then dokku letsencrypt:cron-job --add
to add a crontab job that will renew certificates when needed.