Web-based recipe book.
The easiest method is via docker.
docker run -p 5000:5000 ghcr.io/chadweimer/gomp
On a fresh deployment, you can log into the application using the default user "[email protected]" with password "password".
The above command will use the default configuration, which includes using an embedded SQLite database and ephemeral storage, which is not recommended in production. In order to have persistent storage, you can use a bind mount or named volume with the volume exposed by the container at "/var/app/gomp/data".
docker run -p 5000:5000 -v /path/on/host:/var/app/gomp/data ghcr.io/chadweimer/gomp
The equivalent compose file, this time using a named volume, would look like the following.
version: '2'
volumes:
data:
services:
web:
image: ghcr.io/chadweimer/gomp
volumes:
- data:/var/app/gomp/data
ports:
- 5000:5000
The easiest way to deploy with a PostgreSQL database is via docker-compose
.
An example compose file can be found at examples/docker-compose.yml and is shown below.
version: '2'
volumes:
data:
db-data:
services:
web:
image: ghcr.io/chadweimer/gomp
depends_on:
- db
environment:
- DATABASE_URL=postgres://dbuser:dbpassword@db/gomp?sslmode=disable
volumes:
- data:/var/app/gomp/data
ports:
- 5000:5000
db:
image: postgres
environment:
- POSTGRES_PASSWORD=dbpassword
- POSTGRES_USER=dbuser
- POSTGRES_DB=gomp
volumes:
- db-data:/var/lib/postgresql/data
You will obviously want to cater the values (e.g., passwords) for your deployment.
A basic manifest is shown below. This manifest is roughly equivalent to the first docker command shown in the Docker section above, and is thus not recommended for production use.
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.service: web
name: web
spec:
selector:
matchLabels:
app.service: web
template:
metadata:
labels:
app.service: web
spec:
containers:
- image: ghcr.io/chadweimer/gomp
name: web
ports:
- containerPort: 5000
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
labels:
app.service: web
name: web
spec:
ports:
- port: 5000
targetPort: 5000
selector:
app.service: web
🚧 TODO
🚧 TODO
The following table summarizes the available configuration settings, which are settable through environment variables.
ENV | Value(s) | Default | Description |
---|---|---|---|
BASE_ASSETS_PATH | string | static | The base path to the client assets. |
DATABASE_DRIVER | postgres, sqlite | <empty> | Which database/sql driver to use. If blank, the app will attempt to infer it based on the value of DATABASE_URL. The value 'sqlite3' can also be used, but is deprecated, and is equivalent to 'sqlite'. |
DATABASE_URL | string | file:data/data.db?_pragma=foreign_keys(1) | The url (or path, connection string, etc) to use with the associated database driver when opening the database connection. |
IS_DEVELOPMENT | 0, 1 | 0 | Defines whether to run the application in "development mode". Development mode turns on additional features, such as logging, that may not be desirable in a production environment. |
MIGRATIONS_FORCE_VERSION | int | -1 | A version to force the migrations to on startup (will not run any of the migrations themselves). Set to a negative number to skip forcing a version. |
MIGRATIONS_TABLE_NAME | string | <empty> | The name of the database migrations table to use. Leave blank to use the default from https://github.com/golang-migrate/migrate. |
PORT | uint | 5000 | The port number under which the site is being hosted. |
SECURE_KEY | []string | ChangeMe | Used for session authentication. Recommended to be 32 or 64 ASCII characters. Multiple keys can be separated by commas. |
UPLOAD_DRIVER | fs, s3 | fs | Used to select which backend data store is used for file uploads. |
UPLOAD_PATH | string | data/uploads | The path (full or relative) under which to store uploads. When using Amazon S3, this should be set to the bucket name. |
IMAGE_QUALITY | original, high, medium, low | original | The quality level for recipe images. JPEG Qualities: High == 92, Medium == 80, Low == 70. Low also uses the Nearest Neighber instead of the Box resizing algorithm. |
IMAGE_SIZE | uint | 2000 | The size of the bounding box to fit recipe images to. Ignored if IMAGE_QUALITY == original. |
THUMBNAIL_QUALITY | high, medium, low | medium | The quality level for the thumbnails of recipe images. JPEG Qualities: High == 92, Medium == 80, Low == 70. Low also uses the Nearest Neighber instead of the Box resizing algorithm. |
THUMBNAIL_SIZE | uint | 500 | The size of the bounding box to fit the thumbnails of recipe images to. |
All environment variables can also be prefixed with "GOMP_" (e.g., GOMP_IS_DEVELOPMENT=1) in cases where there is a need to avoid collisions with other applications. The name with "GOMP_" is prefered if both are present.
For values that allow releative paths (e.g., BASE_ASSETS_PATH, DATABASE_URL for SQLite, and UPLOAD_PATH for the fs driver), they are always relative to the application working directory. When using docker, this is "/var/app/gomp", so anything at or below the "data/" relative path is in the exposed "/var/app/gomp/data" volume.
Currently PostgreSQL and SQLite are supported.
This repository uses make. The simplest way to build the entire project is to issue the following command at the root of the repository:
make
The sections below describe additional operations that are available, though it is not a complete list. Refer the the Makefile for more.
make install
The equivalent for uninstalling is make uninstall
.
make lint
make build
The equivalent for cleaning is make clean
.
make docker
make archive
These archives are deleted (cleaned) by the same clean
target as above.
See static/package.json and go.mod