add site-formation

This commit is contained in:
egarette@silique.fr 2023-02-14 13:56:28 +01:00
parent 5c4382d386
commit 427667ad3f
12 changed files with 196 additions and 4 deletions

View file

@ -1,6 +1,10 @@
# Application services # Application services
- [forgejo-formation](forgejo-formation/README.md): Formation in Forgejo - [forgejo-formation](forgejo-formation/README.md): Formation in Forgejo
- [site-formation](site-formation/README.md): Diffusion du contenu du dépôt git
# Providers and suppliers # Providers and suppliers
- Site:
- Provider: [forgejo-formation](forgejo-formation/README.md)
- Supplier: [site-formation](site-formation/README.md)

View file

@ -1,12 +1,10 @@
--- ---
forgejo: none gitea: none
include_toc: true include_toc: true
--- ---
# forgejo-formation # forgejo-formation
[All applications services for this dataset.](../README.md)
## Description ## Description
Formation in Forgejo. Formation in Forgejo.
@ -49,3 +47,9 @@ Formation in Forgejo.
- [+]: variable is multiple - [+]: variable is multiple
- **bold**: variable is mandatory - **bold**: variable is mandatory
## Supplier
[site-formation](../site-formation/README.md)
[All applications services for this dataset.](../README.md)

View file

@ -23,6 +23,25 @@ variables:
type: password type: password
hidden: true hidden: true
mandatory: true mandatory: true
- name: forgejo_site
hidden: true
provider: Site
mandatory: true
- name: forgejo_site_user
type: unix_user
hidden: true
mandatory: true
provider: Site:username
- name: forgejo_site_email
type: mail
hidden: true
mandatory: true
provider: Site:email
- name: forgejo_site_password
type: password
hidden: true
mandatory: true
provider: Site:password
constraints: constraints:
- fill: - fill:
- name: get_password - name: get_password
@ -42,3 +61,10 @@ constraints:
text: hide_secret text: hide_secret
target: target:
- text: forgejo_password - text: forgejo_password
- check:
- name: valid_not_equal
param:
- type: variable
text: forgejo_email
target:
- text: forgejo_site_email

View file

@ -1,6 +1,6 @@
--- ../../../dataset/seed/forgejo/templates/forgejo.service 2023-01-03 11:30:06.865085785 +0100 --- ../../../dataset/seed/forgejo/templates/forgejo.service 2023-01-03 11:30:06.865085785 +0100
+++ modif/forgejo.service 2023-02-14 10:13:27.985282958 +0100 +++ modif/forgejo.service 2023-02-14 10:13:27.985282958 +0100
@@ -20,18 +20,7 @@ @@ -20,18 +20,8 @@
Group=forgejo Group=forgejo
WorkingDirectory=/srv/forgejo/lib/ WorkingDirectory=/srv/forgejo/lib/
ExecStart=/usr/bin/forgejo web --config /etc/forgejo/app.ini ExecStart=/usr/bin/forgejo web --config /etc/forgejo/app.ini
@ -17,6 +17,7 @@
-sleep 2;%slurp -sleep 2;%slurp
-echo "CONFIGURATION DONE"' -echo "CONFIGURATION DONE"'
+ExecStartPre=-/bin/bash -c "/usr/bin/forgejo admin user create --username %%forgejo_user --password %%forgejo_password --email %%forgejo_email --admin -c /etc/forgejo/app.ini" +ExecStartPre=-/bin/bash -c "/usr/bin/forgejo admin user create --username %%forgejo_user --password %%forgejo_password --email %%forgejo_email --admin -c /etc/forgejo/app.ini"
+ExecStartPre=-/bin/bash -c "/usr/bin/forgejo admin user create --username %%forgejo_site_user --password %%forgejo_site_password --email %%forgejo_site_email --must-change-password=false -c /etc/forgejo/app.ini"
Restart=always Restart=always
Environment=GITEA_WORK_DIR=/srv/forgejo/lib Environment=GITEA_WORK_DIR=/srv/forgejo/lib

View file

@ -0,0 +1,52 @@
---
gitea: none
include_toc: true
---
# site-formation
## Description
Diffusion du contenu du dépôt git.
[For more informations](https://nginx.org/)
## Dependances
- [nginx-static (in external dataset)](https://forge.cloud.silique.fr/gnunux/dataset/src/branch/main/seed/nginx-static/README.md)
- [nginx-https (in external dataset)](https://forge.cloud.silique.fr/gnunux/dataset/src/branch/main/seed/nginx-https/README.md)
- [nginx-common (in external dataset)](https://forge.cloud.silique.fr/gnunux/dataset/src/branch/main/seed/nginx-common/README.md)
- [reverse-proxy-client (in external dataset)](https://forge.cloud.silique.fr/gnunux/dataset/src/branch/main/seed/reverse-proxy-client/README.md)
- [base-fedora-37 (in external dataset)](https://forge.cloud.silique.fr/gnunux/dataset/src/branch/main/seed/base-fedora-37/README.md)
- [base-fedora (in external dataset)](https://forge.cloud.silique.fr/gnunux/dataset/src/branch/main/seed/base-fedora/README.md)
- [systemd (in external dataset)](https://forge.cloud.silique.fr/gnunux/dataset/src/branch/main/seed/systemd/README.md)
- [base-machine (in external dataset)](https://forge.cloud.silique.fr/gnunux/dataset/src/branch/main/seed/base-machine/README.md)
- [base (in external dataset)](https://forge.cloud.silique.fr/gnunux/dataset/src/branch/main/seed/base/README.md)
- [dns-local (in external dataset)](https://forge.cloud.silique.fr/gnunux/dataset/src/branch/main/seed/dns-local/README.md)
- [pki-tls (in external dataset)](https://forge.cloud.silique.fr/gnunux/dataset/src/branch/main/seed/pki-tls/README.md)
## Variables
### Général (*general*)
#### nginx (*general.nginx*)
| Description | Values |
|----------------------------------------------|----------------------|
| *[**nginx_root**](dictionaries/23_site.yml)* | /srv/git/site/static |
#### forgejo (*general.forgejo*)
| Description | Type | Supplier |
|-----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|------------|
| Email de l'utilisateur Site dans Forgejo (*[site_user_mail](dictionaries/23_site.yml)*) | [mail](https://forge.cloud.silique.fr/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | Site:email |
- [+]: variable is multiple
- **bold**: variable is mandatory
## Provider
[forgejo-formation](../forgejo-formation/README.md)
[All applications services for this dataset.](../README.md)

View file

@ -0,0 +1,5 @@
format: '0.1'
description: Diffusion du contenu du dépôt git
website: https://nginx.org/
depends:
- nginx-static

View file

@ -0,0 +1,61 @@
version: '0.10'
services:
- service:
- name: nginx
override: null
- name: site_update
engine: none
file:
- text: /sbin/site_update
mode: 755
- name: site_update
type: timer
engine: none
variables:
- family:
- name: nginx
variables:
- variable:
- name: nginx_root
redefine: true
value:
- text: /srv/git/site/static
- name: forgejo
variables:
- variable:
- name: site_domain_name
hidden: true
supplier: Site
- name: site_user_name
type: unix_user
hidden: true
supplier: Site:username
value:
- text: site
- name: site_user_mail
type: mail
description: Email de l'utilisateur Site dans Forgejo
supplier: Site:email
- name: site_user_password
type: password
hidden: true
supplier: Site:password
constraints:
- fill:
- name: get_password
param:
- type: variable
name: server_name
text: domain_name_eth0
- type: variable
name: username
text: site_user_name
- name: description
text: site
- name: type
text: cleartext
- name: hide
type: variable
text: hide_secret
target:
- text: site_user_password

View file

@ -0,0 +1 @@
PKG="$PKG git-core"

View file

@ -0,0 +1,2 @@
[Unit]
After=site_clone.target

View file

@ -0,0 +1,17 @@
%echo "#!/bin/bash -e"
%from os.path import dirname
GIT_DIR=%%dirname(%%dirname(%%nginx_root))
REPO_DIR=%%dirname(%%nginx_root)
if [ ! -d $GIT_SITE/.git ]; then
if [ -d %%nginx_root ]; then
rm -rf %%nginx_root
fi
cd $GIT_DIR
git clone https://%%site_user_name:%%site_user_password@%%site_domain_name:3000/pedago/site.git
fi
cd $REPO_DIR
git pull
exit 0

View file

@ -0,0 +1,10 @@
[Unit]
Description=Update site files
After=risotto.target
[Service]
Type=oneshot
ExecStart=/usr/local/lib/sbin/site_update
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,9 @@
[Unit]
Description=Run site updater
[Timer]
OnUnitActiveSec=1h
Unit=site_update.service
[Install]
WantedBy=timers.target