Skip to content

Production Installation

Robert Clark edited this page Feb 18, 2020 · 11 revisions

Dokku

These steps are for production deployments using Dokku.

Prerequisites

  • If you have not already installed Dokku, follow the steps to install Dokku.
  • Ensure you have the Dokku Postgres plugin installed
  • Ensure you either have the LetsEncrypt plugin installed or manual management of your SSL certificates. The app will not work without some sort of SSL certificate generated.

Installation

  • Create a new application on your dokku server: dokku apps:create ctf-scoreboard
  • Create a new postgres database on your dokku server: dokku postgres:create scoreboard-db
  • Link the database to the application on your dokku server: dokku postgres:link scoreboard-db ctf-scoreboard
  • (Optional) Setup the proxy for your application: dokku --app ctf-scoreboard config:set HTTP_PROXY=http://<proxy-server>, dokku --app ctf-scoreboard config:set HTTPS_PROXY=http://<proxy-server>
  • Add your dokku server as a git remote on your local machine for the application
    • Clone the scoreboard locally using the clone button on the main page.
    • Add the remote by running git remote add ctf-dokku dokku@<address>:ctf-scoreboard
  • Push the code to dokku in order to trigger a build, from within your local git copy: git push ctf-dokku master.
    • Note: If you would like to deploy a branch other than master to dokku you can run git push ctf-dokku otherbranch:master.
  • The application is setup to automatically run migrations during a code push, however this causes problems during the initial deploy. In order to get a clean initial deployment, run the following commands on your Dokku
    • Set the rails environment dokku --app ctf-scoreboard run rails db:environment:set RAILS_ENV=production
    • Drop and recreate the database by running dokku --app ctf-scoreboard run rake db:drop db:create db:schema:load DISABLE_DATABASE_ENVIRONMENT_CHECK=1
  • Add a domain to access your application by running `dokku --app ctf-scoreboard domains:add .
  • Setup your certificates by either using LetsEncrypt or dokku certs:generate ctf-scoreboard <yourdomain>.
  • Your app should now be accessible in the browser. Browse to in order to complete setup of your game and challenges.
Clone this wiki locally