Skip to content

Commit

Permalink
Merge branch 'master' of github.com:svsticky/sadserver
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasDeBruijn committed Dec 25, 2024
2 parents 3ea76d6 + 3cd4f8e commit e9aacfc
Show file tree
Hide file tree
Showing 36 changed files with 157 additions and 1,173 deletions.
4 changes: 2 additions & 2 deletions ansible/group_vars/all/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ users:
home_prefix: "/var/www"
state: "present"
github_accounts:
- username: "Siem2l"
state: "absent"
- username: "SilasPeters"
state: "present"
- username: "olafboekholt"
state: "present"

- name: "hacc"
admin: false
Expand Down
8 changes: 7 additions & 1 deletion ansible/group_vars/all/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ canonical_hostname: "{{ inventory_hostname }}"

tmp_dir: "/tmp"

# the upload limit for php-fpm and nginx in megabytes
# the upload limit for nginx in megabytes
upload_limit: 30

slack_notifications:
Expand All @@ -29,3 +29,9 @@ secret_deploy_key: "{{ vault_secret_deploy_key }}"
# The API key for our Mailgun account.
# Change? Refresh API key at https://app.mailgun.com/app/account/security
secret_mailgun_token: "{{ vault_secret_mailgun_token }}"

# The place where https://github.com/nvm-sh/nvm will be installed, to be globally used
nvm:
directory: "/usr/local/bin/.nvm"
script: "/usr/local/bin/.nvm/nvm.sh"
version: "v0.40.0" # Derived from the git tag
103 changes: 0 additions & 103 deletions ansible/group_vars/all/websites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,6 @@ websites:
state: "present"
authenticated: true

- name: "phpmyadmin.{{ canonical_hostname }}"
user: "phpmyadmin"
alternative_names:
- "pma.{{ canonical_hostname }}"
# You have to remove the task include of phpmyadmin.yml to remove this
# completely
state: "absent"

- name: "pretix.{{ canonical_hostname }}"
custom_config: true
alternative_names:
Expand Down Expand Up @@ -183,91 +175,6 @@ websites:
authenticated: true
state: "present"

- name: "execut-speakers.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
extra_includes:
- "execut-referer-tracking"
state: "present"

- name: "execut-partners.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
extra_includes:
- "execut-referer-tracking"
state: "absent"

- name: "execut-survey.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
extra_includes:
- "execut-referer-tracking"
state: "present"

- name: "execut-landing.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
extra_includes:
- "execut-referer-tracking"
state: "present"

- name: "execut-2018.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
extra_includes:
- "execut-referer-tracking"
state: "present"

- name: "execut-2019.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
extra_includes:
- "execut-referer-tracking"
state: "present"

- name: "execut-2020.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
extra_includes:
- "execut-referer-tracking"
state: "present"

- name: "execut-2023.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
extra_includes:
- "execut-referer-tracking"
custom_config: true
state: "present"

- name: "execut-aftermovie.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
extra_includes:
- "execut-referer-tracking"
state: "present"

- name: "execut-app.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
extra_includes:
- "execut-referer-tracking"
state: "absent"

- name: "execut-2021.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
extra_includes: []
custom_config: true
state: "present"

- name: "execut.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
extra_includes: []
custom_config: true
state: "present"

- name: "snic-preview.{{ canonical_hostname }}"
user: "snic"
alternative_names: []
Expand All @@ -286,16 +193,6 @@ websites:
alternative_names: []
state: "present"

- name: "execut-feedback.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
state: "present"

- name: "execut-qa.{{ canonical_hostname }}"
user: "symposium"
alternative_names: []
state: "present"

- name: "files.{{ canonical_hostname }}"
user: "bestuur"
custom_config: true
Expand Down
9 changes: 0 additions & 9 deletions ansible/group_vars/production/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ secret_backup_aws:
access_key: "{{ vault_secret_backup_aws.access_key }}"
secret_key: "{{ vault_secret_backup_aws.secret_key }}"

secret_execut_website_aws:
access_key: "{{ vault_secret_execut_website_aws.access_key }}"
secret_key: "{{ vault_secret_execut_website_aws.secret_key }}"

secret_execut_website_secretkey:
"{{ vault_secret_execut_website_secretkey }}"

# To change, regenerate the token in Mollie's web interface.
secret_mollie_token: "{{ vault_secret_mollie_token }}"

Expand Down Expand Up @@ -145,8 +138,6 @@ secret_outline:
secret_koala_manual:
password: "{{ vault_secret_koala_manual.password }}"

freight_ssh_pub_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFOXjzub9wBK7/eOu4sceuGu3JoAJAoulNtqlt+A4XvT [email protected]"

secret_healthchecks_io:
ping_key: "{{ vault_secret_healthchecks_io.ping_key }}"

Expand Down
12 changes: 2 additions & 10 deletions ansible/group_vars/staging/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ secret_backup_aws:
access_key: "{{ vault_secret_backup_aws.access_key }}"
secret_key: "{{ vault_secret_backup_aws.secret_key }}"

secret_execut_website_aws:
access_key: "{{ vault_secret_execut_website_aws.access_key }}"
secret_key: "{{ vault_secret_execut_website_aws.secret_key }}"

secret_execut_website_secretkey: "{{ vault_secret_execut_website_secretkey }}"

# To change, regenerate the token in Mollie's web interface.
secret_mollie_token: "{{ vault_secret_mollie_token }}"

Expand Down Expand Up @@ -136,8 +130,6 @@ secret_outline:
secret_koala_manual:
password: "{{ vault_secret_koala_manual.password }}"

freight_ssh_pub_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHQiL2YN1yBeUAwWZENc8lPK3Kj1kIG/57IbAuxL9yTk [email protected]"

secret_healthchecks_io:
ping_key: "{{ vault_secret_healthchecks_io.ping_key }}"

Expand All @@ -158,7 +150,7 @@ secret_chroma:

fallacious_rooster:
git_tag: "0.1.4"

digidecs:
git_tag: "0.1.0"
server_port: 65437
server_port: 65437
19 changes: 11 additions & 8 deletions ansible/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@
tags: "docker"
- role: "databases"
tags: "databases"
- role: "nvm"
tags: "nvm"
- role: "backups"
tags: "backups"
- role: "nginx"
tags: "nginx"
- role: "php"
tags: "php"
- role: "node"
tags: "node"
- role: "certbot"
tags: "certbot"
- role: "redis"
Expand All @@ -44,8 +42,6 @@
tags: "websites"
- role: "digidecs"
tags: "digidecs"
- role: "freight"
tags: "freight"
- role: "aas"
tags: "aas"
- role: "static_sticky"
Expand All @@ -62,8 +58,6 @@
tags: "oauth"
- role: "outline"
tags: "outline"
- role: "execut"
tags: "execut"
- role: "radio"
tags: "radio"
- role: "sodi"
Expand All @@ -87,3 +81,12 @@
tags: "always"
- role: "rooster"
tags: "rooster"

# Following is a list of removed roles, which we did have.
# If, for some reason, we ever want to use on of the removed services again,
# one can easily restore the role by reverting the following PRs:
#
# - execut: #475
# - freight: #477
# - php: #474
# - node: #467
2 changes: 2 additions & 0 deletions ansible/roles/backups/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
shell: "/usr/sbin/nologin"
home: "/home/backup"
system: true
groups: "nvm"
append: true

- name: "install awscli"
ansible.builtin.apt:
Expand Down
16 changes: 9 additions & 7 deletions ansible/roles/backups/templates/backup-to-s3.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,11 @@ case "${SOURCE}" in
S3PATH="${SOURCE}"
FILE_NAME="${FILE_TITLE}.tar.gz"

# phpMyAdmin and SODI directories excluded because no other
# SODI directories excluded because no other
# committee can write to these folders and they are deployed from \
# git anyway.
# Pretix's virtualenv is excluded as it only contains binaries.
upload_backup_to_s3 < <(tar \
--exclude='var/www/phpmyadmin.{{ canonical_hostname }}' \
--exclude='var/www/sodi.{{ canonical_hostname }}' \
--exclude='var/www/pretix/venv' \
-c -f - -C / var/www \
Expand All @@ -105,11 +104,14 @@ case "${SOURCE}" in
FILE_NAME="${FILE_TITLE}.tar.gz"

sudo -u backup mkdir -p /tmp/contentful-export
sudo -u backup -H npx contentful-cli space export \
--management-token {{ secret_contentful_export.token }} \
--space-id {{ secret_contentful_export.space_id }} \
--download-assets \
--export-dir /tmp/contentful-export
sudo -Hu backup bash -c `
`'source {{ nvm.script }} && nvm install {{ backups_node_version }} &&'`
`' nvm exec {{ backups_node_version }} npx contentful-cli space export'`
`' --management-token {{ secret_contentful_export.token }}'`
`' --space-id {{ secret_contentful_export.space_id }}'`
`' --download-assets'`
`' --export-dir /tmp/contentful-export'

upload_backup_to_s3 < <(tar \
-c -f - -C /tmp contentful-export \
| gzip -9)
Expand Down
3 changes: 3 additions & 0 deletions ansible/roles/backups/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

backups_node_version: "22"
23 changes: 0 additions & 23 deletions ansible/roles/docker/tasks/docker-apt-repo.yml

This file was deleted.

10 changes: 9 additions & 1 deletion ansible/roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
block:

- name: "Add Docker apt repository"
ansible.builtin.include_tasks: "docker-apt-repo.yml"
ansible.builtin.deb822_repository: # See https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
name: "docker"
types: "deb"
uris: "https://download.docker.com/linux/{{ ansible_distribution | lower }}"
suites: "{{ ansible_distribution_release }}"
components: "stable"
architectures: "amd64"
signed_by: "https://download.docker.com/linux/ubuntu/gpg"

- name: "Install Docker packages"
ansible.builtin.package:
Expand All @@ -16,6 +23,7 @@
- "containerd.io"
- "docker-buildx-plugin"
state: "present"
update_cache: true

- name: "Ensure Docker is started and enabled at boot"
ansible.builtin.service:
Expand Down
Loading

0 comments on commit e9aacfc

Please sign in to comment.