Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7eb52ca
.gitignore: ignore IntelliJ config directory
ForNeVeR Aug 13, 2023
645f663
ctor: enable Kubernetes for codingteam.org.ru
ForNeVeR Aug 13, 2023
bde958e
ctor: add deployment skeleton
ForNeVeR Dec 20, 2023
fc166af
Deployment: add a rudimentary test
ForNeVeR Dec 20, 2023
19db3ae
Deployment: add a Fabricator dependency (temporarily as a submodule)
ForNeVeR Dec 20, 2023
373effd
Deployment: preliminary GreenCaptchaBot schema
ForNeVeR Dec 20, 2023
aea03c5
Deployment: improve the docker specifications
ForNeVeR Dec 22, 2023
9968ebb
Deployment: initial templated version
ForNeVeR Dec 23, 2023
2229be6
Merge branches 'kubernetes' and 'deployment'
ForNeVeR Jun 9, 2025
8616af5
Merge branch 'master' into ansible
ForNeVeR Jun 9, 2025
652bede
(#39) xmpp2: start the host specification
ForNeVeR Jun 9, 2025
f8fb4f9
(#39) xmpp2: set up the users via Ansible
ForNeVeR Jun 10, 2025
bc5e86c
(#39) CI: enable Ansible lint
ForNeVeR Jun 10, 2025
ef65966
Deployment: update the file encodings
ForNeVeR Jun 10, 2025
0d449b1
Legal: specify the licenses everywhere
ForNeVeR Jun 10, 2025
183d19d
(#39) Tune the Ansible lint
ForNeVeR Jun 10, 2025
e3a9542
(#39) xmpp2: improve the auth instruction, start implementing nginx
ForNeVeR Jun 10, 2025
d633859
(#39) Legal: specify the license for a new file
ForNeVeR Jun 10, 2025
e365f05
(#39) nginx: fix lint issues
ForNeVeR Jun 10, 2025
2df3996
(#39) xmpp2: let the default shell be Bash
ForNeVeR Jun 12, 2025
240cd10
(#39) xmpp2: set up Nginx
ForNeVeR Jun 12, 2025
946cd03
(#39) xmpp2: set up codingteam.org.ru
ForNeVeR Jun 12, 2025
b5743a1
(#39) xmpp2: install Docker
ForNeVeR Jun 12, 2025
f52b106
(#39) codingteam.org.ru: drop the old log location proxy
ForNeVeR Jun 12, 2025
30dc23d
(#39) codingteam.org.ru: enable the old log location
ForNeVeR Jun 12, 2025
93c90e3
(#39) Legal: set up license for a new file
ForNeVeR Jun 12, 2025
c964456
(#39) codingteam.org.ru: missing become
ForNeVeR Jun 12, 2025
4195bb5
(#39) xmpp2: docker group should enable the admin user
ForNeVeR Jun 12, 2025
f0587be
(#39) xmpp2: enable ansible-lint to see the package
ForNeVeR Jun 12, 2025
37f0970
(#39) xmpp2: ansible-lint warning cleanup
ForNeVeR Jun 12, 2025
a4a6aa1
(#39) codingteam.org.ru: disable SSL for the time of setup
ForNeVeR Jun 12, 2025
80e0464
(#39) codingteam.org.ru: deal with the ports on Docker
ForNeVeR Jun 12, 2025
25fe710
(#39) codingteam.org.ru: drop the Kubernetes setup
ForNeVeR Jun 12, 2025
82ac9c4
(#39) xmpp2: set up loglist app and database
ForNeVeR Jun 14, 2025
94cd686
(#39) loglist: add nginx configuration
ForNeVeR Jun 14, 2025
3500593
(#39) loglist: apply the configuration
ForNeVeR Jun 14, 2025
5c713b2
(#39) xmpp2: standard operating procedures
ForNeVeR Jun 14, 2025
4837c0b
(#39) xmpp2: preliminary certbot setup
ForNeVeR Jun 14, 2025
cfbe485
Legal: specify the license for the DB initialization script
ForNeVeR Jun 14, 2025
42784e7
(#39) Docs: improve the maintenance instructions
ForNeVeR Jun 14, 2025
06d5aab
(#39) ansible-lint: add community.general
ForNeVeR Jun 14, 2025
9e4c848
(#39) xmpp2: better update for apt
ForNeVeR Jun 14, 2025
558f6a5
(#39) xmpp2: minor SSL-related changes
ForNeVeR Jun 14, 2025
ea08d41
(#39) xmpp2: tune permissions
ForNeVeR Jun 14, 2025
1f34753
(#39) ctor: get rid of Fabricator-based deployment
ForNeVeR Jun 14, 2025
3a6089f
(#39) ansible-lint: clean up
ForNeVeR Jun 14, 2025
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
10 changes: 10 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ on:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-24.04
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Run ansible-lint
uses: ansible/ansible-lint@v25
with:
args: "-c ansible-lint.yml"

encoding:
runs-on: ubuntu-24.04
steps:
Expand Down
8 changes: 8 additions & 0 deletions Folder.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=certonly/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=codingteam/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=lineinfile/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=loglist/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=pgdata/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=postgre/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=sshuser/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Host specification
- [codingteam.org.ru][hosts/ctor]
- [cthulhu-3][hosts/cthulhu-3]
- [omnissiah][hosts/omnissiah]
- [xmpp2][hosts.xmpp2]

Documentation
-------------
Expand All @@ -40,6 +41,7 @@ The license indication in the project's sources is compliant with the [REUSE spe
[codingteam.org.ru]: https://codingteam.org.ru
[devops]: https://ru.wikipedia.org/wiki/DevOps
[docs.license]: LICENSES/MIT.txt
[host.xmpp2]: xmpp2/README.md
[hosts/cthulhu-3]: cthulhu-3/Host.md
[hosts/ctor]: ctor/Host.md
[hosts/omnissiah]: omnissiah/Host.md
Expand Down
10 changes: 10 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version = 1
SPDX-PackageName = "devops"
SPDX-PackageSupplier = "codingteam/devops contributors <https://github.com/codingteam/devops>"
SPDX-PackageDownloadLocation = "https://github.com/codingteam/devops"

[[annotations]]
path = "**.DotSettings"
precedence = "aggregate"
SPDX-FileCopyrightText = "2025 Friedrich von Never <[email protected]>"
SPDX-License-Identifier = "MIT"
7 changes: 7 additions & 0 deletions ansible-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
#
# SPDX-License-Identifier: MIT

exclude_paths:
- .github/ # no Ansible plays in there
- xmpp2/default.yml # just a list of other files
12 changes: 12 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
#
# SPDX-License-Identifier: MIT

---
collections:
- name: ansible.posix
version: 1.5.4
- name: community.docker
version: 3.7.0
- name: community.general
version: 8.3.0
8 changes: 8 additions & 0 deletions xmpp2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
#
# SPDX-License-Identifier: MIT

hosts.ini

vars/secrets.yml
vars/vars.yml
39 changes: 39 additions & 0 deletions xmpp2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>

SPDX-License-Identifier: MIT
-->

xmpp2 host
==========
- **Provider:** Digital Ocean
- **OS**: Ubuntu 24.04

How to Deploy
-------------
1. Copy `hosts.example.ini` to `hosts.ini`, fix the host connection details if needed.
2. Copy `vars/vars.example.yml` to `vars/vars.yml` and adjust it accordingly.
3. Copy `vars/secrets.example.yml` to `vars/secrets.yml` and adjust it accordingly.
4. `ansible-vault encrypt vars/secrets.yml`
5. To **check the results** without applying, run `ansible-playbook --ask-vault-pass --ask-become-pass --check --diff default.yml`.

To **deploy**, run `ansible-playbook --ask-vault-pass --ask-become-pass default.yml`.

If on Windows, feel free to use scripts `ansible-vault.ps1`, `ansible-playbook.ps1` as a substitute to use Ansible from WSL.

If running deployment for the first time, then run `ansible-playbook --ask-vault-pass auth.yml` to set up the user accounts and access properly.

Standard Operating Procedures
-----------------------------

### Dump Database Backup for LogList
```console
$ docker exec -i loglist.postgresql pg_dump -d loglist -U postgres -F custom --no-acl > loglist.dmp
```

### Restore Database Backup for LogList
```console
$ docker cp loglist.dmp loglist.postgresql:/loglist.dmp
$ docker exec -i loglist.postgresql pg_restore -d loglist -U loglist --clean --no-owner -1 /loglist.dmp
$ docker exec -i loglist.postgresql rm /loglist.dmp
```
5 changes: 5 additions & 0 deletions xmpp2/ansible-playbook.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
#
# SPDX-License-Identifier: MIT

wsl --distribution Ubuntu ansible-playbook --inventory hosts.ini @args -e 'ansible_ssh_pipelining=True'
5 changes: 5 additions & 0 deletions xmpp2/ansible-vault.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
#
# SPDX-License-Identifier: MIT

wsl --distribution Ubuntu ansible-vault @args
45 changes: 45 additions & 0 deletions xmpp2/auth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
#
# SPDX-License-Identifier: MIT

---
- name: Set up the users and authentication
hosts: xmpp2
become: true

vars_files:
- secrets.yml
- vars.yml

handlers:
- name: Reload sshd
ansible.builtin.service:
name: ssh
state: reloaded

tasks:
- name: Ensure a group exists for those who can connect with SSH
ansible.builtin.group:
name: sshuser

- name: Ensure a user exists and can SSH into the machine
ansible.builtin.user:
name: '{{ user.name }}'
shell: /bin/bash
groups: ['sudo', 'sshuser']
append: true
home: '/home/{{ user.name }}'
password_lock: false
password: '{{ user_secrets.password_hash }}'

- name: Ensure the user can use SSH
ansible.posix.authorized_key:
user: '{{ user.name }}'
key: '{{ user.ssh_public_key }}'

- name: Ensure only members of sshuser group can connect via SSH
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
line: 'AllowGroups sshuser'
validate: 'sshd -f %s -t'
notify: Reload sshd
23 changes: 23 additions & 0 deletions xmpp2/certbot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
#
# SPDX-License-Identifier: MIT

---
- name: Configure Certbot for certificate renewal
hosts: xmpp2
become: true

tasks:
- name: Install certbot
community.general.snap:
name: certbot
classic: true

# One-time setup should be performed manually, see the documentation:
# https://certbot.eff.org/instructions?ws=nginx&os=snap&tab=standard
#
# sudo certbot --nginx -d codingteam.org.ru -d loglist.xyz -d www.loglist.xyz
#
# Verify the changes to the web server configuration files performed by this command.
#
# Further updates are done by snap.certbot.renew.timer — see `systemctl list-timers` for details.
56 changes: 56 additions & 0 deletions xmpp2/codingteam.org.ru.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
#
# SPDX-License-Identifier: MIT

---
- name: Main site for codingteam.org.ru
hosts: xmpp2
become: true

vars:
codingteam_org_ru_version: v1.2.1

handlers:
- name: Prune Docker
community.docker.docker_prune:
containers: true
images: true
images_filters:
dangling: false
networks: true
volumes: true
builder_cache: true

- name: Reload nginx
ansible.builtin.service:
name: nginx
state: reloaded

tasks:
- name: Set up the Docker container
community.docker.docker_container:
name: codingteam.org.ru
image_name_mismatch: recreate
image: codingteam/codingteam.org.ru:{{ codingteam_org_ru_version }}
published_ports:
- '5000:5000'
restart_policy: unless-stopped
default_host_ip: ''
env:
ASPNETCORE_URLS: "http://+:5000" # otherwise, it can't be reached (listens to "localhost" only?)
notify: Prune Docker

- name: Set up the nginx configuration file
ansible.builtin.copy:
src: nginx/conf.d/codingteam.org.ru.conf
dest: /etc/nginx/conf.d/codingteam.org.ru.conf
mode: "u=rx,go=rx"
notify: Reload nginx

- name: Create a directory for the old logs # uploaded manually
ansible.builtin.file:
path: /opt/codingteam/old-logs
state: directory
owner: www-data
group: www-data
mode: "u=rx,go=rx"
10 changes: 10 additions & 0 deletions xmpp2/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
#
# SPDX-License-Identifier: MIT

- import_playbook: auth.yml
- import_playbook: nginx.yml
- import_playbook: docker.yml
- import_playbook: codingteam.org.ru.yml
- import_playbook: loglist.yml
- import_playbook: certbot.yml
24 changes: 24 additions & 0 deletions xmpp2/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
#
# SPDX-License-Identifier: MIT

---
- name: Install Docker
hosts: xmpp2
become: true

vars_files:
- vars.yml

tasks:
- name: Install the Docker package
ansible.builtin.apt:
cache_valid_time: 86400
name: docker.io
state: present

- name: Add the admin user to docker group
ansible.builtin.user:
name: '{{ user.name }}'
groups: docker
append: true
31 changes: 31 additions & 0 deletions xmpp2/files/loglist/application.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
#
# SPDX-License-Identifier: MIT

play.http.secret.key = ${HTTP_SECRET_KEY}
play.i18n.langs = ["en"]

feed.limit = 30

db.default.driver = org.postgresql.Driver
db.default.url = ${DATABASE_URL}

play.evolutions.autocommit = false
play.evolutions.db.default.autoApply = ${APPLY_EVOLUTIONS_SILENTLY}

recaptcha.publickey = ${RECAPTCHA_PUBLIC_KEY}
recaptcha.privatekey = ${RECAPTCHA_PRIVATE_KEY}

basicAuth.username = ${BASIC_AUTH_USERNAME}
basicAuth.password = ${BASIC_AUTH_PASSWORD}

approval.smtpHost = ${APPROVAL_SMTP_HOST}
approval.email = ${APPROVAL_EMAIL}
approval.emailPassword = ${APPROVAL_EMAIL_PASSWORD}

play.modules.enabled += "scalikejdbc.PlayModule"

play.filters.enabled += play.filters.hosts.AllowedHostsFilter
play.filters.hosts {
allowed = ["loglist.xyz"]
}
5 changes: 5 additions & 0 deletions xmpp2/files/loglist/init_db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
--
-- SPDX-License-Identifier: MIT

CREATE EXTENSION pgcrypto;
32 changes: 32 additions & 0 deletions xmpp2/files/nginx/conf.d/codingteam.org.ru.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SPDX-FileCopyrightText: 2016-2025 codingteam/devops contributors <https://github.com/codingteam/devops>
#
# SPDX-License-Identifier: MIT

server {
listen 443 ssl http2;
server_name codingteam.org.ru;
include /etc/nginx/ssl.conf;

location /old-logs/ {
alias /opt/codingteam/old-logs/;
index index.html;
}

location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host codingteam.org.ru;
proxy_http_version 1.1;
proxy_pass http://localhost:5000/;
}
}

server {
listen 80;
server_name codingteam.org.ru;

location / {
rewrite ^(.*)$ https://codingteam.org.ru$1 permanent;
}
}
Loading