Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
c1739ba
README: quickstart
eins78 Jan 11, 2017
8792e50
git: ignore secret
eins78 Jan 11, 2017
5128677
move guide out of README
eins78 Jan 11, 2017
01d128b
Update GUIDE.md
eins78 Jan 17, 2017
608953f
GUIDE: install, backup, upgrade
eins78 Jan 25, 2017
7b7bf9e
[update] Madek v3.0.0-7.5
eins78 Jan 25, 2017
50eafb8
enhance Guide: installation, config, upgrades
eins78 Jan 27, 2017
8eb597a
remove group vars
eins78 Jan 27, 2017
9cd0607
add Cider-CI example config
eins78 Jan 27, 2017
0fac5d0
add git-crypt usage and examples
eins78 Jan 27, 2017
f85ed7f
[Madek] upgrade to latest development version
eins78 Jan 27, 2017
d152d85
examples: cider-ci: checkout submodules
eins78 Jan 27, 2017
cb096dd
examples: fix typo
eins78 Jan 27, 2017
fd31326
guide: add more documentation links
eins78 Jan 27, 2017
05dbe04
guide/examples: git-crypt, fixes
eins78 Jan 28, 2017
00d0eed
guide: HTTPS w/ letsencrypt
eins78 Jan 30, 2017
4aceb58
[Madek-instance] initial release
eins78 Jan 30, 2017
b2cc634
[Madek] release v3.0.0-8.0
eins78 Jan 30, 2017
0d3b9cb
[Madek] release v3.0.0-9.0
eins78 Feb 20, 2017
0e0be57
[Madek] release: v3.0.0-10.0
eins78 Feb 28, 2017
23dfea3
[Madek] release v3.0.0-10.2
eins78 Mar 16, 2017
c97a408
[Madek] release v3.0.0-11.0
eins78 Mar 30, 2017
634cf93
[Madek-instance] GUIDE: certbot is now run automatically on deploy
eins78 Apr 11, 2017
5fd0f2b
[Madek-instance] symlink Madek's ansible.cfg
eins78 Apr 21, 2017
e075a24
[Madek-instance] GUIDE: new stable branch for upgrades
eins78 May 10, 2017
ea1e6cb
[Madek] release v3.12.0
eins78 May 10, 2017
93c436e
[Madek] release v3.13.0
eins78 Jun 21, 2017
d8f0dfb
[Madek] release v3.13.1
eins78 Jun 21, 2017
b641971
[Madek] release v3.14.0
eins78 Jul 13, 2017
98cffe4
[Madek] release v3.19.0
eins78 Dec 14, 2017
a34e813
[Madek] release v3.20.0
eins78 Feb 16, 2018
2147fc5
[Madek] release v3.23.0
eins78 Jun 22, 2018
f5368d3
[Madek] release v3.24.1
eins78 Nov 27, 2018
c2b59a1
[Madek] release v3.25.0 (#7)
eins78 Apr 1, 2019
dcea087
[Madek] release v3.27.0
eins78 May 21, 2019
1a891f3
[Madek] GUIDE: only recommend generating from template instead of for…
eins78 Feb 1, 2021
93176f4
[Madek] release v3.32.0
eins78 Jul 26, 2021
9980620
[Madek] release v3.33.1
eins78 Jun 24, 2022
bd8fdd6
[Madek] release v3.34.0
nimaai Sep 8, 2022
4ce187b
better update madek script
nimaai Sep 8, 2022
de3f971
[Madek] release: v3.35.1
nimaai Mar 8, 2023
20477ea
[Madek] v4.1.0
nimaai Jun 15, 2023
4cc4461
[Madek] v4.2.0
urs-van-binsbergen Oct 10, 2023
ad004d7
[Madek] v4.2.1
nimaai Jan 24, 2024
228085a
[Madek] v4.4.0
urs-van-binsbergen Mar 19, 2024
47df523
[Madek] v4.4.1
nimaai Mar 22, 2024
bfcb61a
[Madek] v4.4.2
urs-van-binsbergen Mar 26, 2024
95ea304
[Madek] v4.4.3
urs-van-binsbergen Apr 16, 2024
0c06446
[Madek] v4.4.4
urs-van-binsbergen Apr 29, 2024
c571ad0
[Madek] v4.5.0
nimaai Jul 9, 2024
91b9382
[Madek] v4.5.1
nimaai Jul 11, 2024
9f3da21
[Madek] v4.6.0
urs-van-binsbergen Nov 5, 2024
d215520
[Madek] v4.7.0
urs-van-binsbergen Feb 5, 2025
8bbbb70
[Madek] v4.7.1
urs-van-binsbergen Mar 4, 2025
383ace8
[Madek] v4.8.0
urs-van-binsbergen May 5, 2025
a06f66d
[Madek] v4.8.1
urs-van-binsbergen May 8, 2025
b66b377
[Madek] v4.9.0
urs-van-binsbergen Jun 12, 2025
6ea59f0
[Madek] v4.9.1
urs-van-binsbergen Jun 16, 2025
049a5f0
[Madek] v4.9.2
urs-van-binsbergen Jun 24, 2025
9b7c037
[Madek] v4.9.3
urs-van-binsbergen Jun 26, 2025
43fccfe
[Madek] v4.10.0
urs-van-binsbergen Jul 28, 2025
61acadc
[Madek] v4.10.1
urs-van-binsbergen Sep 2, 2025
bfa9da2
[Madek] v4.10.2
urs-van-binsbergen Sep 29, 2025
9295093
[Madek] v4.11.0
urs-van-binsbergen Dec 9, 2025
036363b
[Madek] v4.11.1
urs-van-binsbergen Dec 18, 2025
4215a05
[Madek] v4.12.0
urs-van-binsbergen Feb 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ignore the secret
master_secret.txt
126 changes: 126 additions & 0 deletions GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Madek Hosting Guide

*For more details, see [Madek-Deploy Project](https://github.com/Madek/madek-deploy)
and the [general Madek Documentation](https://madek.readthedocs.io/)*

---

## setup & install

1. [Generate your own inventory repository by using this template](https://github.com/Madek/madek-instance/generate)

1. set up inventory on a computer running Linux or macOS (will be the "control machine")
```sh
which ansible-playbook || echo "install ansible first!"
git clone git@github:yourUserName/madek-instance my-madek
cd my-madek
sh -c 'git submodule update --init Madek && cd Madek && git submodule update --init --recursive deploy'
```

1. prepare a server running [Debian `jessie`](https://www.debian.org/releases/jessie/),
log in as root via SSH and do `apt-get install python`

1. inventory configuration
- prepare inventory files
```
# set hostname
export MADEK_HOSTNAME="madek.example.com"
# create hosts file
sh -c "echo \"$(cat examples/hosts_example)\"" > hosts
# create host_vars
sh -c "echo \"$(cat examples/host_vars_example.yml)\"" > "host_vars/${MADEK_HOSTNAME}.yml"
```
- edit global config in file `group_vars/madek.yml`
- edit per-host config in file `host_vars/madek.example.com.yml`

1. install with ansible
```sh
ansible-playbook -i hosts Madek/deploy/play_setup-and-deploy.yml
```

1. setup initial configuration & admin account (choose a better password and save it):
```sh
ansible-playbook -i hosts Madek/deploy/play_first-time-setup.yml -e "admin_password=supersecret"
```

1. Log in as the admin user and go to the admin interface.
Change the password to a stronger one, customize the name of the instance and other settings.
Add Users and Groups and start using Madek! 🎉

## backup

A `master_secret` was created during the installation and put in a text file
in your repository.
By default it is git-ignored, so it won't be accidentially pushed to a public
host (like GitHub).
You should either back up your local repository with the secret to a secure place;
or use [`git-crypt`](https://www.agwa.name/projects/git-crypt/) to add the
secret to the repository in encrypted form (*recommended*).

## upgrade

1. update `Madek` submodule reference to latest release
- either by accepting a Pull Request (when enabled)
- or manually: `./scripts/update_madek_latest stable`

1. run the setup playbook again: `ansible-playbook -i hosts Madek/deploy/play_setup-and-deploy.yml`

## automatic deployments

***Prerequisite:*** All changed files (configuration etc) must be committed back into the repository,
so that it can be shared with other computers.
That means `git-crypt` must be set up (see below).

*Note* that you can use this fork normally, with one caveat:
**don't edit any files that came with this repository**, or you will have to deal with merge conflicts later on!
The only exception is `README.md`, we won't touch it because you'll likely want to customize it.

1. add GPG of your trusted CI machine to the repo:
```
git crypt add-gpg-user ${CI_GPG_KEY_ID}
```

1. add SSH public key of CI executor to `authorized_keys` of target server

1. set up your CI to `git crypt unlock` und run the deploy script.
See `examples/cider-ci.yml` for a working [Cider-CI](https://cider-ci.info) configuration.

## git-crypt

set up and add master secret:

```sh
which git-crypt || echo 'install `git-crypt` first!'
cp examples/git-crypt/.git{ignore,attributes} .
git commit .gitignore .gitattributes -m 'setup git-crypt'
git crypt init
git crypt add-gpg-user you@example.com
git add master_secret.txt && git commit -m 'add encrypted secret'
git crypt status
```

if needed, set up secret variables:

```sh
# create hosts file
sh -c "echo \"$(cat examples/git-crypt/hosts_example)\"" > hosts
# create host_vars
sh -c "echo \"$(cat examples/git-crypt/group_vars_secret_example.yml)\"" > group_vars/secrets.yml
git add group_vars/secrets.yml && git commit -m 'add encrypted secrets'
git crypt status
```

## HTTPS

Secure Communications for your users (HTTPS) can be enabled
by obtaining a TLS certificate and configure apache to use it.
This can be done easily using `certbot` by [LetsEncrypt](https://letsencrypt.org).


1. Install `certbot`: `sudo apt-get install python-certbot-apache -t jessie-backports`
2. Get cert: `certbot certonly --apache -d madek.example.com`
3. Configure apache: `certbot run -n --apache --redirect --apache-vhost-root /etc/apache2/madek -d madek.example.com`
- even more secure (SSL Labs `A+` instead of `A`): `certbot run -n --apache --redirect --hsts --uir --strict-permissions --apache-vhost-root /etc/apache2/madek -d madek.example.com`

If a certificate set up this way is found on the server, the deploy process will automatically use `certbot` for configuration with recommended settings.
You only have to re-run `certbot` yourself after each deploy if you prefer other settings.
2 changes: 1 addition & 1 deletion Madek
Submodule Madek updated 150 files
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# madek-instance
# Madek hosting template

## config
This is a template to set up a [Madek](https://zhdk.ch/madek) server,
providing a web-based media archive.

- global config in `group_vars/madek.yml`
- per-host config in `host_vars/madek.example.com.yml`
## [Read the Guide](https://github.com/Madek/madek-instance/blob/master/GUIDE.md)
1 change: 1 addition & 0 deletions ansible.cfg
44 changes: 44 additions & 0 deletions examples/cider-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# working example configuration to deploy a madek instance using Cider-CI

jobs:
deploy_madek:
name: Deploy Madek

context:
task_defaults:
max_trials: 1
aggregate_state: satisfy-last
traits:
Ansible 2: yes
git-crypt: yes
ci-executor.madek: yes

environment_variables:
LANG: "en_US.UTF-8"

tasks:
deploy:
exclusive_global_resources:
"madek.example.com": true
environment_variables:
HOSTS_FILE: hosts

scripts:
deploy:
start_when:
submodules are checked out: {script_key: checkout-submodules}
git-crypt is unlocked: {script_key: unlock}
only when we are on the head of master branch: {script_key: check-head-of-master}

timeout: 30 minutes
body: cd Madek/deploy && ansible-playbook -i "../../${HOSTS_FILE}" play_setup-and-deploy.yml

unlock:
body: git crypt unlock && ls -la . && ls -R group_vars

check-head-of-master:
body: git fetch && test $(git log -n 1 --pretty=%H HEAD -- ) == $(git log -n 1 --pretty=%H origin/master -- )

checkout-submodules:
start_when: {after: {script_key: check-head-of-master}}
body: git submodule update --init Madek && cd Madek && git submodule update --init --recursive deploy
1 change: 1 addition & 0 deletions examples/git-crypt/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*secret* filter=git-crypt diff=git-crypt
2 changes: 2 additions & 0 deletions examples/git-crypt/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# DONT ignore the secret - its encrypted with git-crypt!
!master_secret.txt
3 changes: 3 additions & 0 deletions examples/git-crypt/group_vars_example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ansible_ssh_port: 12345
# ansible_ssh_user: my_ssh_user
# zencoder_api_key: "my-key"
5 changes: 5 additions & 0 deletions examples/git-crypt/hosts_example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[secrets]
${MADEK_HOSTNAME}

[madek]
${MADEK_HOSTNAME}
28 changes: 28 additions & 0 deletions examples/host_vars_example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
# connection
ansible_ssh_host: ${MADEK_HOSTNAME}
madek_external_hostname: ${MADEK_HOSTNAME}
ansible_ssh_port: 22
ansible_ssh_user: root

# storage
setup_storage_directories: true
madek_storage_dir: /srv/madekdata
madek_file_storage_dir: /srv/madekdata/attachments
madek_thumbnail_storage_dir: /srv/madekdata/attachments
madek_tmp_dir: /srv/madekdata/tmp

# audio and videos previews
zencoder_enabled: false
# zencoder_api_key: '{{zhdk_zencoder_api_key}}'
# zencoder_test_mode: True

# backups
# db_backups_enabled: False

# customize
# madek_webapp_html_extra_head_start: |
# <!-- powered by Madek -->

# madek_webapp_html_extra_head_end: |
# <link rel="stylesheet" type="text/css" href="/local-theme.css">
2 changes: 2 additions & 0 deletions examples/hosts_example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[madek]
${MADEK_HOSTNAME}
28 changes: 0 additions & 28 deletions group_vars/madek.yml

This file was deleted.

Empty file added host_vars/.gitkeep
Empty file.
11 changes: 0 additions & 11 deletions host_vars/madek.example.com.yml

This file was deleted.

2 changes: 0 additions & 2 deletions hosts

This file was deleted.

23 changes: 23 additions & 0 deletions scripts/update_madek_latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash -exu

RELEASE_NAME=$1
CHANNEL=${2:-stable}

git pull

cd Madek
git fetch
git submodule foreach --recursive 'git reset --hard HEAD'
git reset --hard "origin/${CHANNEL}"
git submodule update --recursive --init --force

cd -
git add Madek

if [[ -n "${RELEASE_NAME}" ]]; then
git commit -m "[Madek] ${RELEASE_NAME}"
else
git commit -m "[Madek] x.y.z" --edit
fi

git push