From 3cc1dfcd140a40bd157024738dd524bb809fcbc1 Mon Sep 17 00:00:00 2001 From: Darryl Nixon Date: Tue, 23 May 2023 12:07:25 -0700 Subject: [PATCH] We'll deploy with docker because it's easier for students to try, review, and give feedback. Also, maybe it'll make actual development easier. --- .env | 19 +++++++++++++++++++ .gitignore | 2 +- Dockerfile | 14 ++++++++++++++ README.md | 23 ++++++++++++----------- docker-compose.yml | 21 +++++++++++++++++++++ ghostforge/__init__.py | 0 requirements.txt | 0 7 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 .env create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 ghostforge/__init__.py create mode 100644 requirements.txt diff --git a/.env b/.env new file mode 100644 index 0000000..df014f6 --- /dev/null +++ b/.env @@ -0,0 +1,19 @@ +# DATABASE_* variables are used both to initially configure the +# ghostforge postgresql database and to later access the data from +# ghostforge execution. +DATABASE_USER=ghost +DATABASE_PASSWORD= +DATABASE_NAME=ghostforge + +# GHOSTFORGE_*_WEB_PORT variables are used to determine what +# port the web interface is served on within the container (INTERNAL) +# and what port this will map to on the host (HOST). +# +# If you're using a dockerized reverse proxy, you may want to remove +# the port mapping entirely within docker-compose.yml. +GHOSTFORGE_HOST_WEB_PORT=1337 +GHOSTFORGE_INTERNAL_WEB_PORT=1337 + +# GHOSTFORGE_ENV is used to determine debug verbosity +# Valid values are [prod, dev] +GHOSTFORGE_ENV=prod \ No newline at end of file diff --git a/.gitignore b/.gitignore index 68bc17f..8f54560 100644 --- a/.gitignore +++ b/.gitignore @@ -120,7 +120,7 @@ celerybeat.pid *.sage.py # Environments -.env +# .env .venv env/ venv/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1b163cd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.11-alpine + +WORKDIR /ghostforge +COPY . . +RUN rm .env + +RUN pip install --no-cache-dir --requirement requirements.txt +RUN pip install . + +ENV GHOSTFORGE_INTERNAL_WEB_PORT=8080 +ENV PYTHONPATH=/ghostforge/ghostforge + +EXPOSE ${GHOSTFORGE_INTERNAL_WEB_PORT} +CMD [ "ghostforge_serve" ] \ No newline at end of file diff --git a/README.md b/README.md index e6d631d..3bc08cf 100644 --- a/README.md +++ b/README.md @@ -7,27 +7,28 @@ ghostforge manages **false identity information** for privacy prudent users. tl;dr it's a fancy DB frontend with sensible design, tailored features, and a nice UX.
-[Usage](#usage) • [Installation](#installation) • +[Usage](#usage) • [Contributing](#contributing) • [License](#license) -## Usage -To use the tool, run the following command: +## Deployment +Installation instructions are only provided for `docker`-based deployment. For manual deployment, you'll need to set environment variables (see `.env`) for database access before running `ghostforge` yourself. -## Installation - -To use this tool, you need Python 3 installed. Install it with something like: +### With docker +You'll need `docker-compose` installed or you can convert the contents of `docker-compose.yml` into `docker run` commands yourself. Install and run `ghostforge` with something like: +```bash +git clone https://github.com/darrylnixon/ghostforge.git; +cd ghostforge; +docker-compose up --detach --build; +docker exec --interactive --tty ghostforge ghostforge_adduser; ``` -git clone https://github.com/darrylnixon/cf_deny.git -cd binhop -pip install -r requirements.txt -pip install . -``` + +Follow the prompts to create an administrator user. Assuming you didn't change the default port, browse to [http://localhost:1337/](http://localhost:1337/) to begin using `ghostforge` with your new credentials. ## Contributing diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e5dc6b0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +version: '3.8' +services: + ghostforge-db: + image: postgres:15.3 + container_name: ghostforge-db + restart: unless-stopped + volumes: + - ghostforge-db-data:/var/lib/postgresql/data + ghostforge: + build: + context: . + dockerfile: Dockerfile + args: [GHOSTFORGE_ENV=prod] + ports: ["${GHOSTFORGE_HOST_WEB_PORT}:${GHOSTFORGE_WEB_PORT}"] + image: ghostforge:latest + container_name: ghostforge + restart: unless-stopped + depends_on: [ghostforge-db] +volumes: + ghostforge-db-data: + name: ghostforge-db-data \ No newline at end of file diff --git a/ghostforge/__init__.py b/ghostforge/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29