Merge pull request 'Wiki' (#61) from wiki into main
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: mentorenwahl/mentorenwahl#61
This commit is contained in:
Dominic Grimm 2022-02-23 17:23:48 +00:00
commit 5da1b5992e
10 changed files with 290 additions and 16 deletions

View file

@ -7,8 +7,32 @@ steps:
- name: shellcheck
image: koalaman/shellcheck-alpine
commands:
- cd scripts/
- cd scripts
- find -name "*.sh" | xargs shellcheck
- name: docs
image: michaelfbryan/mdbook-docker-image
volumes:
- name: cache
path: /cache
commands:
- cd docs
- mdbook build
- name: rebuild-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
rebuild: true
mount:
- ./docs/book
depends_on:
- docs
volumes:
- name: cache
host:
path: /tmp/cache
---
kind: pipeline
@ -19,8 +43,8 @@ steps:
- name: ameba
image: veelenga/ameba
commands:
- cd docker/backend/
- ameba micrate/src/ src/
- cd docker/backend
- ameba micrate/src src
- name: pgsanity
image: boechat107/pgsanity
commands:
@ -30,27 +54,39 @@ steps:
volumes:
- name: lib
path: /drone/src/docker/backend/lib
- name: cache
path: /cache
commands:
- cd docker/backend/
- cd docker/backend
- shards install
- name: documentation
- name: docs
image: crystallang/crystal:1.3-alpine
volumes:
- name: lib
path: /drone/src/docker/backend/lib
commands:
- cd docker/backend/
- cd docker/backend
- make docs
depends_on:
- ameba
- deps
- name: rebuild-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
rebuild: true
mount:
- ./docker/backend/docs
depends_on:
- docs
- name: build
image: tmaier/docker-compose
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- cp .example.env .env
- docker-compose build --build-arg BUILD_ENV=development backend
depends_on:
- ameba
@ -59,6 +95,9 @@ steps:
volumes:
- name: lib
temp: {}
- name: cache
host:
path: /tmp/cache
- name: dockersock
host:
path: /var/run/docker.sock
@ -75,10 +114,75 @@ steps:
- name: dockersock
path: /var/run/docker.sock
commands:
- cp .example.env .env
- docker-compose build --build-arg BUILD_ENV=development frontend
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
---
kind: pipeline
type: docker
name: deploy-docs
steps:
- name: restore-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
restore: true
mount:
- ./docs/book
- ./docker/backend/docs
- name: prepare-pages
image: bitnami/git
volumes:
- name: cache
path: /cache
- name: pages
path: /tmp/pages
commands:
- git clone --depth 1 --branch pages https://git.dergrimm.net/mentorenwahl/mentorenwahl.git /tmp/pages
- rm -rf /tmp/pages/*
- cp -r ./docs/book/* /tmp/pages
- mkdir -p /tmp/pages/_api/backend
- cp -r ./docker/backend/docs/* /tmp/pages/_api/backend
depends_on:
- restore-cache
- name: deploy-pages
image: appleboy/drone-git-push
volumes:
- name: pages
path: /tmp/pages
settings:
remote:
from_secret: deploy_remote
force: false
commit: true
commit_message: "[CI] Deploy pages"
branch: pages
local_ref: pages
path: /tmp/pages
depends_on:
- prepare-pages
volumes:
- name: cache
host:
path: /tmp/cache
- name: pages
temp: {}
depends_on:
- default
- backend
- frontend
trigger:
branch:
- main
event:
- push

View file

@ -30,15 +30,15 @@ BACKEND_API_JWT_SECRET=
# Backend - SMTP
BACKEND_SMTP_HELO=
BACKEND_SMTP_HOST=
BACKEND_SMTP_PORT=
BACKEND_SMTP_PORT=587
BACKEND_SMTP_NAME=
BACKEND_SMTP_USERNAME=
BACKEND_SMTP_PASSWORD=
# Backend - Db
# Backend - LDAP
BACKEND_LDAP_HOST=
BACKEND_LDAP_PORT=
BACKEND_LDAP_BASE_DN=
BACKEND_LDAP_BASE_USER_DN=
BACKEND_BIND_DN=
BACKEND_BIND_PASSWORD=
BACKEND_LDAP_HOST="ldap.example.com"
BACKEND_LDAP_PORT=389
BACKEND_LDAP_BASE_DN="dc=ldap,dc=example,dc=com"
BACKEND_LDAP_BASE_USER_DN="ou=users,dc=ldap,dc=example,dc=com"
BACKEND_LDAP_BIND_DN="cn=admin,dc=ldap,dc=example,dc=com"
BACKEND_LDAP_BIND_PASSWORD=

28
Makefile Normal file
View file

@ -0,0 +1,28 @@
# Mentorenwahl: A fullstack application for assigning mentors to students based on their whishes.
# Copyright (C) 2022 Dominic Grimm
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
.PHONY: all dev prod docs
all: docs prod
dev:
docker-compose build --build-arg BUILD_ENV=development
prod:
docker-compose build
docs:
cd docs && mdbook build

View file

@ -1,10 +1,12 @@
# mentorenwahl
[![Build Status](https://drone.dergrimm.net/api/badges/mentorenwahl/mentorenwahl/status.svg)](https://drone.dergrimm.net/mentorenwahl/mentorenwahl)
A fullstack application for assigning mentors to students based on their whishes.
# Documentation
To build the documentation, run `make docs` in `docker/backend/`.
To build the documentation, run `make docs`.
# License

17
docs/.gitignore vendored Normal file
View file

@ -0,0 +1,17 @@
# Mentorenwahl: A fullstack application for assigning mentors to students based on their whishes.
# Copyright (C) 2022 Dominic Grimm
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
book

28
docs/book.toml Normal file
View file

@ -0,0 +1,28 @@
# Mentorenwahl: A fullstack application for assigning mentors to students based on their whishes.
# Copyright (C) 2022 Dominic Grimm
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
[book]
authors = ["Dominic Grimm"]
language = "en"
multilingual = false
src = "src"
title = "Mentorenwahl"
[output.html]
git-repository-url = "https://git.dergrimm.net/mentorenwahl/mentorenwahl"
git-repository-icon = "fa-code-fork"
no-section-label = true
# site-url = "https://pages.git.dergrimm.net/mentorenwahl/mentorenwahl"

5
docs/src/SUMMARY.md Normal file
View file

@ -0,0 +1,5 @@
# Summary
- [Installation](./installation.md)
- [Configuration](./configuration.md)
- [Development](./development/README.md)

32
docs/src/configuration.md Normal file
View file

@ -0,0 +1,32 @@
# Configuration
## Environment variables
To change the environment variables edit the `.env` file.
| Name | Type | Description |
| -------------------------------- | -------- | ------------------------------------------------------------------------------------ |
| `URL` | `String` | The webroot of the application to base of links and routing |
| `POSTGRES_USER` | `String` | Database user name |
| `POSTGRES_PASSWORD` | `String` | Database password |
| `BACKEND_URL` | `String` | Backend webroot (= `URL`) |
| `BACKEND_API_GRAPHQL_PLAYGROUND` | `Bool` | Enables GraphQL playground (automatically enabled when compiled in development mode) |
| `BACKEND_API_JWT_SECRET` | `String` | Password to encrypt all authentication tokens with |
| `BACKEND_SMTP_HELO` | `String` | SMTP server HELO |
| `BACKEND_SMTP_HOST` | `String` | SMTP server hostname |
| `BACKEND_SMTP_PORT` | `Int32` | SMTP server port (= `587`) |
| `BACKEND_SMTP_NAME` | `String` | Name to send emails with |
| `BACKEND_SMTP_USERNAME` | `String` | SMTP account username |
| `BACKEND_SMTP_PASSWORD` | `String` | SMTP account password |
| `BACKEND_LDAP_HOST` | `String` | LDAP server hostname |
| `BACKEND_LDAP_PORT` | `Int32` | LDAP server port (= `389`) |
| `BACKEND_LDAP_BASE_DN` | `String` | LDAP virtual DN |
| `BACKEND_LDAP_BASE_USER_DN` | `String` | LDAP user group DN |
| `BACKEND_LDAP_BIND_DN` | `String` | LDAP admin account DN |
| `BACKEND_LDAP_BIND_PASSWORD` | `String` | LDAP admin account password |
## Compile time
### Backend
Setting the `development` flag with `-Ddevelopment` flag on compiling the backend will result in being able to debug the API endpoints at `/graphql?development=true`. Also automatically enables the GraphQL playground at `/graphql`.

View file

@ -0,0 +1,6 @@
# Development
For development, you will need:
- [Crystal](https://crystal-lang.org/)
- [NodeJs](https://nodejs.org/)

52
docs/src/installation.md Normal file
View file

@ -0,0 +1,52 @@
# Installation
## Prerequisites
To install the docker-compose app,
you will need to have the following dependencies installed:
- [Git](https://git-scm.com/)
- [GNU Make](https://www.gnu.org/software/make/)
- [MdBook](https://github.com/rust-lang/mdBook)
- [Docker](https://www.docker.com/products/overview)
- [Docker Compose](https://docs.docker.com/compose/install/)
## Clone the repository
For building the containers from scratch, the repository's packages are required.
```bash
git clone https://git.dergrimm.net/mentorenwahl/mentorenwahl.git
cd mentorenwahl/
```
After that you will need to create an environment configuration file.
```bash
cp .example.env .env
```
## Build the containers
Building the project is as simple as invoking the `make` command
according to following options:
```bash
# Production build
make prod
# Development build
make dev
```
## Run the containers
Running the containers is done with `docker-compose`:
```bash
# TTY attached
docker-compose up
# TTY detached
docker-compose up -d
```