gthole / drink-stash

A simple web app for saving and searching cocktail recipes.
MIT License
10 stars 1 forks source link
app cocktail-recipes cocktails needs-design-help recipes

Drink Stash

A little web app for saving and searching for cocktail recipes.

Features

Screenshots

Running

Run it behind an HTTP reverse-proxy for TLS-termination etc. You can run it from the base image, storing persistent data in a sqlite database in a mounted volume. With docker-compose:

version: '3.7'

services:
    api:
        image: 'gthole/drink-stash:latest'
        init: true
        restart: 'always'
        environment:
            SECRET_KEY=<yourlongsecretkey>
            ALLOWED_HOSTS=<yourhostname>
        ports:
            - '8000'
        volumes:
            - './data:/data'
            - './public:/public'

The SECRET_KEY should be a long random string of characters, and the ALLOWED_HOSTS is a comma-separated list of hostnames you plan to use to access the app.

Settings

Drink Stash imports settings from environment variables. Values that are arrays (e.g. ALLOWED_HOST) are interpreted to be a comma separated list. A limited set of variables are currently supported.

For example:

EMAIL_HOST=mail.mydomain.com
EMAIL_HOST_USER=no-reply@mydomain.com
EMAIL_HOST_PASSWORD=emailpassword
DEFAULT_FROM_EMAIL=Drink Stash <no-reply@mydomain.com>
SERVER_EMAIL=no-reply@mydomain.com
TIME_ZONE=America/Los_Angeles
ALLOWED_HOSTS=drinks.mydomain.com
DEBUG=False
ADMINS=Me:me@mydomain.com,Someone Else:someone@mydomain.com

Provisioning

When starting up your container, you should set the following environment variables to provision an initial user and some recipes to get started with:

version: '3'

services:
    api:
        image: 'gthole/drink-stash:latest'
        restart: 'always'
        environment:
            SECRET_KEY=<yourlongsecretkey>
            ALLOWED_HOSTS=<yourhostname>
            DJANGO_SUPERUSER_USERNAME=<yourusername>
            DJANGO_SUPERUSER_EMAIL=<youremail>
            DJANGO_SUPERUSER_PASSWORD=changeme
            DJANGO_SUPERUSER_FIRST_NAME=<first>
            DJANGO_SUPERUSER_LAST_NAME=<last>
            INITIAL_FIXTURES=recipes
        ports:
            - '8000'
        volumes:
            - './data:/data'
            - './public:/public'

This will run a provisioning script on startup that creates a superuser if no users exist, and creates initial recipes to search. On subsequent container starts you can remove the DJANGO_SUPERUSER_* and INITIAL_FIXTURES variables.

Development Environment

Install Docker.

# Build the app image
$ docker-compose build api

# Follow the setup instructions in the Provisioning section above

# Start the server
$ docker-compose up

# Run the API unit tests
$ docker-compose run --rm api ./manage.py test drinks