Mercurial > sat_docs
annotate docker/prosody/Dockerfile @ 98:349cbfea2596
docker (prosody): restored logs in /var/log + info logs to console
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 26 Feb 2016 16:09:01 +0100 |
parents | 30f3f83d6959 |
children | b69056368901 |
rev | line source |
---|---|
21
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 ############################################################### |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # # |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 # Salut à Toi/Prosody # |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # This Dockerfile build a Prosody version prepared for SàT # |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 # Salut à Toi is a multi-frontends multi-purposes XMPP client # |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 # # |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 ############################################################### |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 |
85
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
9 FROM salutatoi/sat_pubsub:latest |
21
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 MAINTAINER Goffi <goffi@goffi.org> |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 ######## |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # BASE # |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 ######## |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
80 | 17 RUN apt-get install -y --no-install-recommends lsb-release |
18 # we add prosody repository and key | |
19 RUN echo deb http://packages.prosody.im/debian $(lsb_release -sc) main > /etc/apt/sources.list.d/prosody.list | |
20 RUN python -c 'import urllib2;import subprocess as s;s.Popen(["apt-key","add","-"], stdin=s.PIPE).communicate(urllib2.urlopen("https://prosody.im/files/prosody-debian-packages.key").read())' | |
21 RUN apt-get update | |
22 # and install prosody and apg (to generate passwords) | |
23 RUN apt-get install -y apg prosody-0.10 | |
21
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 RUN apt-get clean |
85
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
25 # prosody use need to access (and write) certificates |
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
26 RUN adduser prosody tls-cert |
21
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 |
80 | 28 ################### |
29 # PROSODY MODULES # | |
30 ################### | |
21
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 |
80 | 32 WORKDIR /tmp |
33 RUN hg clone https://hg.prosody.im/prosody-modules/ prosody-modules | |
34 WORKDIR prosody-modules | |
35 RUN for mod in privilege delegation ipcheck http_upload;do cp mod_$mod/mod_$mod.lua /usr/lib/prosody/modules;done | |
36 WORKDIR /tmp | |
37 RUN rm -rf prosody-modules | |
21
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 |
80 | 39 ################# |
40 # CONFIGURATION # | |
41 ################# | |
21
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 |
80 | 43 WORKDIR /etc/prosody |
85
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
44 RUN mkdir prosody_sat_cfg |
80 | 45 # we keep up-to-date configuration for this image on the repository |
85
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
46 RUN python -c 'import urllib2;f=open("prosody_sat_cfg/prosody.cfg.lua","w");f.write(urllib2.urlopen("https://repos.goffi.org/sat_docs/raw-file/tip/docker/prosody/prosody.cfg.lua").read())' |
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
47 RUN ln -fs prosody_sat_cfg/prosody.cfg.lua prosody.cfg.lua |
21
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 ############### |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 # CERTIFICATE # |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 ############### |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 |
85
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
53 # We want to use the certificates in /usr/share/sat/certificates |
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
54 # and we don't want any certificate in the image, |
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
55 # they'll be generated at launch or mounted in container |
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
56 RUN rm -rf /etc/localhost.key /etc/prosody/certs/* |
21
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
57 |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 ############################ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
59 # AUTOMATIC CONFIGURATION # |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 ############################ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 # this script allow to call prosodyctl and get configuration variables from linked containers |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 RUN echo '#!/usr/bin/env python2\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 import subprocess, SimpleXMLRPCServer, os\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 def prosodyctl(command, profile, pwd):\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 process = subprocess.Popen(["prosodyctl", command, profile], stdin=subprocess.PIPE)\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 if pwd:\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 process.communicate("%s\\n%s"%(pwd,pwd))\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 return process.wait()\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 def getenv(variable):\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
71 assert variable in ("SAT_PUBSUB_SECRET","SAT_SALUT_SECRET","DOMAIN")\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
72 return os.getenv(variable)\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 server = SimpleXMLRPCServer.SimpleXMLRPCServer(("0.0.0.0", 9999))\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 server.register_function(prosodyctl, "prosodyctl")\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 server.register_function(getenv, "getenv")\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
76 server.serve_forever()' > /usr/local/bin/container_server && chmod 0555 /usr/local/bin/container_server |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
77 |
85
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
78 # the following script is used to automatically generate passwords for components and certificate |
21
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
79 RUN echo '#!/bin/sh\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
80 export SAT_PUBSUB_SECRET=$(apg -n 1)\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
81 export SAT_SALUT_SECRET=$(apg -n 1)\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
82 if [ -z $DOMAIN ]; then\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
83 export DOMAIN="libervia.int"\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 fi\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
85 container_server&\n\ |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 echo "domain used: $DOMAIN\n"\n\ |
85
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
87 if [ ! -f "/usr/share/sat/certificates/libervia.key" -o ! -f "/usr/share/sat/certificates/libervia.crt" ]; then\n\ |
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
88 echo "No certificate found, we generate one"\n\ |
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
89 openssl req -new -x509 -days 1825 -nodes -out "/usr/share/sat/certificates/libervia.crt"\ |
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
90 -newkey rsa:4096 -keyout "/usr/share/sat/certificates/libervia.key" -subj "/C=AU/CN=$DOMAIN"\n\ |
bcba1966e6db
docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents:
80
diff
changeset
|
91 fi\n\ |
21
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
92 /usr/bin/prosody $@' > /usr/local/bin/prosody && chmod +x /usr/local/bin/prosody |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
93 |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
94 ######### |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 # PORTS # |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
96 ######### |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
98 # client to server (C2S) |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 EXPOSE 5222 |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 # server to server (S2S) |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 EXPOSE 5269 |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 |
91
30f3f83d6959
docker (prosody, libervia_cont): expose HTTP upload ports in Prosody image
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
104 # HTTP upload |
30f3f83d6959
docker (prosody, libervia_cont): expose HTTP upload ports in Prosody image
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
105 EXPOSE 5280 |
30f3f83d6959
docker (prosody, libervia_cont): expose HTTP upload ports in Prosody image
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
106 |
30f3f83d6959
docker (prosody, libervia_cont): expose HTTP upload ports in Prosody image
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
107 # HTTP upload (HTTPS) |
30f3f83d6959
docker (prosody, libervia_cont): expose HTTP upload ports in Prosody image
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
108 EXPOSE 5281 |
30f3f83d6959
docker (prosody, libervia_cont): expose HTTP upload ports in Prosody image
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
109 |
21
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
110 ########## |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 # LAUNCH # |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 ########## |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 # prosody need to access /var/run to write it's pid |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 RUN mkdir -p /var/run/prosody; chown prosody:adm /var/run/prosody |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
117 USER prosody |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
118 |
0e78c8a4626e
Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
119 ENTRYPOINT ["prosody"] |