moved stuff around, gitea not working

This commit is contained in:
Adrien Luxey 2020-05-07 08:17:17 +02:00
parent 4cb54d2cbc
commit 189e2ec60f
12 changed files with 220 additions and 194 deletions

View file

@ -14,96 +14,96 @@ gitea:
version: 1.11.4 version: 1.11.4
sites: sites:
- slug: rdb # Shorthand name to use as directory/file name # - slug: rdb # Shorthand name to use as directory/file name
# The site URL (without www) # # The site URL (without www)
url: rennesdesbois.fr # url: rennesdesbois.fr
# Ask nginx to redirect url to www # # Ask nginx to redirect url to www
# Else, we redirect www to url # # Else, we redirect www to url
redirect_to_www: yes # redirect_to_www: yes
# What kind of site is that? # # What kind of site is that?
type: wordpress # type: wordpress
# Subnet addresses # # Subnet addresses
subnet_cidr_address: 172.27.1.0/24 # subnet_cidr_address: 172.27.1.0/24
subnet_gateway_ip: 172.27.1.1 # subnet_gateway_ip: 172.27.1.1
subnet_nginx_ip: 172.27.1.2 # subnet_nginx_ip: 172.27.1.2
subnet_site_ip: 172.27.1.3 # subnet_site_ip: 172.27.1.3
# MySQL # # MySQL
mysql_database: rdb # mysql_database: rdb
mysql_username: rdb # mysql_username: rdb
mysql_password: "{{ vault_rdb_mysql_password }}" # mysql_password: "{{ vault_rdb_mysql_password }}"
- slug: arvuhez # Shorthand name to use as directory/file name # - slug: arvuhez # Shorthand name to use as directory/file name
# The site URL (without www) # # The site URL (without www)
url: arvuhez.org # url: arvuhez.org
# Ask nginx to redirect url to www # # Ask nginx to redirect url to www
# Else, we redirect www to url # # Else, we redirect www to url
redirect_to_www: no # redirect_to_www: no
# What kind of site is that? # # What kind of site is that?
type: wordpress # type: wordpress
# Subnet addresses # # Subnet addresses
subnet_cidr_address: 172.27.2.0/24 # subnet_cidr_address: 172.27.2.0/24
subnet_gateway_ip: 172.27.2.1 # subnet_gateway_ip: 172.27.2.1
subnet_nginx_ip: 172.27.2.2 # subnet_nginx_ip: 172.27.2.2
subnet_site_ip: 172.27.2.3 # subnet_site_ip: 172.27.2.3
# MySQL # # MySQL
mysql_database: arvuhez # mysql_database: arvuhez
mysql_username: arvuhez # mysql_username: arvuhez
mysql_password: "{{ vault_arvuhez_mysql_password }}" # mysql_password: "{{ vault_arvuhez_mysql_password }}"
- slug: zinzoscope # Shorthand name to use as directory/file name # - slug: zinzoscope # Shorthand name to use as directory/file name
# The site URL (without www) # # The site URL (without www)
url: zinz.luxeylab.net # url: zinz.luxeylab.net
# Ask nginx to redirect url to www # # Ask nginx to redirect url to www
# Else, we redirect www to url # # Else, we redirect www to url
redirect_to_www: no # redirect_to_www: no
# What kind of site is that? # # What kind of site is that?
type: wordpress # type: wordpress
# Subnet addresses # # Subnet addresses
subnet_cidr_address: 172.27.3.0/24 # subnet_cidr_address: 172.27.3.0/24
subnet_gateway_ip: 172.27.3.1 # subnet_gateway_ip: 172.27.3.1
subnet_nginx_ip: 172.27.3.2 # subnet_nginx_ip: 172.27.3.2
subnet_site_ip: 172.27.3.3 # subnet_site_ip: 172.27.3.3
# MySQL # # MySQL
mysql_database: zinzoscope # mysql_database: zinzoscope
mysql_username: zinzoscope # mysql_username: zinzoscope
mysql_password: "{{ vault_zinzoscope_mysql_password }}" # mysql_password: "{{ vault_zinzoscope_mysql_password }}"
- slug: lexperimental # Shorthand name to use as directory/file name # - slug: lexperimental # Shorthand name to use as directory/file name
# The site URL (without www) # # The site URL (without www)
url: lexperimental.fr # url: lexperimental.fr
# Ask nginx to redirect url to www # # Ask nginx to redirect url to www
# Else, we redirect www to url # # Else, we redirect www to url
redirect_to_www: no # redirect_to_www: no
# What kind of site is that? # # What kind of site is that?
type: wordpress # type: wordpress
# Subnet addresses # # Subnet addresses
subnet_cidr_address: 172.27.4.0/24 # subnet_cidr_address: 172.27.4.0/24
subnet_gateway_ip: 172.27.4.1 # subnet_gateway_ip: 172.27.4.1
subnet_nginx_ip: 172.27.4.2 # subnet_nginx_ip: 172.27.4.2
subnet_site_ip: 172.27.4.3 # subnet_site_ip: 172.27.4.3
# MySQL # # MySQL
mysql_database: lexperimental # mysql_database: lexperimental
mysql_username: lexperimental # mysql_username: lexperimental
mysql_password: "{{ vault_lexperimental_mysql_password }}" # mysql_password: "{{ vault_lexperimental_mysql_password }}"
- slug: mts # Shorthand name to use as directory/file name # - slug: mts # Shorthand name to use as directory/file name
# The site URL (without www) # # The site URL (without www)
url: editionsmangetasoupe.fr # url: editionsmangetasoupe.fr
# Ask nginx to redirect url to www # # Ask nginx to redirect url to www
# Else, we redirect www to url # # Else, we redirect www to url
redirect_to_www: no # redirect_to_www: no
# What kind of site is that? # # What kind of site is that?
type: drupal # type: drupal
# Subnet addresses # # Subnet addresses
subnet_cidr_address: 172.27.5.0/24 # subnet_cidr_address: 172.27.5.0/24
subnet_gateway_ip: 172.27.5.1 # subnet_gateway_ip: 172.27.5.1
subnet_site_ip: 172.27.5.2 # subnet_site_ip: 172.27.5.2
# This will allow setting up MySQL # # This will allow setting up MySQL
# Configuration on Drupal's side must be done by hand: # # Configuration on Drupal's side must be done by hand:
# Edit your <drupal_install>/sites/default/settings.php # # Edit your <drupal_install>/sites/default/settings.php
mysql_database: mts8 # mysql_database: mts8
mysql_username: mts # mysql_username: mts
mysql_password: "{{ vault_mts_mysql_password }}" # mysql_password: "{{ vault_mts_mysql_password }}"
- slug: gitea_test # Shorthand name to use as directory/file name - slug: gitea_test # Shorthand name to use as directory/file name
# The site URL (without www) # The site URL (without www)
@ -114,11 +114,14 @@ sites:
# What kind of site is that? # What kind of site is that?
type: gitea type: gitea
# Subnet addresses # Subnet addresses
subnet_cidr_address: 172.27.4.0/24 subnet_cidr_address: 172.27.6.0/24
subnet_gateway_ip: 172.27.4.1 subnet_gateway_ip: 172.27.6.1
subnet_nginx_ip: 172.27.4.2 subnet_nginx_ip: 172.27.6.2
subnet_site_ip: 172.27.4.3 subnet_site_ip: 172.27.6.3
# User ID (git on remote)
user_uid: 1007
user_gid: 1006
# MySQL # MySQL
mysql_database: gitea_test mysql_database: gitea_test
mysql_username: gitea_test mysql_username: gitea_test
mysql_password: "{{ vault_lexperimental_mysql_password }}" mysql_password: "{{ vault_gitea_test_mysql_password }}"

View file

@ -1,34 +1,38 @@
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
34386539366237643636326332343434623662373561336536363338373535393662323663656535 64313133656432666630353732343865386336613536386135326132616366393761663936653565
6431333031393336353139616535363739343763356163620a356164313063616231373634393963 3038656636653562353037643765333831656334343332310a313062353730333865383964376537
30366366616539306438326563623832626666363562383334303961643862373736356337356635 30393232616663626336616638373136316130336332626632633132643764613034333838653361
6461363664316566660a346539376262326438353933663333393137623438643166623335383236 3563393837396232370a636232646566353261356333333137386234313661633238626263313535
38643631363032636138333739353337633839303562383664366163303537633463663331313362 36326239633339663035303165333239346530373332393431396462326266366536623566656630
30306132383465633434376236626562353935383463306333386538653436323832313063646162 35313335313836656239333137363337353833333333343732353138313638336662613733333032
35653934306631383633636132666534373537316137623961653566303463376433373561323166 61353033343934343066333235336466373665353964316136316534666135353538353562316238
38353034393830323165653130663063646135656137633434313066616663636635346431333138 32613861636336376533356535656134333934653834336136303364313335353061373738343232
65633663626266613039323264653738316564643563303764646330643837383639646131643639 62663238383535653637616532353662343061353236396231346365346339353964663962646233
36646664386138623565353864373235326362353537306133633663316238613862616464323732 61376535306166353261386163386362356137653962386338633631383738326164646235356532
66383733306166633466333833643162353261356565326232356132303062623936663731663136 34333665393963306130393832343834353132623035363739323736396531353462633331653135
36613261646130383632636165393061316235326435383064313233316639383830323165653265 31333262303433633434653430616363663932333830363163393362376437636163376162326338
31383063303463303561383434623832323536336438623265316264623661653333323133356231 64613431336631333033663966346438386632326461633934393433643864343061363239383338
64663734343333663130303565383466666436383964646564313932323637393136646165643634 36663938623661343535643663646661643335616431616364646535663735396639353239353936
66636261663561613139393333326663646464303339323933663061383736343536623164356566 30356166643630316564663137393666666635666466356661363039666436346136613032393034
36323534323666303532383333343363373666386565643566396636386265393232636233396133 62326563313061316466666430366163396537663262303562386265353938373833393531636437
35393338613166653931666536663336633364383735303361636366656666636433356262656262 37346331353364366436666531656534323332353439373935623835646363633330636232396137
34633534306239663563326566623161633363633466613764343836613331326265636439623530 35666466316134613538376166633863656332616332613130613134633362643839343131366332
37326138393738316536393464643131653537663434323664343237393165613039646232343835 61343630653865353236383532353736626530343332626138323636346239356235303037636565
34323036386232363437633966303861643962393337326332613334343431383231646465336334 64363438343435313232363035643462653736323362323636383062333335336531626366363431
65396465373163643163313466376334646436386463373232613663393663373139356234326165 35616631386539306436333733656530626637616533343164343035316165366138373363613930
64353633313832633335633830323337636130636431666263383061626231343138646665346136 30373136316562306530376633653431346463663162383466643933306133633132383961343432
36323232373338373734333436656435646163393961633366613735616537656638633034373965 35336533623735633135623332366136323563366136633761633137363664393563386462303864
38663662373736626561666239333733393630653439383265616433663934366435323136373963 39633163333636386563303162366537386237646635373666653662633239343532663061363536
66303836363764393363383833323066616234316666303934626638363734346663616661616664 34626338616638666266323637333630353262376135613237313738383965386539636365306162
36366635656534343738343234356363323032636435336433333135666232623231333739336262 32366335666438383632326139386561303937613138386666396538333034336235373063613863
30636561613938396631623365613535656666313334663665363037636534353030626262313134 39383238346561653236663464306332363461663933633462636432383639363632393130633965
62663931626661313231613235366364613635383638633265386330373731663738336435346537 33356633616462336637396432646633343535383133353065616630303736323335623439313932
30393137373636363237643365626437623734376162626437306364313564616530663934343137 66633030643664326662636264323234623064376464333838363039353234343138373732633533
33313065346465633933616134386434323031313239303736653564623833376563336361366164 30653761306131386430613838383538306564636361633838326636383636383539313465656135
37666635643334663665633966653738616131643237343063326430326263363461303966333032 32626264353534366565306236623361353331623036613137623332636366653331333534623035
64616336303361626336343930363666623565356431336461346132326636333636663730343934 31313731363263323063656264663632636265393639633765366435623333313937313065303231
3666 32656239663961333430613161346435333438616662613735313862666239636561326566353139
35643965393263353865356637383664316166333839633738373861383535343337663466396563
32393563613730636438393539323561393962366532646138633131376364383862653437393037
37343634333233393135643939396361626135353435666466393664666335623533636337626436
3632

View file

@ -5,7 +5,7 @@
loop: "{{ sites }}" loop: "{{ sites }}"
loop_control: loop_control:
loop_var: site loop_var: site
when: item.type == "wordpress" when: site.type == "wordpress"
tags: wordpress tags: wordpress
- name: Build Drupal sites - name: Build Drupal sites
@ -13,7 +13,7 @@
loop: "{{ sites }}" loop: "{{ sites }}"
loop_control: loop_control:
loop_var: site loop_var: site
when: item.type == "drupal" when: site.type == "drupal"
tags: drupal tags: drupal
- name: Build Gitea sites - name: Build Gitea sites
@ -21,7 +21,7 @@
loop: "{{ sites }}" loop: "{{ sites }}"
loop_control: loop_control:
loop_var: site loop_var: site
when: item.type == "gitea" when: site.type == "gitea"
tags: gitea tags: gitea
# build an image # build an image

View file

@ -2,6 +2,15 @@
# Needs variables: # Needs variables:
# - site: dict describing the site install (cf group_vars/all/vars.yml) # - site: dict describing the site install (cf group_vars/all/vars.yml)
- name: "Create database {{ site.mysql_database }} if inexistent"
mysql_db:
name: "{{ site.mysql_database }}"
state: present
# Credentials to log in MySQL
login_host: localhost
login_user: root
login_password: "{{ mysql_root_password }}"
# MySQL equivalent: # MySQL equivalent:
# create user <user>@<ip> identified by <pass>; # create user <user>@<ip> identified by <pass>;
# grant all on <db>.* to <user>@<ip>; # grant all on <db>.* to <user>@<ip>;
@ -17,4 +26,4 @@
password: "{{ site.mysql_password }}" password: "{{ site.mysql_password }}"
# Grants # Grants
priv: "{{ site.mysql_database }}.*:all" priv: "{{ site.mysql_database }}.*:all"
state: present state: present

View file

@ -12,8 +12,8 @@ services:
restart: always restart: always
environment: environment:
APP_NAME: "Gitea: git with a cup of coffee" APP_NAME: "Gitea: git with a cup of coffee"
DOMAIN: "{{ site.url }}" # DOMAIN: "{{ site.url }}"
ROOT_URL: "{{ site.url }}" # ROOT_URL: "{{ site.url }}"
USER_UID: "{{ site.user_uid }}" USER_UID: "{{ site.user_uid }}"
USER_GID: "{{ site.user_gid }}" USER_GID: "{{ site.user_gid }}"
DB_TYPE: mysql DB_TYPE: mysql

View file

@ -57,11 +57,23 @@ http {
server { server {
listen 80 default; listen 80;
listen [::]:80 default; listen [::]:80;
server_name {{ site.url }} www.{{ site.url }}; server_name {{ site.url }} www.{{ site.url }};
root /data;
location / { location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Url-Scheme $scheme;
proxy_redirect off;
proxy_max_temp_file_size 0;
proxy_read_timeout 120;
proxy_pass http://{{ site.subnet_site_ip }}:3000; proxy_pass http://{{ site.subnet_site_ip }}:3000;
} }
}
} }

View file

@ -0,0 +1,10 @@
# Needs variables:
# - site: dict describing the site install (cf group_vars/all/vars.yml)
- name: Include nginx tasks
include_tasks: nginx.yml
tags: nginx
- name: Include docker tasks
include_tasks: docker.yml
tags: docker

View file

@ -0,0 +1,10 @@
---
# Needs variables:
# - site: dict describing the site install (cf group_vars/all/vars.yml)
- name: "Launch the site's containers"
docker_compose:
project_src: "{{ sites_path }}/{{ site.slug }}"
state: present
build: yes
restarted: yes

View file

@ -1,27 +0,0 @@
- name: "Launch the site's containers"
docker_compose:
project_src: "{{ sites_path }}/{{ item.slug }}"
state: present
build: yes
restarted: yes
tags: docker
- name: "Symlink nginx configuration to sites-enabled"
file:
src: "/etc/nginx/sites-available/{{ item.url }}"
dest: "/etc/nginx/sites-enabled/{{ item.url }}"
state: link
become: yes
tags: nginx
- name: Verify nginx configuration
command: "nginx -t"
become: yes
tags: nginx
- name: Restart nginx service
service:
name: nginx
state: restarted
become: yes
tags: nginx

View file

@ -1,13 +1,25 @@
--- ---
- name: Deploy Wordpress sites - name: Deploy Wordpress sites
include_tasks: wordpress.yml include_tasks: deploy.yml
loop: "{{ sites }}" loop: "{{ sites }}"
when: item.type == "wordpress" loop_control:
loop_var: site
when: site.type == "wordpress"
tags: wordpress tags: wordpress
- name: Deploy Drupal sites - name: Deploy Drupal sites
include_tasks: drupal.yml include_tasks: deploy.yml
loop: "{{ sites }}" loop: "{{ sites }}"
when: item.type == "drupal" loop_control:
tags: drupal loop_var: site
when: site.type == "drupal"
tags: drupal
- name: Deploy Gitea sites
include_tasks: deploy.yml
loop: "{{ sites }}"
loop_control:
loop_var: site
when: site.type == "gitea"
tags: gitea

View file

@ -0,0 +1,23 @@
# Needs variables:
# - site: dict describing the site install (cf group_vars/all/vars.yml)
- name: Copy host config to /etc/nginx/sites-available
copy:
remote_src: yes
src: "{{ sites_path }}/{{ site.slug }}/nginx.host"
dest: "/etc/nginx/sites-available/{{ site.url }}"
become: yes
notify: Restart nginx
- name: "Symlink nginx configuration to sites-enabled"
file:
src: "/etc/nginx/sites-available/{{ site.url }}"
dest: "/etc/nginx/sites-enabled/{{ site.url }}"
state: link
become: yes
notify: Restart nginx
- name: Verify nginx configuration
command: "nginx -t"
any_errors_fatal: true
become: yes

View file

@ -1,30 +0,0 @@
- name: "Launch the site's containers"
docker_compose:
project_src: "{{ sites_path }}/{{ item.slug }}"
state: present
build: yes
restarted: yes
tags: docker
- name: Copy host config to /etc/nginx/sites-available
copy:
remote_src: yes
src: "{{ sites_path }}/{{ item.slug }}/nginx.host"
dest: "/etc/nginx/sites-available/{{ item.url }}"
become: yes
notify: Restart nginx
tags: nginx
- name: "Symlink nginx configuration to sites-enabled"
file:
src: "/etc/nginx/sites-available/{{ item.url }}"
dest: "/etc/nginx/sites-enabled/{{ item.url }}"
state: link
become: yes
notify: Restart nginx
tags: nginx
- name: Verify nginx configuration
command: "nginx -t"
become: yes
tags: nginx