/consumat.io-backend

Backend for alphahorizonio/consumat.io.

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

consumat.io Backend

Backend for github.com/alphahorizonio/consumat.io.

hydrun CI Docker CI Matrix Docker Pulls Binary Downloads

Overview

🚧 This project is a work-in-progress! More instructions will be added as soon as it is usable. 🚧

Installation

Containerized

You can get the Docker container like so:

$ docker pull alphahorizonio/consumatio-backend

Natively

If you prefer a native installation, static binaries are also available on GitHub releases.

You can install them like so:

$ curl -L -o /tmp/consumatio-backend https://github.com/alphahorizonio/consumat.io-backend/releases/latest/download/consumatio-backend.linux-$(uname -m)
$ sudo install /tmp/consumatio-backend /usr/local/bin

About the Frontend

The frontend is also available on alphahorizonio/consumat.io-frontend if you prefer to self-host. For most users, this shouldn't be necessary though; consumat.io is a progressive web app. By simply visiting the public deployment once, it will be available for offline use whenever you need it:

Usage

🚧 This project is a work-in-progress! More instructions will be added as soon as it is usable. 🚧

Contributing

Starting the Backend

To contribute, please use the GitHub flow and follow our Code of Conduct.

To build and start a development version of the consumat.io backend locally, run the following:

# Clone the repo
$ git clone https://github.com/alphahorizonio/consumat.io-backend.git
$ cd consumat.io-backend
# Start the database
$ docker volume create consumatio-postgres
$ docker run --name consumatio-postgres -d -e POSTGRES_USER=consumatio-postgres -e POSTGRES_PASSWORD=consumatio-postgres -e POSTGRES_DB=consumatio-postgres -p 5432:5432 -v consumatio-postgres:/var/lib/postgresql/data postgres postgres -N 512
# Install dependencies
$ make depend
# Run tests
$ TMDB_KEY="mytmdbkey" BACKEND_SECRET="mysecret" make test
# Start the backend
$ TMDB_KEY="mytmdbkey" BACKEND_SECRET="mysecret" make dev

The backend should now be started and the GraphQL playground should be available on http://localhost:5000/. Whenever you change a source file, the backend will automatically be re-compiled and restarted.

To authorize in the playground, set the following HTTP headers:

{
  "X-Consumatio-Namespace": "you@example.com",
  "X-Consumatio-Secret": "mysecret"
}

Creating new Migrations

If you want to create and apply a migration, run the following; migrations are also applied ("upgraded") automatically on startup:

$ MSG="mymigrationdescription" make migrations

You can also connect using psql:

$ PGPASSWORD=consumatio-postgres psql -h localhost -p 5432 -d consumatio-postgres -U consumatio-postgres

To reset the database, run:

$ docker rm -f consumatio-postgres
$ docker volume rm consumatio-postgres

Getting Help

Have any questions or need help? Chat with us on Matrix!

License

consumat.io Backend (c) 2021 Jakob Waibel and contributors

SPDX-License-Identifier: AGPL-3.0