Skip to content

Commit 4bb861f

Browse files
jacobdotcostaAntonio C.
andauthored
Fixes (#10)
* several fixes * keycloak --------- Co-authored-by: Antonio C. <ac@trikorasolutions.com>
1 parent 1527f20 commit 4bb861f

39 files changed

+1771
-241
lines changed

gitlab/admin-guide.adoc

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,78 @@
1414

1515
* https://docs.gitlab.com/omnibus/settings/configuration.html
1616

17+
Reference: https://docs.gitlab.com/omnibus/settings/smtp.html
18+
19+
== SMTP
20+
21+
[source]
22+
----
23+
gitlab_rails['smtp_enable'] = true
24+
gitlab_rails['smtp_address'] = "smtp.server"
25+
gitlab_rails['smtp_port'] = 465
26+
gitlab_rails['smtp_user_name'] = "smtp user"
27+
gitlab_rails['smtp_password'] = "smtp password"
28+
gitlab_rails['smtp_domain'] = "example.com"
29+
gitlab_rails['smtp_authentication'] = "login"
30+
gitlab_rails['smtp_enable_starttls_auto'] = true
31+
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
32+
33+
# If your SMTP server does not like the default 'From: gitlab@localhost' you
34+
# can change the 'From' with this setting.
35+
gitlab_rails['gitlab_email_from'] = 'gitlab@example.com'
36+
gitlab_rails['gitlab_email_reply_to'] = 'noreply@example.com'
37+
38+
# If your SMTP server is using self signed certificates you can specify a custom ca file
39+
#gitlab_rails['smtp_ca_file'] = '/path/to/your/cacert.pem'
40+
----
41+
42+
GMAIL
43+
44+
[source,ruby]
45+
----
46+
gitlab_rails['smtp_enable'] = true
47+
gitlab_rails['smtp_address'] = "smtp.gmail.com"
48+
gitlab_rails['smtp_port'] = 587
49+
gitlab_rails['smtp_user_name'] = "my.email@gmail.com"
50+
gitlab_rails['smtp_password'] = "my-gmail-password"
51+
gitlab_rails['smtp_domain'] = "smtp.gmail.com"
52+
gitlab_rails['smtp_authentication'] = "login"
53+
gitlab_rails['smtp_enable_starttls_auto'] = true
54+
gitlab_rails['smtp_tls'] = false
55+
gitlab_rails['smtp_openssl_verify_mode'] = 'peer' # Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert', see http://api.rubyonrails.org/classes/ActionMailer/Base.html
56+
----
57+
58+
== OpenID Connect
59+
60+
References: https://docs.gitlab.com/administration/auth/oidc/
61+
62+
[source,rails]
63+
----
64+
gitlab_rails['omniauth_enabled'] = true
65+
gitlab_rails['omniauth_block_auto_created_users'] = true
66+
gitlab_rails['omniauth_allow_single_sign_on'] = ['openid_connect']
67+
gitlab_rails['omniauth_auto_link_ldap_user'] = true
68+
gitlab_rails['omniauth_providers'] = [
69+
{
70+
name: "openid_connect", # do not change this parameter
71+
label: "Keycloak", # optional label for login button, defaults to "Openid Connect"
72+
icon: "<custom_provider_icon>",
73+
args: {
74+
name: "openid_connect",
75+
scope: ["openid","profile","email"],
76+
response_type: "code",
77+
issuer: "http://keycloak.localdomain/",
78+
discovery: true,
79+
client_auth_method: "query",
80+
uid_field: "preferred_username",
81+
send_scope_to_token_endpoint: "false",
82+
pkce: true,
83+
client_options: {
84+
identifier: "<your_oidc_client_id>",
85+
secret: "<your_oidc_client_secret>",
86+
redirect_uri: "http://gitlab.localdomain/users/auth/openid_connect/callback"
87+
}
88+
}
89+
}
90+
]
91+
----

glpi/k8s/ansible/defaults/main.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
app_name: glpi
22
app_namespace: glpi
3-
app_version: "10.0.9"
4-
app_image_tag: "0.0.10"
3+
app_version: "10.0.19"
4+
app_image_tag: "0.1.3"
55

66
db_name: glpi
77
db_user: glpi
8-
storage_class: local-storage
8+
glpi_version: "10.0.19"
9+
#db_image_tag: 10.11.14
10+
mariadb_version: 10.11.14
11+
#mariadb_version: 11.8.3
12+
13+
# storage_class: local-storage
914

1015
volumes:
1116
- name: glpi-config
@@ -32,7 +37,3 @@ volumes:
3237
capacity: 1Gi
3338
component: analytics
3439

35-
db_image_tag: 10.10.2
36-
37-
# glpi_version: 10.0.9
38-
# mariadb_version: 10.10.2

glpi/k8s/ansible/glpi-backup-playbook.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,9 @@
7676
- name: "Backup GLPI database"
7777
kubernetes.core.k8s_exec:
7878
command: "mysqldump --defaults-extra-file=/tmp/.sqlpwd -u {{ db_bk_user }} glpi"
79-
# kubeconfig: "{{ k8s_config_file }}"
8079
namespace: "{{ k8s_ns }}"
8180
pod: "{{ mariadb_pod_name }}"
8281
register: mysqldump_res
83-
# environment:
84-
# MYSQL_PWD: "{{ db_bk_pw }}"
8582

8683
- name: "Remove password file"
8784
kubernetes.core.k8s_exec:
@@ -112,15 +109,13 @@
112109
- name: "Backup GLPI files"
113110
kubernetes.core.k8s_exec:
114111
command: "tar --warning=no-file-changed -czvf /tmp/{{ backup_file_prefix }}.files.tgz /var/lib/glpi"
115-
# kubeconfig: "{{ k8s_config_file }}"
116112
namespace: "{{ k8s_ns }}"
117113
pod: "{{ glpi_pod_name }}"
118114
register: glpi_file_bk_res
119115

120116
# kubectl -n glpi cp ${GLPI_POD}:/tmp/${GLPI_MYSQL_DUMP_FILENAME_PREFIX}.files.tgz ${BACKUP_ROOT_FOLDER}/glpi/${GLPI_MYSQL_DUMP_FILENAME_PREFIX}.files.tgz
121117
- name: "Download file backup"
122118
kubernetes.core.k8s_cp:
123-
# kubeconfig: "{{ k8s_config_file }}"
124119
namespace: "{{ k8s_ns }}"
125120
pod: "{{ glpi_pod_name }}"
126121
state: from_pod
@@ -150,8 +145,8 @@
150145
# kubectl -n glpi exec -it ${GLPI_POD} -- tar --warning=no-file-changed -czvf /tmp/${GLPI_MYSQL_DUMP_FILENAME_PREFIX}.plugins.tgz /var/www/html/plugins
151146
- name: "Backup GLPI config"
152147
kubernetes.core.k8s_exec:
153-
command: "tar --warning=no-file-changed -czvf /tmp/{{ backup_file_prefix }}.config.tgz /var/www/html/glpi/config"
154-
# kubeconfig: "{{ k8s_config_file }}"
148+
#command: "tar --warning=no-file-changed -czvf /tmp/{{ backup_file_prefix }}.config.tgz /var/www/html/glpi/config"
149+
command: "tar --warning=no-file-changed -czvf /tmp/{{ backup_file_prefix }}.config.tgz /etc/glpi"
155150
namespace: "{{ k8s_ns }}"
156151
pod: "{{ glpi_pod_name }}"
157152
register: glpi_config_bk_res

glpi/k8s/ansible/glpi-restore-files-playbook.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
namespace: "{{ app_namespace }}"
6565
pod: "{{ glpi_pod_name }}"
6666
command: |
67-
tar -xzvm -no-overwrite-dir -C / -f /tmp/files.tgz
67+
tar -xzvm --no-overwrite-dir -C / -f /tmp/files.tgz
6868
register: files_extract_res
6969

7070
- name: "Print extract result"

glpi/k8s/backupNrestore.adoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,13 @@ ansible-playbook mariadb/k8s/ansible/playbooks/restore-database-playbook.yaml \
235235
-e db_dump_file=${GLPI_DB_FILE_LOCATION}
236236
----
237237

238+
Start the application.
239+
240+
[source,bash]
241+
----
242+
kubectl -n glpi scale deployment glpi --replicas=1
243+
----
244+
238245
Restore the application files.
239246

240247
[source,bash]
@@ -244,7 +251,6 @@ ansible-playbook glpi/k8s/ansible/glpi-restore-files-playbook.yaml \
244251
-e glpi_bk_file=${GLPI_BK_FILES_LOCATION}
245252
----
246253

247-
248254
=== Manually
249255

250256
Get POD names.

glpi/k8s/helm/ansible/glpi-install-playbook.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
- name: "Deploy GLPI with Helm"
3838
kubernetes.core.helm:
3939
name: glpi
40-
chart_ref: "{% if trikora_helm_project_dir is defined %}{{ trikora_helm_project_dir }}/charts/odoo{% else %}trikorasolns/glpi{% endif %}"
40+
chart_ref: "{% if trikora_helm_project_dir is defined %}{{ trikora_helm_project_dir }}/charts/glpi{% else %}trikorasolns/glpi{% endif %}"
4141
release_namespace: "{{ app_namespace }}"
4242
wait: true
4343
# replace: true

glpi/k8s/helm/ansible/glpi-uninstall-playbook.yaml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,30 @@
3434
msg:
3535
- "glpi_helm_res: {{ glpi_helm_res }}"
3636

37-
- name: "Free the GLPI PV so they become available"
38-
ansible.builtin.shell: |
39-
kubectl patch pv {{ app_namespace }}-{{ item }}-pv -p '{"spec":{"claimRef": null}}'
40-
# kubernetes.core.k8s:
41-
# kind: PV
42-
# name: "{{ app_namespace }}-{{ item }}-pv"
43-
# definition:
44-
# spec:
45-
# claimRef: null
46-
loop:
47-
- glpi-config
48-
- glpi-files
49-
- glpi-log
50-
- glpi-marketplace
51-
- glpi-plugins
52-
53-
- name: "Patch the GLPI PV so they will be bound to the correct PVC"
54-
ansible.builtin.shell: |
55-
kubectl patch pv {{ app_namespace }}-{{ item }}-pv -p '{"spec":{"claimRef": {"name": "{{ item }}", "namespace": "{{ app_namespace }}"}}}'
56-
loop:
57-
- glpi-config
58-
- glpi-files
59-
- glpi-log
60-
- glpi-marketplace
61-
- glpi-plugins
37+
# - name: "Free the GLPI PV so they become available"
38+
# ansible.builtin.shell: |
39+
# kubectl patch pv {{ app_namespace }}-{{ item }}-pv -p '{"spec":{"claimRef": null}}'
40+
# # kubernetes.core.k8s:
41+
# # kind: PV
42+
# # name: "{{ app_namespace }}-{{ item }}-pv"
43+
# # definition:
44+
# # spec:
45+
# # claimRef: null
46+
# loop:
47+
# - glpi-config
48+
# - glpi-files
49+
# - glpi-log
50+
# - glpi-marketplace
51+
# - glpi-plugins
52+
53+
# - name: "Patch the GLPI PV so they will be bound to the correct PVC"
54+
# ansible.builtin.shell: |
55+
# kubectl patch pv {{ app_namespace }}-{{ item }}-pv -p '{"spec":{"claimRef": {"name": "{{ item }}", "namespace": "{{ app_namespace }}"}}}'
56+
# loop:
57+
# - glpi-config
58+
# - glpi-files
59+
# - glpi-log
60+
# - glpi-marketplace
61+
# - glpi-plugins
6262

6363
...

glpi/k8s/helm/ansible/phpmyadmin-install-playbook.yaml

Lines changed: 0 additions & 44 deletions
This file was deleted.

glpi/k8s/install-helm.adoc

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ Install python requirements.
2525

2626
[source,bash]
2727
----
28-
$ pip install -r glpi/k8s/ansible/requirements.txt
28+
pip install -r glpi/k8s/ansible/requirements.txt
2929
----
3030

31-
3231
=== Required information
3332

3433
Required variables.
@@ -177,8 +176,11 @@ This will deploy a MariaDB database on the application namespace.
177176
[source,bash]
178177
----
179178
ansible-playbook mariadb/k8s/helm/ansible/mariadb-install-playbook.yaml \
179+
-e "@glpi/k8s/ansible/defaults/main.yaml" \
180+
-e "@kubernetes/storage/ceph/ansible/defaults/main.yaml" \
180181
-e "@_local_config/glpi.yaml" \
181-
-e db_password=${DB_PASSWORD}
182+
-e db_password=${DB_PASSWORD} \
183+
-e db_root_password=${DB_PASSWORD}
182184
----
183185

184186
If you want to Restore a previous GLPI backup check the
@@ -192,6 +194,7 @@ Deploy the `glpi` application using the `trikorasolns/glpi` helm chart.
192194
[source,bash]
193195
----
194196
ansible-playbook glpi/k8s/helm/ansible/glpi-install-playbook.yaml \
197+
-e @kubernetes/storage/ceph/ansible/defaults/main.yaml \
195198
-e "@glpi/k8s/ansible/defaults/main.yaml" \
196199
-e "@_local_config/network.yaml" \
197200
-e trikora_helm_project_dir=${TRIKORA_HELM} \
@@ -202,13 +205,34 @@ If deploying the application to restore an existing backup consider adding
202205
the `GLPICRYPT` environment variable so the `glpycrypt.key` file is restored
203206
instead of GLPI having a new one generated.
204207

205-
-e "@glpi/k8s/ansible/defaults/main.yaml" \
208+
[NOTE]
209+
====
210+
To generate the base64 encoding perform the following steps.
211+
212+
Tar the glpicrypt file. The name of the file inside the TAR GZ must be
213+
`glpicrypt.key`.
214+
215+
[source,bash]
216+
----
217+
tar czvf glpicrypt.key.tgz glpicrypt.key
218+
----
219+
220+
Base64 encode the file.
221+
222+
[source,bash]
223+
----
224+
cat /tmp/glpicrypt.key.tgz | base64 -w 0
225+
----
226+
227+
These are the contents to be passed to the `glpicrypt_targz_file`.
228+
====
206229

207230
[source,bash]
208231
----
209232
ansible-playbook glpi/k8s/helm/ansible/glpi-install-playbook.yaml \
210233
-e "@_local_config/glpi.yaml" \
211234
-e "@_local_config/network.yaml" \
235+
-e "@glpi/k8s/ansible/defaults/main.yaml" \
212236
-e db_password=${DB_PASSWORD} \
213237
-e glpicrypt_targz_file="${GLPICRYPT_TARGZ_FILE}"
214238
----
@@ -299,7 +323,16 @@ ansible-playbook --limit ${K8S_HOST} kubernetes/ansible/host_path/app-pv-cleanup
299323
-e "@glpi/k8s/ansible/defaults/main.yaml"
300324
----
301325

326+
=== MariaDB
302327

328+
This will uninstall the MariaDB database chart on the application namespace.
329+
330+
[source,bash]
331+
----
332+
ansible-playbook mariadb/k8s/helm/ansible/mariadb-uninstall-playbook.yaml \
333+
-e "@_local_config/glpi.yaml" \
334+
-e db_password=${DB_PASSWORD}
335+
----
303336

304337

305338

keycloak/k8s/ansible/defaults/main.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ app_version: "26.1.3"
44

55
db_name: keycloak
66
db_user: keycloak
7-
db_type: postgresql
7+
db_type: postgres
8+
db_port: 5432
89
# storage_class: local-storage
910

1011
volumes:

0 commit comments

Comments
 (0)