Skip to content

Commit b10ffb3

Browse files
committed
(#39) xmpp2: set up loglist app and database
1 parent 25fe710 commit b10ffb3

File tree

6 files changed

+162
-0
lines changed

6 files changed

+162
-0
lines changed

Folder.DotSettings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<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">
22
<s:Boolean x:Key="/Default/UserDictionary/Words/=codingteam/@EntryIndexedValue">True</s:Boolean>
33
<s:Boolean x:Key="/Default/UserDictionary/Words/=lineinfile/@EntryIndexedValue">True</s:Boolean>
4+
<s:Boolean x:Key="/Default/UserDictionary/Words/=loglist/@EntryIndexedValue">True</s:Boolean>
5+
<s:Boolean x:Key="/Default/UserDictionary/Words/=pgdata/@EntryIndexedValue">True</s:Boolean>
6+
<s:Boolean x:Key="/Default/UserDictionary/Words/=postgre/@EntryIndexedValue">True</s:Boolean>
47
<s:Boolean x:Key="/Default/UserDictionary/Words/=sshuser/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

xmpp2/default.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
- import_playbook: nginx.yml
77
- import_playbook: docker.yml
88
- import_playbook: codingteam.org.ru.yml
9+
- import_playbook: loglist.yml

xmpp2/files/loglist/app.conf

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
play.http.secret.key = ${HTTP_SECRET_KEY}
6+
play.i18n.langs = ["en"]
7+
8+
feed.limit = 30
9+
10+
db.default.driver = org.postgresql.Driver
11+
db.default.url = ${DATABASE_URL}
12+
13+
play.evolutions.autocommit = false
14+
play.evolutions.db.default.autoApply = ${APPLY_EVOLUTIONS_SILENTLY}
15+
16+
recaptcha.publickey = ${RECAPTCHA_PUBLIC_KEY}
17+
recaptcha.privatekey = ${RECAPTCHA_PRIVATE_KEY}
18+
19+
basicAuth.username = ${BASIC_AUTH_USERNAME}
20+
basicAuth.password = ${BASIC_AUTH_PASSWORD}
21+
22+
approval.smtpHost = ${APPROVAL_SMTP_HOST}
23+
approval.email = ${APPROVAL_EMAIL}
24+
approval.emailPassword = ${APPROVAL_EMAIL_PASSWORD}
25+
26+
play.modules.enabled += "scalikejdbc.PlayModule"
27+
28+
play.filters.enabled += play.filters.hosts.AllowedHostsFilter
29+
play.filters.hosts {
30+
allowed = ["loglist.xyz"]
31+
}

xmpp2/files/loglist/init_db.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE EXTENSION pgcrypto;

xmpp2/loglist.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected]>
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
---
6+
- name: Main site for codingteam.org.ru
7+
hosts: xmpp2
8+
become: true
9+
10+
vars:
11+
# Container versions:
12+
postgresql_version: 9.3
13+
loglist_version: 2.0.1
14+
15+
# Paths on host:
16+
host_db_init_scripts_dir: /opt/codingteam/loglist/init_db_scripts
17+
host_data_dir: /opt/codingteam/loglist/data
18+
host_config_dir: /opt/codingteam/loglist/config
19+
20+
# Paths in containers:
21+
container_data_dir: /data
22+
23+
vars_files:
24+
- secrets.yml
25+
26+
handlers:
27+
- name: Prune Docker
28+
community.docker.docker_prune:
29+
containers: true
30+
images: true
31+
images_filters:
32+
dangling: false
33+
networks: true
34+
volumes: true
35+
builder_cache: true
36+
37+
tasks:
38+
- name: Create directories
39+
ansible.builtin.file:
40+
path: '{{ item }}'
41+
state: directory
42+
mode: 'u=rwx,g,o=rx'
43+
loop:
44+
- '{{ host_db_init_scripts_dir }}'
45+
- '{{ host_data_dir }}'
46+
- '{{ host_config_dir }}'
47+
48+
- name: Create the Docker network
49+
community.docker.docker_network:
50+
name: loglist
51+
52+
- name: Copy the database initialization script
53+
ansible.builtin.copy:
54+
src: loglist/init_db.sql
55+
dest: '{{ host_db_init_scripts_dir }}/init_db.sql'
56+
mode: 'u,g,o=rx'
57+
58+
- name: Set up the database container
59+
community.docker.docker_container:
60+
name: loglist.postgresql
61+
image_name_mismatch: recreate
62+
image: postgres:{{ postgresql_version }}
63+
published_ports:
64+
- '5423'
65+
env:
66+
POSTGRES_DB: loglist
67+
POSTGRES_USER: loglist
68+
POSTGRES_PASSWORD: '{{ loglist_secrets.db_password }}'
69+
PGDATA: '{{ container_data_dir }}'
70+
volumes:
71+
- '{{ host_db_init_scripts_dir }}/:/docker-entrypoint-initdb.d/'
72+
- '{{ host_data_dir }}/:/{{ container_data_dir }}/'
73+
networks:
74+
- name: loglist
75+
default_host_ip: ''
76+
notify: Prune Docker
77+
78+
- name: Copy the application configuration file
79+
ansible.builtin.copy:
80+
src: loglist/app.conf
81+
dest: '{{ host_config_dir }}/app.conf'
82+
mode: 'u,g,o=rx'
83+
84+
- name: Set up the application container
85+
community.docker.docker_container:
86+
name: loglist.app
87+
image_name_mismatch: recreate
88+
image: codingteam/loglist:{{ loglist_version }}
89+
published_ports:
90+
- '9000:9000'
91+
env:
92+
APPLY_EVOLUTIONS_SILENTLY: 'true'
93+
APPROVAL_EMAIL: '{{ loglist_secrets.approval_email.name }}'
94+
APPROVAL_EMAIL_PASSWORD: '{{ loglist_secrets.approval_email.password }}'
95+
APPROVAL_SMTP_HOST: '{{ loglist_secrets.approval_email.smtp_host }}'
96+
BASIC_AUTH_PASSWORD: '{{ loglist_secrets.basic_auth.password }}'
97+
BASIC_AUTH_USERNAME: '{{ loglist_secrets.basic_auth.username }}'
98+
DATABASE_URL: 'jdbc:postgresql://loglist.postgresql/loglist?user=loglist&password={{ loglist_secrets.db_password }}'
99+
JAVA_OPTS: '-Xmx200m -Xss512k -XX:+UseCompressedOops'
100+
RECAPTCHA_PRIVATE_KEY: '{{ loglist_secrets.recaptcha.private_key }}'
101+
RECAPTCHA_PUBLIC_KEY: '{{ loglist_secrets.recaptcha.public_key }}'
102+
HTTP_SECRET_KEY: '{{ loglist_secrets.http_secret_key }}'
103+
volumes:
104+
- '{{ host_db_init_scripts_dir }}/:/docker-entrypoint-initdb.d/'
105+
- '{{ host_data_dir }}/:/{{ container_data_dir }}/'
106+
networks:
107+
- name: loglist
108+
default_host_ip: ''
109+
notify: Prune Docker

xmpp2/vars/secrets.example.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,20 @@
44

55
user_secrets:
66
password_hash: '' # Use `mkpasswd --method=sha-512` to generate.
7+
8+
loglist_secrets:
9+
db_password: ''
10+
http_secret_key: ''
11+
12+
approval_email:
13+
name: ''
14+
password: ''
15+
smtp_host: ''
16+
17+
basic_auth:
18+
username: ''
19+
password: ''
20+
21+
recaptcha:
22+
private_key: ''
23+
public_key: ''

0 commit comments

Comments
 (0)