# Open Productive Stack
## Overview
This repository contains a productive stack of open-source applications for team collaboration and communication. The stack includes:

### Core Infrastructure
- **Traefik**: Edge router that handles routing and load balancing for all services
- **PostgreSQL**: Relational database for applications requiring PostgreSQL
- **MariaDB**: MySQL-compatible database for applications requiring MySQL
- **Adminer**: Database management tool for easy database administration

### Mail
- **Mailcow**: Complete mail server solution with SMTP, IMAP, antivirus, and webmail

### Collaboration Tools
- **Nextcloud**: Self-hosted file sync and share platform with collaboration features
- **OnlyOffice**: Online office suite for document editing and collaboration
- **OpenProject**: Project management and team collaboration software
- **HedgeDoc**: Collaborative markdown notes editor for team documentation

### Web Publishing
- **Drupal**: Flexible content management system (CMS) for building websites

All components are containerized using Docker for easy deployment, scaling, and management, creating a complete productivity environment for teams.

## Requirements
You need [docker](https://docs.docker.com/get-started/get-docker/) and with [docker compose plugin](https://docs.docker.com/compose/). You may want to follow the [post installation instructions](https://docs.docker.com/engine/install/linux-postinstall/).

At least 6 cores with 16GB RAM 100GB SSD would be sufficent.

## Install
### Prerequisites
1) Copy the env and docker-compose.override.yml to the service directories via the script.
```
./copy_overrides.bash
```
2) Set your env variables in `./core/.env`, `./drupal/.env`, `./gitlab/.env`, `./hedgedoc/.env`,  `./onlyoffice/.env`, `./nextcloud/.env`, `./openproject/.env`.

3) Generate mailcow config
```bash
cd mailcow
./geneare_config.bash
```
4) Copy config to .env
```bash
cp mailcow.conf .env
```
5) Create infrastructure via script:
```
./create_infra.bash
```

### Core environment
1) Start traefik, mariadb, postgres and adminer with:
```bash
docker compose -f core/docker-compose.yml up -d
```

### Drupal
1) Set your env variables in
2) Start Drupal containers.
```bash
docker compose -f drupal/docker-compose.yml up -d
```

#### Additional steps
You may want to use Redis Caching.
1) add to drupal/sites/default/settings.php:
```php
// Redis Configuration
$settings['redis.connection']['interface'] = 'PhpRedis';
$settings['redis.connection']['host'] = 'redis';
$settings['redis.connection']['port'] = 6379;
$settings['cache']['default'] = 'cache.backend.redis';
$settings['cache']['bins']['bootstrap'] = 'cache.backend.chainedfast';
$settings['cache']['bins']['discovery'] = 'cache.backend.chainedfast';
$settings['cache']['bins']['config'] = 'cache.backend.chainedfast';
```

4) Visit your Domain and install Drupal site.

### Gitlab
1) Start gitlab.
```bash
docker compose -f gitlab/docker-compose.yml up -d
```
2) Get your root password.
```bash
sudo docker exec -it gitlab grep 'Password:'
/etc/gitlab/initial_root_password
```

4) Visit you domain and log in.

### Hedgedoc
1) Start containers.
```bash
docker compose -f hedgedoc/docker-compose.yml up -d
```
2) Add your user.
```bash
source hedgedoc/.env
docker exec hedgedoc bin/manage_users --pass ${HEDGEDOC_USER_PASSWORD} --add ${HEDGEDOC_USER_EMAIL}
```


### Mailcow
1) Start containers.
```bash
docker compose docker-compose.yml up -d
```

4) Visit DOMAIN/admin and log in with admin:admin.

5) Consider the post installation steps, i. e.

[watchdog](https://docs.mailcow.email/de/post_installation/firststeps-authorize_watchdog_and_bounces/)
[dmarc](https://docs.mailcow.email/de/post_installation/firststeps-dmarc_reporting/)
[dkim](https://docs.mailcow.email/getstarted/prerequisite-dns/) (You get your dkim key when you registered your email domain in mailcow ui)

### OnylOffice
1) Start containers.
```bash
docker compose -f onlyoffice/docker-compose.yml up -d
```

### Nextcloud
1) Start OnlyOffice first!
2) Start containers.
```bash
docker compose -f nextcloud/docker-compose.yml up -d
```
3) Visit nextcloud domain and login with your .env credentials.

### Openproject
1) Start containers.
```bash
docker compose -f hedgedoc/docker-compose.yml up -d
```
2) Visit openproject domain and login with admin:admin and set new password.

## Roadmap
- Tweak the core components and subservices for petter performance.
- More automatisation when installing the environment.
- Add more services
  - [ ] Matrix/Synapse + Element
- Better reuse of gits for updating and maintainment.

## Changelog
0.0.2
- Make things more agnostic by
  + use original gits
  + have envs and overrides in parent dirs
- better automatisation with copy_overrides-bash and create_infra.bash on root level.
0.0.1
- First release.
