Browse Source

Merge "Adding application definition for rabbitmq"

NextGen CI 2 years ago
parent
commit
d674d07e06

+ 3
- 9
docker/rabbitmq/Dockerfile.j2 View File

@@ -7,16 +7,10 @@ RUN apt-get install -y --no-install-recommends \
7 7
 
8 8
 RUN rm -rf /var/lib/rabbitmq/*
9 9
 
10
-COPY rabbitmq.config /etc/rabbitmq/
11
-COPY start.sh /usr/local/bin/start.sh
12 10
 COPY rabbitmq_sudoers /etc/sudoers.d/rabbitmq_sudoers
13
-RUN chmod 755 /usr/local/bin/start.sh \
14
-    && chmod 750 /etc/sudoers.d \
11
+RUN chmod 750 /etc/sudoers.d \
15 12
     && chmod 440 /etc/sudoers.d/rabbitmq_sudoers \
16
-    && usermod -a -G microservices rabbitmq
17
-
18
-ENV RABBITMQ_CLUSTER_COOKIE "password"
13
+    && usermod -a -G microservices rabbitmq \
14
+    && chown -R rabbitmq: /var/lib/rabbitmq /var/log/rabbitmq /etc/rabbitmq
19 15
 
20 16
 USER rabbitmq
21
-
22
-CMD ["start.sh"]

+ 0
- 11
docker/rabbitmq/rabbitmq.config View File

@@ -1,11 +0,0 @@
1
-[
2
-  {rabbit, [
3
-    {tcp_listeners, [
4
-      {"IPADDR", 5672}
5
-    ]},
6
-    {default_user, <<"rabbitmq">>},
7
-    {default_pass, <<"RABBITMQ_CLUSTER_COOKIE">>},
8
-    {cluster_partition_handling, autoheal}
9
-  ]}
10
-].
11
-% EOF

+ 0
- 15
docker/rabbitmq/start.sh View File

@@ -1,15 +0,0 @@
1
-#!/bin/bash
2
-
3
-# bootstrap
4
-sudo chown -R rabbitmq: /var/lib/rabbitmq
5
-sudo chown -R rabbitmq: /etc/rabbitmq
6
-echo "${RABBITMQ_CLUSTER_COOKIE}" > /var/lib/rabbitmq/.erlang.cookie
7
-chmod 400 /var/lib/rabbitmq/.erlang.cookie
8
-
9
-# delme in future
10
-sed -i "s/IPADDR_COMMAS/`hostname -i | sed 's/\./,/g'`/g" /etc/rabbitmq/rabbitmq.config
11
-sed -i "s/IPADDR/`hostname -i`/g" /etc/rabbitmq/rabbitmq.config
12
-sed -i "s/RABBITMQ_CLUSTER_COOKIE/$RABBITMQ_CLUSTER_COOKIE/g" /etc/rabbitmq/rabbitmq.config
13
-
14
-# run daemon
15
-rabbitmq-server

+ 4
- 0
service/files/defaults.yaml View File

@@ -0,0 +1,4 @@
1
+configs:
2
+    rabbitmq_port: 5672
3
+    rabbitmq_password: password
4
+    rabbitmq_user: rabbitmq

+ 1
- 0
service/files/erlang.cookie View File

@@ -0,0 +1 @@
1
+{{ rabbitmq_password }}

+ 11
- 0
service/files/rabbitmq.config.j2 View File

@@ -0,0 +1,11 @@
1
+[
2
+  {rabbit, [
3
+    {tcp_listeners, [
4
+      {"0.0.0.0", {{ rabbitmq_port }} }
5
+    ]},
6
+    {default_user, <<"{{ rabbitmq_user }}">>},
7
+    {default_pass, <<"{{ rabbitmq_password }}">>},
8
+    {cluster_partition_handling, autoheal}
9
+  ]}
10
+].
11
+% EOF

+ 20
- 0
service/rabbitmq.yaml View File

@@ -0,0 +1,20 @@
1
+service:
2
+    name: rabbitmq
3
+    ports:
4
+        - rabbitmq_port
5
+    probes:
6
+        readiness: "true"
7
+        liveness: "true"
8
+    daemon:
9
+        files:
10
+            - rabbitmq-conf
11
+            - erlang-cookie
12
+        command: rabbitmq-server
13
+files:
14
+    rabbitmq-conf:
15
+        path: /etc/rabbitmq/rabbitmq.config
16
+        content: rabbitmq.config.j2
17
+    erlang-cookie:
18
+        path: /var/lib/rabbitmq/.erlang.cookie
19
+        content: erlang.cookie
20
+        perm: "400"

Loading…
Cancel
Save