Skip to content

Dokku plugin to manage discourse on your dokku server

License

Notifications You must be signed in to change notification settings

badsyntax/dokku-discourse

Repository files navigation

dokku-discourse

Test

Manages discourse apps on your dokku server.

Plugin installation

# For dokku >= v0.22.0
dokku plugin:install https://github.com/badsyntax/dokku-discourse.git

# For dokku < v0.22.0
dokku plugin:install https://github.com/badsyntax/dokku-discourse.git --committish 0.2.1

Plugin update

dokku plugin:update discourse

Commands

discourse:help                            # Shows help
discourse:create <app>                    # Creates/rebuilds a discourse app
discourse:destroy <app>                   # Destroys a discourse app
discourse:upgrade <app>                   # Upgrades a discourse app
discourse:install-plugin <app> <git_url>  # Installs a plugin for a discourse app
discourse:list                            # Lists discourse apps

Usage

Create a new discourse app

Each discourse app is a separate standalone discourse instance.

dokku discourse:create discourse-app

A new docker image will be built and this process can take some time.

You'll be prompted for various discourse configuration values.

Data will be stored in location /var/lib/dokku/data/storage/APP_NAME.

Once your app is built & deployed, you can treat it as any other dokku app. You should use the dokku-letsencrypt plugin for adding TLS.

Continue with the offical discourse install instructions to complete the discourse installation, ignoring any TLS setup instructions.

Customise the discourse container config

A discourse container config file is created when a discourse app is created. The config is based on standalone.yml.

You can edit the config at /home/dokku/APP_NAME/discourse_standalone.yml. Don't make any changes to the volumes section, but feel free to change anything else.

After making change be sure to run dokku discourse:create <app> to rebuild and re-deploy the discourse app.

Upgrade a discourse app

The easiest way to upgrade is to use the admin.

You can also upgrade a discourse app with the following:

dokku discourse:upgrade discourse-app

The running discourse app will be stopped, the docker image rebuilt and the app redeployed.

Add discourse plugins

Install the akismet plugin:

dokku discourse:install-plugin discourse-app https://github.com/discourse/discourse-akismet

The running discourse app will be stopped, the docker image rebuilt and the app redeployed.

Destroy an app

dokku discourse:destroy discourse-app

Destroying an app does not remove the data directory at /var/lib/dokku/data/storage/APP_NAME.

Uninstall the plugin

dokku plugin:uninstall discourse

Running discourse apps and images are unaffected.

To completely remove everything related to discourse:

  1. Destroy all discourse apps: dokku discourse:destroy $(dokku discourse:list -q)
  2. Uninstall the discourse plugin: dokku plugin:uninstall discourse
  3. Remove the base discourse image: docker rmi $(docker images -q discourse/base)
  4. Remove discourse data directories at /var/lib/dokku/data/storage/.

Restore from backup

You'll need a backup archive created by discourse, and a fresh discourse app.

Follow the instructions above to create a new discourse app. Ensure you've registered an admin account as you'll need to login to the admin to restore the backup. If the backup site was using TLS, you need to set this up on the new instance before continuing (via dokku letsencrypt).

Discourse allows you restore a backup in the admin, but you need to copy the backup into the discourse container first. This is achieved by copying the backup into the host directory that's mounted to the container.

First, ensure the default backup directory exists on the host:

Substitute APP_NAME with the name of the discourse app you just created.

ssh [email protected]
mkdir /var/lib/dokku/data/storage/APP_NAME/backups/default/

Exit your server and use scp (or similar) to copy the archive file to the server.

Substitute APP_NAME with the name of the discourse app you just created.

scp discourse-backup.tar.gz [email protected]:/var/lib/dokku/data/storage/APP_NAME/backups/default/

Login to the admin and restore from backup.

To complete the restoration, you'll need install plugins that were previously installed. Use the dokku discourse:install-plugin command to do so.

Credits

Development

See DEVELOPMENT.md.

License

See LICENSE.md.