Merge pull request 'Wiki' (#61) from wiki into main
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: mentorenwahl/mentorenwahl#61
This commit is contained in:
commit
5da1b5992e
10 changed files with 290 additions and 16 deletions
120
.drone.yml
120
.drone.yml
|
@ -7,8 +7,32 @@ steps:
|
||||||
- name: shellcheck
|
- name: shellcheck
|
||||||
image: koalaman/shellcheck-alpine
|
image: koalaman/shellcheck-alpine
|
||||||
commands:
|
commands:
|
||||||
- cd scripts/
|
- cd scripts
|
||||||
- find -name "*.sh" | xargs shellcheck
|
- 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
|
kind: pipeline
|
||||||
|
@ -19,8 +43,8 @@ steps:
|
||||||
- name: ameba
|
- name: ameba
|
||||||
image: veelenga/ameba
|
image: veelenga/ameba
|
||||||
commands:
|
commands:
|
||||||
- cd docker/backend/
|
- cd docker/backend
|
||||||
- ameba micrate/src/ src/
|
- ameba micrate/src src
|
||||||
- name: pgsanity
|
- name: pgsanity
|
||||||
image: boechat107/pgsanity
|
image: boechat107/pgsanity
|
||||||
commands:
|
commands:
|
||||||
|
@ -30,27 +54,39 @@ steps:
|
||||||
volumes:
|
volumes:
|
||||||
- name: lib
|
- name: lib
|
||||||
path: /drone/src/docker/backend/lib
|
path: /drone/src/docker/backend/lib
|
||||||
|
- name: cache
|
||||||
|
path: /cache
|
||||||
commands:
|
commands:
|
||||||
- cd docker/backend/
|
- cd docker/backend
|
||||||
- shards install
|
- shards install
|
||||||
- name: documentation
|
- name: docs
|
||||||
image: crystallang/crystal:1.3-alpine
|
image: crystallang/crystal:1.3-alpine
|
||||||
volumes:
|
volumes:
|
||||||
- name: lib
|
- name: lib
|
||||||
path: /drone/src/docker/backend/lib
|
path: /drone/src/docker/backend/lib
|
||||||
commands:
|
commands:
|
||||||
- cd docker/backend/
|
- cd docker/backend
|
||||||
- make docs
|
- make docs
|
||||||
depends_on:
|
depends_on:
|
||||||
- ameba
|
- ameba
|
||||||
- deps
|
- 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
|
- name: build
|
||||||
image: tmaier/docker-compose
|
image: tmaier/docker-compose
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
path: /var/run/docker.sock
|
path: /var/run/docker.sock
|
||||||
commands:
|
commands:
|
||||||
- cp .example.env .env
|
|
||||||
- docker-compose build --build-arg BUILD_ENV=development backend
|
- docker-compose build --build-arg BUILD_ENV=development backend
|
||||||
depends_on:
|
depends_on:
|
||||||
- ameba
|
- ameba
|
||||||
|
@ -59,6 +95,9 @@ steps:
|
||||||
volumes:
|
volumes:
|
||||||
- name: lib
|
- name: lib
|
||||||
temp: {}
|
temp: {}
|
||||||
|
- name: cache
|
||||||
|
host:
|
||||||
|
path: /tmp/cache
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
host:
|
host:
|
||||||
path: /var/run/docker.sock
|
path: /var/run/docker.sock
|
||||||
|
@ -75,10 +114,75 @@ steps:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
path: /var/run/docker.sock
|
path: /var/run/docker.sock
|
||||||
commands:
|
commands:
|
||||||
- cp .example.env .env
|
|
||||||
- docker-compose build --build-arg BUILD_ENV=development frontend
|
- docker-compose build --build-arg BUILD_ENV=development frontend
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
host:
|
host:
|
||||||
path: /var/run/docker.sock
|
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
|
||||||
|
|
14
.example.env
14
.example.env
|
@ -30,15 +30,15 @@ BACKEND_API_JWT_SECRET=
|
||||||
# Backend - SMTP
|
# Backend - SMTP
|
||||||
BACKEND_SMTP_HELO=
|
BACKEND_SMTP_HELO=
|
||||||
BACKEND_SMTP_HOST=
|
BACKEND_SMTP_HOST=
|
||||||
BACKEND_SMTP_PORT=
|
BACKEND_SMTP_PORT=587
|
||||||
BACKEND_SMTP_NAME=
|
BACKEND_SMTP_NAME=
|
||||||
BACKEND_SMTP_USERNAME=
|
BACKEND_SMTP_USERNAME=
|
||||||
BACKEND_SMTP_PASSWORD=
|
BACKEND_SMTP_PASSWORD=
|
||||||
# Backend - Db
|
# Backend - Db
|
||||||
# Backend - LDAP
|
# Backend - LDAP
|
||||||
BACKEND_LDAP_HOST=
|
BACKEND_LDAP_HOST="ldap.example.com"
|
||||||
BACKEND_LDAP_PORT=
|
BACKEND_LDAP_PORT=389
|
||||||
BACKEND_LDAP_BASE_DN=
|
BACKEND_LDAP_BASE_DN="dc=ldap,dc=example,dc=com"
|
||||||
BACKEND_LDAP_BASE_USER_DN=
|
BACKEND_LDAP_BASE_USER_DN="ou=users,dc=ldap,dc=example,dc=com"
|
||||||
BACKEND_BIND_DN=
|
BACKEND_LDAP_BIND_DN="cn=admin,dc=ldap,dc=example,dc=com"
|
||||||
BACKEND_BIND_PASSWORD=
|
BACKEND_LDAP_BIND_PASSWORD=
|
||||||
|
|
28
Makefile
Normal file
28
Makefile
Normal 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
|
|
@ -1,10 +1,12 @@
|
||||||
# mentorenwahl
|
# 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.
|
A fullstack application for assigning mentors to students based on their whishes.
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
|
|
||||||
To build the documentation, run `make docs` in `docker/backend/`.
|
To build the documentation, run `make docs`.
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
|
|
17
docs/.gitignore
vendored
Normal file
17
docs/.gitignore
vendored
Normal 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
28
docs/book.toml
Normal 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
5
docs/src/SUMMARY.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Summary
|
||||||
|
|
||||||
|
- [Installation](./installation.md)
|
||||||
|
- [Configuration](./configuration.md)
|
||||||
|
- [Development](./development/README.md)
|
32
docs/src/configuration.md
Normal file
32
docs/src/configuration.md
Normal 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`.
|
6
docs/src/development/README.md
Normal file
6
docs/src/development/README.md
Normal 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
52
docs/src/installation.md
Normal 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
|
||||||
|
```
|
Loading…
Reference in a new issue