Skip to content

Commit

Permalink
Added digitalocean setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Gosden committed May 3, 2020
1 parent d72d6e3 commit a1a6513
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ Each template configuration is held in a separate sub-directory.

- [**Development setup**](https://github.com/ttamg/deploy-docassemble/tree/master/development-setup) - this spins up a simple development server version of **docassemble** in the same way as outlined in the documentation, but using **docker-compose**.

- [**Simple production setup**](https://github.com/ttamg/deploy-docassemble/tree/master/simple-production-setup) - this creates a single server deployment setup, using LetsEncrypt for SSL, and stores the backup data in volumes on the server itself.
- [**Simple production setup**](https://github.com/ttamg/deploy-docassemble/tree/master/simple-production-setup) - this creates a single server deployment setup, using LetsEncrypt for SSL. By default it stores the backup and configuration data in a persistent volume on the server itself. It also contains instructions on how to easily attach to S3 or Azure Blob storage.

- [**DigitalOcean setup**](https://github.com/ttamg/deploy-docassemble/tree/master/digitalocean-setup) - this creates a single server deployment setup on DigitalOcean using LetsEncrypt for SSL. It also uses a DigitalOcean Spaces 'bucket' for S3 storage to persist the backup and configuration.

## Contributing

Expand Down
22 changes: 22 additions & 0 deletions digitalocean-setup/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CONTAINERROLE=all
DBPREFIX=postgresql+psycopg2://
DBNAME=docassemble
DBUSER=docassemble
DBPASSWORD=abc123 # Update this
DBHOST=null
USEHTTPS=true
DAHOSTNAME=domain.example.com # Update this
USELETSENCRYPT=true
LETSENCRYPTEMAIL=[email protected] # Update this
S3ENABLE=false # Set to true if using DigitalOcean Spaces
S3ACCESSKEY= # Set to Spaces access token if using Spaces
S3SECRETACCESSKEY= # Set to Spaces access secret if using Spaces
S3ENDPOINTURL= # Set to the Spaces URL
S3BUCKET= # Set to Spaces name if using Spaces
S3REGION= # Leave blank
EC2=false
TIMEZONE=America/New_York
DAPYTHONVERSION=3
COLLECTSTATISTICS=true
SERVERADMIN=
POSTURLROOT=/
37 changes: 37 additions & 0 deletions digitalocean-setup/DigitalOcean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## Deploying docassemble to DigitalOcean

[DigitalOcean](https://www.digitalocean.com/) is a popular web hosting alternative to AWS and Azure. It is a cost-effective solution for hosting docassemble apps.

For deployment, DigitalOcean [virtual machines with docker pre-installed](https://marketplace.digitalocean.com/apps/docker) can be spun up quickly and docassemble installed there.

[DigitalOcean Spaces](https://www.digitalocean.com/products/spaces/) are available to store the backups and configuration files. These are S3 compatible and therefore the setup is very similar to the AWS S3 instructions.

This setup uses both a new Droplet and Spaces.

### Deploy a DigitalOcean Droplet (VM) with docker installed

From your DigitalOcean account dashboard, click to set up a new Droplet (this is the DigitalOcean name for a 'virtual machine').

In the options, go to the Marketplace tab and search for the [docker image](https://marketplace.digitalocean.com/apps/docker). This will spin up a new virtual machine with docker already installed.

A USD 10 per month droplet will usually be sufficient to get started on docassemble.

### Set up a new DigitalOcean Space (S3 compatible)

From the DigitalOcean account dashboard, create a new 'Space' and an access token. DigitalOcean provides a [step-by-step guide](https://www.digitalocean.com/community/tutorials/how-to-create-a-digitalocean-space-and-api-key) for these steps.

Note the URL for this new Space, and the access token as you will need for configuration later.

### Configure docassemble

When deploying docassemble on this new droplet, point the S3 configuration to the DigitalOcean Space you set up.

The URL from your new DigitalOcean Space (e.g. https://spacename.fra1.digitaloceanspaces.com) maps to the `S3` configuration options as follows:

- `S3ENDPOINTURL=https://fra1.digitaloceanspaces.com`
- `S3REGION=` (leave this blank)
- `S3BUCKET=spacename`

Set the `S3ACCESSKEY` and `S3SECRETACCESSKEY` parameters to the access token values, and set `S3ENABLED=true`.

Your S3 configuration should now be complete.
46 changes: 46 additions & 0 deletions digitalocean-setup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# DigitalOcean single server setup

[DigitalOcean](https://www.digitalocean.com/) is a popular web hosting alternative to AWS and Azure. It is a cost-effective solution for hosting docassemble apps.

For deployment, DigitalOcean [virtual machines (called 'Droplets') with docker pre-installed](https://marketplace.digitalocean.com/apps/docker) can be spun up quickly and docassemble installed there.

[DigitalOcean Spaces](https://www.digitalocean.com/products/spaces/) are available to store the backups and configuration files. These are S3 compatible and therefore the setup is very similar to the AWS S3 instructions.

This setup uses both a new Droplet and Spaces.

The app is secured using LetsEncrypt SSL certificates.

## Getting started

1. This assumes you have already set up:

- a new DigitalOcean Droplet with docker running - can be done with [one click](https://marketplace.digitalocean.com/apps/docker). A USD 10 per month droplet will usually be sufficient to get started with docassemble.

- a new DigitalOcean Space (i.e. 'S3 bucket') to store the data and an access token - [step-by-step instructions](https://www.digitalocean.com/community/tutorials/how-to-create-a-digitalocean-space-and-api-key)

1. Log into your Droplet and copy across the `.env` and `docker-compose.yml` file into a new project directory.

1. Edit the `.env` file to add the settings for for your setup. As a minimum, make sure you set

- `DAHOSTNAME` to the **domain name**
- `LETSENCRYPTEMAIL` to your valid email for LetsEncrypt to use.

1. Edit the `.env` file to add the configuration for the S3 compatible DigitalOcean Space:

- `S3ENABLE=true`
- `S3ENDPOINTURL=https://fra1.digitaloceanspaces.com` - or similar for other regions than `fra1`
- `S3BUCKET=spaces_name` - putting in the name of your Space
- `S3ACCESSKEY=yourkey` - from the access token
- `S3SECRETACCESSKEY=yoursecret` - from the access token

1. Before starting up **docassemble** ensure you have a DNS record for the **domain name** pointing correctly to the **IP address** of the server. Without this, LetsEncrypt may fail to create a valid certificate for you.

1. Run using:

docker-compose up -d

## Notes

- In `docker-compose.yml` the **restart** option is set to `always` so that it will attempt to restart if the container goes down.

- For other settings, see the [official documentation on configuration options](https://docassemble.org/docs/docker.html#configuration%20options).
18 changes: 18 additions & 0 deletions digitalocean-setup/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "3"
services:
docassemble:
image: jhpyle/docassemble:latest
container_name: docassemble-prod
env_file:
- .env
restart: always
stop_grace_period: 6m
ports:
- "80:80"
- "443:443"
volumes:
- dabackup:/usr/share/docassemble/backup

volumes:
dabackup:
driver: local

0 comments on commit a1a6513

Please sign in to comment.