Skip to content

Commit 577178b

Browse files
committed
[Elao - App] Docker applications
1 parent 49e0e4b commit 577178b

File tree

8 files changed

+74
-51
lines changed

8 files changed

+74
-51
lines changed

elao.app/.manala.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ system:
109109
docker:
110110
# @schema {"items": {"type": "object"}}
111111
containers: []
112+
# @schema {"items": {"type": "object"}}
113+
applications: []
112114

113115
###############
114116
# Integration #

elao.app/.manala/Dockerfile.tmpl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ RUN \
3434
&& mkdir -p /srv \
3535
&& chmod 777 /srv \
3636
# User
37-
&& adduser --disabled-password --gecos "" docker \
37+
&& addgroup --system docker \
38+
&& adduser --disabled-password --ingroup docker --gecos docker docker \
3839
# Bash
3940
&& sed -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' \
4041
/home/docker/.bashrc \
@@ -59,10 +60,6 @@ RUN \
5960
ansible python3 python3-apt
6061
{{- end }}
6162

62-
COPY docker/bin/entrypoint.sh /usr/local/bin/entrypoint.sh
63-
64-
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
65-
6663
##########
6764
# System #
6865
##########
@@ -73,20 +70,25 @@ COPY ansible/templates /tmp/ansible/templates/
7370
COPY ansible/ansible.cfg ansible/system.yaml /tmp/ansible/
7471

7572
RUN \
73+
# Ansible
7674
cd /tmp/ansible \
7775
&& ansible-galaxy collection install \
7876
--requirements-file roles/system/requirements.yaml \
7977
--force \
8078
&& ansible-playbook system.yaml \
8179
--inventory-file inventories \
8280
--limit integration \
83-
&& rm -Rf /tmp/ansible
84-
85-
RUN \
81+
&& rm -Rf /tmp/ansible \
82+
# Cleanup docker
83+
&& rm -Rf /var/lib/docker \
8684
# NodeJs
87-
mkdir -p /usr/etc \
85+
&& mkdir -p /usr/etc \
8886
&& echo "cache=\${XDG_CACHE_HOME}/npm" > /usr/etc/npmrc
8987

88+
COPY docker/bin/entrypoint.sh /usr/local/bin/entrypoint.sh
89+
90+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
91+
9092
WORKDIR /srv/app
9193

9294
USER docker

elao.app/.manala/Jenkinsfile.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ podTemplate(
289289
}
290290

291291
try {
292-
appImage.inside("--network container:${hostContainerId} --env XDG_CACHE_HOME=${appCacheHome}/app") {
292+
appImage.inside("--privileged --network container:${hostContainerId} --env XDG_CACHE_HOME=${appCacheHome}/app") {
293293
{{- include "node" (dict "node" $integration) | trim | nindent 16 }}
294294
}
295295
} finally {

elao.app/.manala/ansible/inventories/system.yaml.tmpl

Lines changed: 47 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,19 @@ system:
88
###############
99

1010
development:
11+
1112
# Ansible
1213
ansible_connection: local
14+
1315
# Accounts
1416
manala_accounts_enabled: true
17+
manala_accounts_groups:
18+
- group: docker
19+
system: true
20+
manala_accounts_users:
21+
- user: vagrant
22+
group: vagrant
23+
groups: ['docker']
1524
# Motd
1625
manala_motd_enabled: true
1726
# Timezone
@@ -73,7 +82,38 @@ system:
7382
# Elasticsearch
7483
manala_elasticsearch_enabled: {{ not (empty .elasticsearch.version) | ternary "true" "false" }}
7584
# Docker
76-
manala_docker_enabled: true
85+
manala_docker_containers:
86+
- name: mailhog
87+
image: mailhog/mailhog:v1.0.1
88+
state: started
89+
restart_policy: unless-stopped
90+
ports:
91+
- 25:1025
92+
- 8025:8025
93+
- name: phpmyadmin
94+
image: phpmyadmin/phpmyadmin
95+
state: {{ or (not (empty .mysql.version)) (not (empty .mariadb.version)) | ternary "started" "absent" }}
96+
restart_policy: unless-stopped
97+
env:
98+
PMA_USER: root
99+
# Default docker host ip
100+
PMA_HOST: 172.17.0.1
101+
UPLOAD_LIMIT: 64M
102+
ports:
103+
- 1979:80
104+
- name: phpredisadmin
105+
image: erikdubbelboer/phpredisadmin
106+
state: {{ not (empty .redis.version) | ternary "started" "absent" }}
107+
restart_policy: unless-stopped
108+
env:
109+
# Default docker host ip
110+
REDIS_1_HOST: 172.17.0.1
111+
ports:
112+
- 1981:80
113+
{{- if .docker.containers }}
114+
# App
115+
{{- .docker.containers | toYaml | nindent 10 }}
116+
{{- end }}
77117
# Gomplate
78118
manala_gomplate_enabled: true
79119

@@ -82,8 +122,10 @@ system:
82122
###############
83123

84124
integration:
125+
85126
# Ansible
86127
ansible_connection: local
128+
87129
# Apt
88130
manala_apt_enabled: true
89131
manala_apt_packages:
@@ -120,15 +162,6 @@ system:
120162
# All #
121163
#######
122164

123-
# Accounts
124-
manala_accounts_groups:
125-
- group: docker
126-
system: true
127-
manala_accounts_users:
128-
- user: vagrant
129-
group: vagrant
130-
groups: ['docker']
131-
132165
# Motd
133166
manala_motd_scripts_exclusive: true
134167
manala_motd_scripts:
@@ -423,37 +456,11 @@ system:
423456
{{- end }}
424457

425458
# Docker
426-
manala_docker_containers:
427-
- name: mailhog
428-
image: mailhog/mailhog:v1.0.1
429-
state: started
430-
restart_policy: unless-stopped
431-
ports:
432-
- 25:1025
433-
- 8025:8025
434-
- name: phpmyadmin
435-
image: phpmyadmin/phpmyadmin
436-
state: {{ or (not (empty .mysql.version)) (not (empty .mariadb.version)) | ternary "started" "absent" }}
437-
restart_policy: unless-stopped
438-
env:
439-
PMA_USER: root
440-
# Default docker host ip
441-
PMA_HOST: 172.17.0.1
442-
UPLOAD_LIMIT: 64M
443-
ports:
444-
- 1979:80
445-
- name: phpredisadmin
446-
image: erikdubbelboer/phpredisadmin
447-
state: {{ not (empty .redis.version) | ternary "started" "absent" }}
448-
restart_policy: unless-stopped
449-
env:
450-
# Default docker host ip
451-
REDIS_1_HOST: 172.17.0.1
452-
ports:
453-
- 1981:80
454-
{{- if .docker.containers }}
459+
manala_docker_enabled: true
460+
{{- if .docker.applications }}
461+
manala_docker_applications:
455462
# App
456-
{{- .docker.containers | toYaml | nindent 10 }}
463+
{{- .docker.applications | toYaml | nindent 10 }}
457464
{{- end }}
458465

459466
{{- end }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env sh
2+
3+
docker run \
4+
--rm \
5+
--user 1000 \
6+
--volume /srv:/srv \
7+
elao/audiowaveform:{{ item.version|mandatory }} \
8+
"$@"

elao.app/.manala/docker/bin/entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
set -e
44

5+
# Docker
6+
sudo /etc/init.d/docker start
7+
58
# Cache (Composer and Yarn both follows XDG Base Directory Specification. For
69
# the others, related environment variables must be expanded at runtime)
710
if [ -n "${XDG_CACHE_HOME}" ]; then

elao.app/.manala/docker/make.mk.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ define docker_run
2525
--rm \
2626
--tty \
2727
--interactive \
28+
--privileged \
2829
--hostname {{ .Vars.system.hostname }} \
2930
--mount 'type=bind,consistency=delegated,source=$(realpath $(_ROOT_DIR)),target=/srv/app' \
3031
--workdir /srv/app/$(_DIR) \

elao.app/.manala/jenkins/Jenkinsfile.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ podTemplate(
289289
}
290290

291291
try {
292-
appImage.inside("--network container:${hostContainerId} --env XDG_CACHE_HOME=${appCacheHome}/app") {
292+
appImage.inside("--privileged --network container:${hostContainerId} --env XDG_CACHE_HOME=${appCacheHome}/app") {
293293
{{- include "node" (dict "node" $integration) | trim | nindent 16 }}
294294
}
295295
} finally {

0 commit comments

Comments
 (0)