summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorProskurin Kirill <kproskurin@mirantis.com>2016-05-10 18:40:43 +0300
committerProskurin Kirill <kproskurin@mirantis.com>2016-05-13 11:02:22 +0000
commit04823bd45b4eb67af6439ada3935416628531e50 (patch)
treed0308ec33f1d04f3cce0f63f198d7573dedeba5e
parentf9e0313cab9fc08af4a7b1c5ee823d2f7fc9ba17 (diff)
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
-rw-r--r--.gitignore66
-rw-r--r--docker/rabbitmq/Dockerfile.j222
-rw-r--r--docker/rabbitmq/rabbitmq.config11
-rw-r--r--docker/rabbitmq/rabbitmq_sudoers1
-rw-r--r--docker/rabbitmq/start.sh15
-rwxr-xr-xtools/run-check-docker-syntax.sh10
-rw-r--r--tox.ini17
7 files changed, 142 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3683e58
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,66 @@
1*.py[cod]
2
3# C extensions
4*.so
5
6# Packages
7*.egg
8*.egg-info
9dist
10build
11.eggs
12eggs
13parts
14bin
15var
16sdist
17develop-eggs
18.installed.cfg
19lib
20lib64
21
22# Installer logs
23pip-log.txt
24
25# Unit test / coverage reports
26.coverage
27cover
28.tox
29nosetests.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
42output/*.html
43output/*/index.html
44
45# Sphinx
46doc/build
47
48# oslo-config-generator
49etc/*.sample
50
51# pbr generates these
52AUTHORS
53ChangeLog
54
55# Editors
56*~
57.*.swp
58.*sw?
59
60# Vagrant
61.vagrant
62vagrant/Vagrantfile.custom
63vagrant/vagrantkey*
64
65# generated openrc
66openrc
diff --git a/docker/rabbitmq/Dockerfile.j2 b/docker/rabbitmq/Dockerfile.j2
new file mode 100644
index 0000000..907ce08
--- /dev/null
+++ b/docker/rabbitmq/Dockerfile.j2
@@ -0,0 +1,22 @@
1FROM {{ namespace }}/base-tools:{{ tag }}
2MAINTAINER {{ maintainer }}
3
4RUN apt-get install -y --no-install-recommends \
5 rabbitmq-server \
6 && apt-get clean
7
8RUN rm -rf /var/lib/rabbitmq/*
9
10COPY rabbitmq.config /etc/rabbitmq/
11COPY start.sh /usr/local/bin/start.sh
12COPY rabbitmq_sudoers /etc/sudoers.d/rabbitmq_sudoers
13RUN 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
18ENV RABBITMQ_CLUSTER_COOKIE "password"
19
20USER rabbitmq
21
22CMD ["start.sh"]
diff --git a/docker/rabbitmq/rabbitmq.config b/docker/rabbitmq/rabbitmq.config
new file mode 100644
index 0000000..c9d2228
--- /dev/null
+++ b/docker/rabbitmq/rabbitmq.config
@@ -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
diff --git a/docker/rabbitmq/rabbitmq_sudoers b/docker/rabbitmq/rabbitmq_sudoers
new file mode 100644
index 0000000..0891538
--- /dev/null
+++ b/docker/rabbitmq/rabbitmq_sudoers
@@ -0,0 +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
diff --git a/docker/rabbitmq/start.sh b/docker/rabbitmq/start.sh
new file mode 100644
index 0000000..f234ebd
--- /dev/null
+++ b/docker/rabbitmq/start.sh
@@ -0,0 +1,15 @@
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/tools/run-check-docker-syntax.sh b/tools/run-check-docker-syntax.sh
new file mode 100755
index 0000000..82d609e
--- /dev/null
+++ b/tools/run-check-docker-syntax.sh
@@ -0,0 +1,10 @@
1#!/bin/bash
2
3### Temp docker syntax checker script. Doesnt really check something...
4set -e
5for file in $(find . -name 'Dockerfile.j2')
6do
7 fgrep -q FROM $file
8 fgrep -q MAINTAINER $file
9 fgrep -q RUN $file
10done
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..4e6bef6
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,17 @@
1[tox]
2minversion = 1.6
3envlist = py34,py27,pypy,pep8
4skipsdist = True
5
6[testenv:linters]
7commands =
8 {toxinidir}/tools/run-check-docker-syntax.sh
9
10[testenv:pep8]
11commands =
12 {toxinidir}/tools/run-check-docker-syntax.sh
13
14[testenv:bashate]
15commands =
16 {toxinidir}/tools/run-check-docker-syntax.sh
17