summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Pavlov <apavlov@mirantis.com>2016-06-15 13:23:52 +0300
committerProskurin Kirill <kproskurin@mirantis.com>2016-06-21 18:20:34 +0200
commitf668e265227a0af1e1e0d294aa45dba8eebd28e1 (patch)
tree6d021b3833239a08d4212242a471eb184e5fa010
parent04823bd45b4eb67af6439ada3935416628531e50 (diff)
Adding application definition for rabbitmq
-rw-r--r--docker/rabbitmq/Dockerfile.j212
-rw-r--r--docker/rabbitmq/rabbitmq.config11
-rw-r--r--docker/rabbitmq/start.sh15
-rw-r--r--service/files/defaults.yaml4
-rw-r--r--service/files/erlang.cookie1
-rw-r--r--service/files/rabbitmq.config.j211
-rw-r--r--service/rabbitmq.yaml20
7 files changed, 39 insertions, 35 deletions
diff --git a/docker/rabbitmq/Dockerfile.j2 b/docker/rabbitmq/Dockerfile.j2
index 907ce08..3663817 100644
--- a/docker/rabbitmq/Dockerfile.j2
+++ b/docker/rabbitmq/Dockerfile.j2
@@ -7,16 +7,10 @@ RUN apt-get install -y --no-install-recommends \
7 7
8RUN rm -rf /var/lib/rabbitmq/* 8RUN rm -rf /var/lib/rabbitmq/*
9 9
10COPY rabbitmq.config /etc/rabbitmq/
11COPY start.sh /usr/local/bin/start.sh
12COPY rabbitmq_sudoers /etc/sudoers.d/rabbitmq_sudoers 10COPY rabbitmq_sudoers /etc/sudoers.d/rabbitmq_sudoers
13RUN chmod 755 /usr/local/bin/start.sh \ 11RUN chmod 750 /etc/sudoers.d \
14 && chmod 750 /etc/sudoers.d \
15 && chmod 440 /etc/sudoers.d/rabbitmq_sudoers \ 12 && chmod 440 /etc/sudoers.d/rabbitmq_sudoers \
16 && usermod -a -G microservices rabbitmq 13 && usermod -a -G microservices rabbitmq \
17 14 && chown -R rabbitmq: /var/lib/rabbitmq /var/log/rabbitmq /etc/rabbitmq
18ENV RABBITMQ_CLUSTER_COOKIE "password"
19 15
20USER rabbitmq 16USER rabbitmq
21
22CMD ["start.sh"]
diff --git a/docker/rabbitmq/rabbitmq.config b/docker/rabbitmq/rabbitmq.config
deleted file mode 100644
index c9d2228..0000000
--- a/docker/rabbitmq/rabbitmq.config
+++ /dev/null
@@ -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
diff --git a/docker/rabbitmq/start.sh b/docker/rabbitmq/start.sh
deleted file mode 100644
index f234ebd..0000000
--- a/docker/rabbitmq/start.sh
+++ /dev/null
@@ -1,15 +0,0 @@
1#!/bin/bash
2
3# bootstrap
4sudo chown -R rabbitmq: /var/lib/rabbitmq
5sudo chown -R rabbitmq: /etc/rabbitmq
6echo "${RABBITMQ_CLUSTER_COOKIE}" > /var/lib/rabbitmq/.erlang.cookie
7chmod 400 /var/lib/rabbitmq/.erlang.cookie
8
9# delme in future
10sed -i "s/IPADDR_COMMAS/`hostname -i | sed 's/\./,/g'`/g" /etc/rabbitmq/rabbitmq.config
11sed -i "s/IPADDR/`hostname -i`/g" /etc/rabbitmq/rabbitmq.config
12sed -i "s/RABBITMQ_CLUSTER_COOKIE/$RABBITMQ_CLUSTER_COOKIE/g" /etc/rabbitmq/rabbitmq.config
13
14# run daemon
15rabbitmq-server
diff --git a/service/files/defaults.yaml b/service/files/defaults.yaml
new file mode 100644
index 0000000..b555f81
--- /dev/null
+++ b/service/files/defaults.yaml
@@ -0,0 +1,4 @@
1configs:
2 rabbitmq_port: 5672
3 rabbitmq_password: password
4 rabbitmq_user: rabbitmq
diff --git a/service/files/erlang.cookie b/service/files/erlang.cookie
new file mode 100644
index 0000000..5dc245f
--- /dev/null
+++ b/service/files/erlang.cookie
@@ -0,0 +1 @@
{{ rabbitmq_password }}
diff --git a/service/files/rabbitmq.config.j2 b/service/files/rabbitmq.config.j2
new file mode 100644
index 0000000..b166f6c
--- /dev/null
+++ b/service/files/rabbitmq.config.j2
@@ -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
diff --git a/service/rabbitmq.yaml b/service/rabbitmq.yaml
new file mode 100644
index 0000000..04aaf18
--- /dev/null
+++ b/service/rabbitmq.yaml
@@ -0,0 +1,20 @@
1service:
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
13files:
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"