Mercurial > sat_docs
comparison docker/prosody/Dockerfile @ 80:686a8c982c3f
docker: updated Dockerfiles:
- use HTTPS URLs instead of HTTP
- prosody image know use prosody Debian repository instead of Debian Jessie version, prosody 0.10 is used
- prosody configuration is now in prosody directory next to Dockerfile, instead of using difficult to maintain sed calls
- community modules are downloaded from mercurial, and only needed ones are kept
- no more remote-roster hack \o/
- pubsub component is not at pubsub.[domain] (was sat-pubsub before)
- SàT media are gotten from hg instead of ftp, so they are up-to-date with SàT version
- libervia image now use pip for txJSON-RPC
- fixed now needed jinja2 installation
- fixed libervia/admin accounts auto-creation script
- fixed uid/gid for prosody in data image
- removed not needed anymore nox option in base image
- added python-pip in base image
- docker images now work with current dev version (0.6.0D)
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 12 Feb 2016 20:24:24 +0100 |
parents | 0e78c8a4626e |
children | bcba1966e6db |
comparison
equal
deleted
inserted
replaced
79:694fd34ff0b3 | 80:686a8c982c3f |
---|---|
12 | 12 |
13 ######## | 13 ######## |
14 # BASE # | 14 # BASE # |
15 ######## | 15 ######## |
16 | 16 |
17 RUN apt-get install -y apg prosody | 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 | |
18 RUN apt-get clean | 24 RUN apt-get clean |
19 | 25 |
20 ###################### | 26 ################### |
21 # REMOTE ROSTER HACK # | 27 # PROSODY MODULES # |
22 ###################### | 28 ################### |
23 | 29 |
24 # This dirty hack is used temporarily in SàT to have nice features like fine permissions tuning | 30 WORKDIR /tmp |
25 # see http://www.goffi.org/post/2012/06/24/Fine-access-tuning-for-PubSub | 31 RUN hg clone https://hg.prosody.im/prosody-modules/ prosody-modules |
26 # A proper way is being working on, with new XEPs | 32 WORKDIR prosody-modules |
33 RUN for mod in privilege delegation ipcheck http_upload;do cp mod_$mod/mod_$mod.lua /usr/lib/prosody/modules;done | |
34 WORKDIR /tmp | |
35 RUN rm -rf prosody-modules | |
27 | 36 |
28 WORKDIR /usr/lib/prosody/modules | 37 ################# |
29 # wget/curl are not installed, so we use python | 38 # CONFIGURATION # |
30 RUN python -c 'import urllib2;f=open("mod_remote_roster.lua","w");f.write(urllib2.urlopen("http://paste.debian.net/download/121248").read())' | 39 ################# |
40 | |
31 WORKDIR /etc/prosody | 41 WORKDIR /etc/prosody |
32 # the hacked module must be activated | 42 # we keep up-to-date configuration for this image on the repository |
33 RUN sed -i 's/modules_enabled = {/\0\n\t-- SàT specific\n\t\t"remote_roster";/' prosody.cfg.lua | 43 RUN python -c 'import urllib2;f=open("prosody.cfg.lua","w");f.write(urllib2.urlopen("https://repos.goffi.org/sat_docs/raw-file/tip/docker/prosody/prosody.cfg.lua").read())' |
34 | |
35 ###################### | |
36 # MISC CONFIGURATION # | |
37 ###################### | |
38 | |
39 # we want to run foreground | |
40 RUN sed -i 's/daemonize = true;/daemonize = false;/' prosody.cfg.lua | |
41 | |
42 # we listen the world for components (but we do *NOT* expose the port ! It's just for linked containers) | |
43 RUN sed -i 's/^----------- Virtual hosts -----------/component_interface="0.0.0.0"\n\n\0/' prosody.cfg.lua | |
44 | |
45 # we don't want to allow self registering, this is managed by a SàT plugin | |
46 RUN sed -i 's/"register"/--\0/' prosody.cfg.lua | |
47 | |
48 # announce is usefull on a Libervia instance | |
49 RUN sed -i 's/--"announce"/"announce"/' prosody.cfg.lua | |
50 | |
51 # we use environment variable to get the domain | |
52 RUN sed -i 's/^admins =.*$/\nlocal domain = os.getenv("DOMAIN") or "libervia.int"\n\0/' prosody.cfg.lua | |
53 | |
54 # default admin is admin@DOMAIN | |
55 RUN sed -i 's/admins = { }/admins = { "admin@"..(domain) }/' prosody.cfg.lua | |
56 | |
57 # we can now set our virtualhost | |
58 RUN sed -i 's/^------ Components ------/VirtualHost (domain)\n\n\0/' prosody.cfg.lua | |
59 | |
60 # we want default, unsplitted logs | |
61 RUN python -c 'import re;f=open("prosody.cfg.lua","r+");buf=re.sub(r"^log =.*^}","",f.read(),1,re.DOTALL | re.MULTILINE);f.seek(0);f.write(buf);f.truncate()' | |
62 | 44 |
63 ############### | 45 ############### |
64 # CERTIFICATE # | 46 # CERTIFICATE # |
65 ############### | 47 ############### |
66 | 48 |
67 # We want to use the certificat in /usr/share/sat | 49 # We want to use the certificat in /usr/share/sat |
68 RUN sed -i 's%key = "/etc/prosody/certs/localhost.key";%key = "/usr/share/sat/libervia.key";%; s%certificate = "/etc/prosody/certs/localhost.crt";%certificate = "/usr/share/sat/libervia.crt";%' prosody.cfg.lua | |
69 | |
70 # but we do a link to be sure that there is a certificate | 50 # but we do a link to be sure that there is a certificate |
71 RUN ln -s /etc/prosody/certs/localhost.key /usr/share/sat/libervia.key; ln -s /etc/prosody/certs/localhost.cert /usr/share/sat/libervia.crt | 51 RUN ln -s /etc/prosody/certs/localhost.key /usr/share/sat/libervia.key; ln -s /etc/prosody/certs/localhost.crt /usr/share/sat/libervia.crt |
72 | |
73 ############## | |
74 # COMPONENTS # | |
75 ############## | |
76 | |
77 # we activate the MUC component on chat.DOMAIN | |
78 RUN sed -i 's/--Component "conference.example.com" "muc"/Component ("chat."..domain) "muc"/' prosody.cfg.lua | |
79 | |
80 # and the SOCKS5 bytestream proxy on proxy.DOMAIN | |
81 RUN sed -i 's/--Component "proxy.example.com" "proxy65"/Component ("proxy."..domain) "proxy65"/' prosody.cfg.lua | |
82 | |
83 # SàT PubSub | |
84 RUN sed -i 's/^------ Additional/Component ("sat-pubsub."..domain)\n\tcomponent_secret = os.getenv("SAT_PUBSUB_SECRET")\n\n\0/' prosody.cfg.lua | |
85 | |
86 # Salut, SàT's directory component | |
87 RUN sed -i 's/^------ Additional/Component ("salut."..domain)\n\tcomponent_secret = os.getenv("SAT_SALUT_SECRET")\n\n\0/' prosody.cfg.lua | |
88 | 52 |
89 ############################ | 53 ############################ |
90 # AUTOMATIC CONFIGURATION # | 54 # AUTOMATIC CONFIGURATION # |
91 ############################ | 55 ############################ |
92 | 56 |