Browse Source

Initial rabbitmq service. Standalone.

Jinja vars will be added later, since build tool is not ready yet.
Proper cluster implementation already done for mesos and will be re-wrote
for k8s as all needed tools are ready.

Change-Id: I392ffbed9b2947d09b696d613c523dd68c0a2c0d
Proskurin Kirill 2 years ago
parent
commit
04823bd45b

+ 66
- 0
.gitignore View File

@@ -0,0 +1,66 @@
1
+*.py[cod]
2
+
3
+# C extensions
4
+*.so
5
+
6
+# Packages
7
+*.egg
8
+*.egg-info
9
+dist
10
+build
11
+.eggs
12
+eggs
13
+parts
14
+bin
15
+var
16
+sdist
17
+develop-eggs
18
+.installed.cfg
19
+lib
20
+lib64
21
+
22
+# Installer logs
23
+pip-log.txt
24
+
25
+# Unit test / coverage reports
26
+.coverage
27
+cover
28
+.tox
29
+nosetests.xml
30
+.testrepository
31
+.venv
32
+
33
+# Translations
34
+*.mo
35
+
36
+# Mr Developer
37
+.mr.developer.cfg
38
+.project
39
+.pydevproject
40
+
41
+# Complexity
42
+output/*.html
43
+output/*/index.html
44
+
45
+# Sphinx
46
+doc/build
47
+
48
+# oslo-config-generator
49
+etc/*.sample
50
+
51
+# pbr generates these
52
+AUTHORS
53
+ChangeLog
54
+
55
+# Editors
56
+*~
57
+.*.swp
58
+.*sw?
59
+
60
+# Vagrant
61
+.vagrant
62
+vagrant/Vagrantfile.custom
63
+vagrant/vagrantkey*
64
+
65
+# generated openrc
66
+openrc

+ 22
- 0
docker/rabbitmq/Dockerfile.j2 View File

@@ -0,0 +1,22 @@
1
+FROM {{ namespace }}/base-tools:{{ tag }}
2
+MAINTAINER {{ maintainer }}
3
+
4
+RUN apt-get install -y --no-install-recommends \
5
+    rabbitmq-server \
6
+    && apt-get clean
7
+
8
+RUN rm -rf /var/lib/rabbitmq/*
9
+
10
+COPY rabbitmq.config /etc/rabbitmq/
11
+COPY start.sh /usr/local/bin/start.sh
12
+COPY rabbitmq_sudoers /etc/sudoers.d/rabbitmq_sudoers
13
+RUN chmod 755 /usr/local/bin/start.sh \
14
+    && chmod 750 /etc/sudoers.d \
15
+    && chmod 440 /etc/sudoers.d/rabbitmq_sudoers \
16
+    && usermod -a -G microservices rabbitmq
17
+
18
+ENV RABBITMQ_CLUSTER_COOKIE "password"
19
+
20
+USER rabbitmq
21
+
22
+CMD ["start.sh"]

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

@@ -0,0 +1,11 @@
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

+ 1
- 0
docker/rabbitmq/rabbitmq_sudoers View File

@@ -0,0 +1 @@
1
+%microservices ALL=(root) NOPASSWD: /usr/bin/chown -R rabbitmq\: /var/lib/rabbitmq, /bin/chown -R rabbitmq\: /var/lib/rabbitmq, /bin/chown -R rabbitmq\: /etc/rabbitmq

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

@@ -0,0 +1,15 @@
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

+ 10
- 0
tools/run-check-docker-syntax.sh View File

@@ -0,0 +1,10 @@
1
+#!/bin/bash
2
+
3
+### Temp docker syntax checker script. Doesnt really check something...
4
+set -e
5
+for file in $(find . -name 'Dockerfile.j2')
6
+do
7
+    fgrep -q FROM $file
8
+    fgrep -q MAINTAINER $file
9
+    fgrep -q RUN $file
10
+done

+ 17
- 0
tox.ini View File

@@ -0,0 +1,17 @@
1
+[tox]
2
+minversion = 1.6
3
+envlist = py34,py27,pypy,pep8
4
+skipsdist = True
5
+
6
+[testenv:linters]
7
+commands =
8
+    {toxinidir}/tools/run-check-docker-syntax.sh
9
+
10
+[testenv:pep8]
11
+commands =
12
+    {toxinidir}/tools/run-check-docker-syntax.sh
13
+
14
+[testenv:bashate]
15
+commands =
16
+    {toxinidir}/tools/run-check-docker-syntax.sh
17
+

Loading…
Cancel
Save