Skip to content

Filmstund/filmstund

Repository files navigation

Filmstund

A web application for making it easier planning to go to the cinema with your friends

CI Deploy beta

React frontend

cd web
yarn
yarn build
yarn test

Requirements

  • yarn
  • Node 16

Go backend

The backend is written in Go and is currently also serving up the frontend using a file server.

Linting and sanity checks

These checks need to pass in order to be able to merge a pull request:

make checks

Build

You can use the provided Makefile to build the project.

make build

Running

export OIDC_CLIENT_ID=jyXDFia9V5Hjy43pweTHo3A1onBRJEHk
export OIDC_CLIENT_SECRET=<ask-a-dev>
export OIDC_AUDIENCE=https://filmstund-dev
export OIDC_ISSUER=https://dev-filmstund.eu.auth0.com/
export LOGGER_VERBOSITY=10
make run

Requirements

The following sections details how to setup the requirements to run the backend server.

  • go >1.17
  • postgres
  • redis

Database

To run the app you will need to have access to a Postgres instance.

Docker

An easy solution is to run Postgres using docker:

docker run --name postgres -e POSTGRES_PASSWORD=filmstund -e POSTGRES_USER=filmstund -e POSTGRES_DB=filmstund -d -p 5432:5432 postgres:14

Podman

Alternatively, you can use podman instead of docker:

sudo podman run -d --rm -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=filmstund -e POSTGRES_USER=filmstund -e POSTGRES_DB=filmstund postgres:14

Migrations

Our database migrations are written in migrate-go format. To run the migrations, do the following:

go run ./cmd/migrate --path configs/database/migrations

Note that the username, password etc are configured using environment, and the same rules as the normal backend applies.

Add new migration

To add a new migration, do the following:

# Skip the first step if you already have migrate installed and in your $PATH
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
migrate create -ext sql -seq -dir configs/database/migrations <migration_name_goes_here>

Redis

Redis is used as a cache for ephemeral data that expire after some duration.

You can configure Redis using environment variables:

export REDIS_HOST=127.0.0.1
export REDIS_PORT=6379

note that the above values are the defaults

If your redis instance is setup to use a "master" password, you can configure that using the REDIS_PASSWORD env var.

Installation (macOS)

On macOS, you can use Brew:

brew install redis
brew services start redis
# Optionally configure:
vim /usr/local/etc/redis.conf

Or docker/podman:

docker run -d --name redis -p 6379:6379 redis
podman run -d --rm --name redis -p 6379:6379 redis