├── .gitignore ├── development-setup ├── docker-compose.yml ├── .env └── README.md ├── digitalocean-setup ├── docker-compose.yml ├── .env └── README.md ├── simple-production-setup ├── docker-compose.yml ├── .env └── README.md ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | */volumes/* 2 | -------------------------------------------------------------------------------- /development-setup/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | docassemble: 4 | image: jhpyle/docassemble 5 | container_name: docassemble-dev 6 | env_file: 7 | - .env 8 | restart: unless-stopped 9 | stop_grace_period: 6m 10 | ports: 11 | - "80:80" 12 | volumes: 13 | - ./volumes/backup:/usr/share/docassemble/backup 14 | -------------------------------------------------------------------------------- /development-setup/.env: -------------------------------------------------------------------------------- 1 | CONTAINERROLE=all 2 | DBPREFIX=postgresql+psycopg2:// 3 | DBNAME=docassemble 4 | DBUSER=docassemble 5 | DBPASSWORD=abc123 6 | DBHOST=null 7 | USEHTTPS=false 8 | DAHOSTNAME=localhost 9 | USELETSENCRYPT=false 10 | LETSENCRYPTEMAIL= 11 | S3ENABLE=false 12 | S3ACCESSKEY= 13 | S3SECRETACCESSKEY= 14 | S3BUCKET= 15 | S3REGION= 16 | EC2=false 17 | TIMEZONE=America/New_York 18 | DAPYTHONVERSION=3 19 | -------------------------------------------------------------------------------- /digitalocean-setup/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | docassemble: 4 | image: jhpyle/docassemble:latest 5 | container_name: docassemble-prod 6 | env_file: 7 | - .env 8 | restart: always 9 | stop_grace_period: 6m 10 | ports: 11 | - "80:80" 12 | - "443:443" 13 | volumes: 14 | - dabackup:/usr/share/docassemble/backup 15 | 16 | volumes: 17 | dabackup: 18 | driver: local 19 | -------------------------------------------------------------------------------- /simple-production-setup/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | docassemble: 4 | image: jhpyle/docassemble:latest 5 | container_name: docassemble-prod 6 | env_file: 7 | - .env 8 | restart: always 9 | stop_grace_period: 6m 10 | ports: 11 | - "80:80" 12 | - "443:443" 13 | volumes: 14 | - dabackup:/usr/share/docassemble/backup 15 | 16 | volumes: 17 | dabackup: 18 | driver: local 19 | -------------------------------------------------------------------------------- /simple-production-setup/.env: -------------------------------------------------------------------------------- 1 | CONTAINERROLE=all 2 | DBPREFIX=postgresql+psycopg2:// 3 | DBNAME=docassemble 4 | DBUSER=docassemble 5 | DBPASSWORD=abc123 # Update this 6 | DBHOST=null 7 | USEHTTPS=true 8 | DAHOSTNAME=domain.example.com # Update this 9 | USELETSENCRYPT=true 10 | LETSENCRYPTEMAIL=myemail@example.com # Update this 11 | S3ENABLE=false 12 | S3ACCESSKEY= 13 | S3SECRETACCESSKEY= 14 | S3BUCKET= 15 | S3REGION= 16 | EC2=false 17 | TIMEZONE=America/New_York 18 | DAPYTHONVERSION=3 19 | COLLECTSTATISTICS=true 20 | SERVERADMIN= 21 | POSTURLROOT=/ 22 | -------------------------------------------------------------------------------- /digitalocean-setup/.env: -------------------------------------------------------------------------------- 1 | CONTAINERROLE=all 2 | DBPREFIX=postgresql+psycopg2:// 3 | DBNAME=docassemble 4 | DBUSER=docassemble 5 | DBPASSWORD=abc123 # Update this 6 | DBHOST=null 7 | USEHTTPS=true 8 | DAHOSTNAME=domain.example.com # Update this 9 | USELETSENCRYPT=true 10 | LETSENCRYPTEMAIL=myemail@example.com # Update this 11 | S3ENABLE=false # Set to true if using DigitalOcean Spaces 12 | S3ACCESSKEY= # Set to Spaces access token if using Spaces 13 | S3SECRETACCESSKEY= # Set to Spaces access secret if using Spaces 14 | S3ENDPOINTURL= # Set to the Spaces URL 15 | S3BUCKET= # Set to Spaces name if using Spaces 16 | S3REGION= # Leave blank 17 | EC2=false 18 | TIMEZONE=America/New_York 19 | DAPYTHONVERSION=3 20 | COLLECTSTATISTICS=true 21 | SERVERADMIN= 22 | POSTURLROOT=/ 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 ttamg 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /development-setup/README.md: -------------------------------------------------------------------------------- 1 | # Development setup 2 | 3 | A simple **docassemble** set up on your local development machine for trial and development processes. 4 | 5 | The app runs on http://localhost or http://127.0.0.1 on port 80. 6 | 7 | This setup creates a backup volume that will be placed in the local `volumes` subdirectory. Backup data will persist between sessions. 8 | 9 | This setup is _not suitable for deployment_ as it does not use SSL. 10 | 11 | ## Getting started 12 | 13 | 1. Copy across the `.env` and `docker-compose.yml` file into a new project directory. 14 | 15 | 2. Run using: 16 | 17 | docker-compose up 18 | 19 | Add the `-d` option to this command if you want **docassamble** to run in the background. 20 | 21 | 3. After around 10 mins of initial setup time, the app will be available on http://localhost or http://127.0.0.1 port 80. 22 | 23 | 4. Bring the container down using: 24 | 25 | docker-compose down 26 | 27 | ## Notes 28 | 29 | - This setup achieves the same outcome as the simple `docker run` instructions provided in the [official documentation](https://docassemble.org/docs/docker.html#starting), but does so using `docker-compose` instead. 30 | 31 | - The `.env` file in this setup contains many more container options than are needed for development. They are included here so that developers can play around with these features locally before deploying remotely. 32 | -------------------------------------------------------------------------------- /simple-production-setup/README.md: -------------------------------------------------------------------------------- 1 | # Simple production setup on single server 2 | 3 | This provides a simple setup for deployment on a single server, probably a cloud virtual machine. 4 | 5 | By default, this setup will store the backups and configuation files in a persistent storage volume on the local server. 6 | 7 | See the additional steps below if you also want to connect the backups and configuration to your AWS S3 storage. 8 | 9 | The app is secured using LetsEncrypt SSL certificates. 10 | 11 | ## Getting started 12 | 13 | 1. Copy across the `.env` and `docker-compose.yml` file into a new project directory. 14 | 15 | 1. Edit the `.env` file to add the settings for for your setup. As a minimum, make sure you set 16 | 17 | - `DAHOSTNAME` to the **domain name** 18 | - `LETSENCRYPTEMAIL` to your valid email for LetsEncrypt to use. 19 | 20 | 1. If using AWS S3 or DigitalOcean Spaces storage (_skip this step if not_) edit the `.env` file to add your S3 or Spaces configuration 21 | 22 | - Set `S3ENABLE=true` 23 | - Set the other `S3...` configuration options 24 | - For more information, check out the [**docassemble** S3 documentation](https://docassemble.org/docs/docker.html#persistent%20s3). 25 | 26 | 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. 27 | 28 | 1. Run using: 29 | 30 | docker-compose up -d 31 | 32 | ## Notes 33 | 34 | - In `docker-compose.yml` the **restart** option is set to `always` so that it will attempt to restart if the container goes down. 35 | 36 | - For other settings, see the [official documentation on configuration options](https://docassemble.org/docs/docker.html#configuration%20options). 37 | -------------------------------------------------------------------------------- /digitalocean-setup/README.md: -------------------------------------------------------------------------------- 1 | # DigitalOcean single server setup 2 | 3 | [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. 4 | 5 | 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. 6 | 7 | [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. 8 | 9 | This setup uses both a new Droplet and Spaces. 10 | 11 | The app is secured using LetsEncrypt SSL certificates. 12 | 13 | ## Getting started 14 | 15 | 1. This assumes you have already set up: 16 | 17 | - 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. 18 | 19 | - 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) 20 | 21 | 1. Log into your Droplet and copy across the `.env` and `docker-compose.yml` file into a new project directory. 22 | 23 | 1. Edit the `.env` file to add the settings for for your setup. As a minimum, make sure you set 24 | 25 | - `DAHOSTNAME` to the **domain name** 26 | - `LETSENCRYPTEMAIL` to your valid email for LetsEncrypt to use. 27 | 28 | 1. Edit the `.env` file to add the configuration for the S3 compatible DigitalOcean Space: 29 | 30 | - `S3ENABLE=true` 31 | - `S3ENDPOINTURL=https://fra1.digitaloceanspaces.com` - or similar for other regions than `fra1` 32 | - `S3BUCKET=spaces_name` - putting in the name of your Space 33 | - `S3ACCESSKEY=yourkey` - from the access token 34 | - `S3SECRETACCESSKEY=yoursecret` - from the access token 35 | 36 | 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. 37 | 38 | 1. Run using: 39 | 40 | docker-compose up -d 41 | 42 | ## Notes 43 | 44 | - In `docker-compose.yml` the **restart** option is set to `always` so that it will attempt to restart if the container goes down. 45 | 46 | - For other settings, see the [official documentation on configuration options](https://docassemble.org/docs/docker.html#configuration%20options). 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # deploy-docassemble 2 | 3 | A set of **docker-compose** template setups for deploying docassemble. Each template configuration is held in a separate directory. Choose the one most relevant for your use case. 4 | 5 | ## Why use docker-compose? 6 | 7 | The base documentation for **docassemble** outlines how to [deploy using a docker container](https://docassemble.org/docs/docker.html). These instructions include using `docker run` on the container to deploy the application. This is great for testing and fine for deployment too. 8 | 9 | However, we prefer to use **docker-compose** for production deployments. There are a couple of advantages to this approach: 10 | 11 | - The **docassemble** run settings are contained in the `docker-compose.yml` file and the `.env` file. These can be easily maintained and managed using a git repo. 12 | 13 | * For more complex setups, other containers can be orchestrated alongside the **docassemble** container using **docker-compose** For example, adding an additional **nginx** proxy to enable multiple web apps to run concurrently on the same machine. 14 | 15 | If you like the simple `docker run` then stick with it. 16 | 17 | But if you prefer **docker-compose** then this repo may be a helpful timesaver. 18 | 19 | ## Getting started 20 | 21 | 1. Select the template setup that best suits your use case. Each folder is a separate setup. See the **README.md** file in each folder for more information. 22 | 23 | 1. Tweak the `.env` and the `docker-compose.yml` files to your requirements. 24 | 25 | 1. Spin up **docassemble** in the background using: 26 | 27 | docker-compose up -d 28 | 29 | 1. Note that **docassemble** deployment is very slow for the first deployment. It can take up to 10 minutes before the app is up and running. Be patient and make a cup of tea. 30 | 31 | 1. If you need to debug your deployment, try running `docker-compose up` without the `-d` option in order to see the console output. Or alternatively, [hop onto the container](https://docassemble.org/docs/docker.html#troubleshooting) as per the **docassemble** documentation and look at the logs. 32 | 33 | 1. To bring down the containers cleanly and stop your app, use: 34 | 35 | docker-compose down 36 | 37 | ## Configuration templates 38 | 39 | Each template configuration is held in a separate sub-directory. 40 | 41 | - [**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**. 42 | 43 | - [**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. 44 | 45 | - [**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. 46 | 47 | ## Contributing 48 | 49 | Pull requests are welcomed for **improvements to configurations, documentation or bug fixes**. 50 | 51 | If this repo is useful, we are also happy to receive **other useful template configurations**. Please follow the same structure for each setup if possible to keep things neat and easy to understand. 52 | 53 | ## Links 54 | 55 | Check out the official documentation for this fantastic package: 56 | 57 | - **docassemble** GitHub repo: https://github.com/jhpyle/docassemble 58 | - **docassemble** full documentation: https://docassemble.org/ 59 | 60 | ## Questions 61 | 62 | For questions on **docassemble** please direct those to the main **docassemble** community. In particular there is a great [Slack community](https://join.slack.com/t/docassemble/shared_invite/enQtMjQ0Njc1NDk0NjU2LTUyOGIxMDcxYzg1NGZhNDY5NDI2ZTVkMDhlOGJlNTgzZTUwYzNhYTJiMTJmMDYzYjQ0YWNmNjFiOTE5NmQzMjc) providing support and answering questions. 63 | --------------------------------------------------------------------------------