seperate redis and etherpad

This commit is contained in:
chandi 2020-04-09 15:43:58 +02:00
parent 2ba82afaa1
commit 053e98ae72
9 changed files with 91 additions and 67 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
ETHERPAD_API_KEY=9xLdxQJ8XoTUy3q7W4ZgpvKYqX16yqirdESk9i54FVm6PiJ1paRd8JOI1MT4pywm

View File

@ -7,72 +7,69 @@ ENV container docker
# just to speed up development, TODO: remove # just to speed up development, TODO: remove
COPY sources.list /etc/apt/sources.list COPY sources.list /etc/apt/sources.list
RUN apt-get update && apt-get install -y netcat RUN apt-get update && apt-get install -y software-properties-common language-pack-en
# -- Install utils
RUN apt-get update && apt-get install -y wget apt-transport-https curl
RUN apt-get install -y language-pack-en
RUN update-locale LANG=en_US.UTF-8 RUN update-locale LANG=en_US.UTF-8
# -- Install system utils
RUN apt-get update
RUN apt-get install -y --no-install-recommends apt-utils
RUN apt-get install -y wget software-properties-common
# -- Install yq
RUN LC_CTYPE=C.UTF-8 add-apt-repository ppa:rmescandon/yq RUN LC_CTYPE=C.UTF-8 add-apt-repository ppa:rmescandon/yq
RUN apt update RUN apt-get install -y --no-install-recommends apt-utils
RUN LC_CTYPE=C.UTF-8 apt install yq -y RUN apt-get -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install grub-pc update-notifier-common
# -- Setup tomcat7 to run under docker
RUN apt-get install -y \
haveged \
net-tools \
supervisor \
sudo \
tomcat7
RUN sed -i 's|securerandom.source=file:/dev/random|securerandom.source=file:/dev/urandom|g' /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security
# -- Modify systemd to be able to run inside container
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y systemd && apt-get install -y systemd
# -- Install Dependencies # -- Install Dependencies
RUN apt-get install -y mlocate strace iputils-ping telnet tcpdump vim htop RUN apt-get install -y wget apt-transport-https curl mlocate strace iputils-ping telnet tcpdump vim htop \
tidy libreoffice sudo netcat-openbsd net-tools penjdk-8-jre perl build-essential \
ruby rake unzip xmlstarlet rsync tomcat7 yq equivs
RUN apt-get install -y curl apt-transport-https software-properties-common tidy libreoffice openjdk-8-jre perl build-essential ruby redis-server rake unzip tomcat7 xmlstarlet rsync python3
# bbb repo & packages
RUN LC_CTYPE=C.UTF-8 add-apt-repository ppa:bigbluebutton/support RUN LC_CTYPE=C.UTF-8 add-apt-repository ppa:bigbluebutton/support
RUN sh -c 'wget https://ubuntu.bigbluebutton.org/repo/bigbluebutton.asc -O- | apt-key add -' \
&& sh -c 'echo "deb https://ubuntu.bigbluebutton.org/xenial-220 bigbluebutton-xenial main" > /etc/apt/sources.list.d/bigbluebutton.list'
RUN sh -c 'wget -qO - https://www.mongodb.org/static/pgp/server-3.4.asc | sudo apt-key add -' \
&& sh -c 'echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list'
# nodejs # nodejs
RUN sh -c "curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -" RUN sh -c "curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -"
RUN sh -c 'echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections' # create dummy packages to satisfy dependencies
RUN equivs-control redis-server.control \
&& sed -i 's/<package name; defaults to equivs-dummy>/redis-server/g' redis-server.control \
&& equivs-build redis-server.control \
&& equivs-control nginx.control \
&& sed -i 's/<package name; defaults to equivs-dummy>/nginx/g' nginx.control \
&& equivs-build nginx.control \
&& equivs-control bbb-etherpad.control \
&& sed -i 's/<package name; defaults to equivs-dummy>/bbb-etherpad/g' bbb-etherpad.control \
&& equivs-build bbb-etherpad.control \
&& dpkg -i /*.deb \
&& rm /*.deb
# bbb repo & packages # -- create nginx service (in order to enable it - to avoid the "nginx.service is not active" error)
RUN sh -c 'wget https://ubuntu.bigbluebutton.org/repo/bigbluebutton.asc -O- | apt-key add -' \ RUN rm -f /etc/systemd/system/nginx.service
&& sh -c 'echo "deb https://ubuntu.bigbluebutton.org/xenial-220 bigbluebutton-xenial main" > /etc/apt/sources.list.d/bigbluebutton.list' \ COPY dummy/dummy.service /etc/systemd/system/nginx.service
&& apt update \ COPY dummy/dummy.service /etc/systemd/system/redis.service
&& apt install -y bigbluebutton netcat-openbsd bbb-web bbb-client bbb-playback-presentation bbb-freeswitch-core bbb-webrtc-sfu bbb-fsesl-akka bbb-apps-akka bbb-transcode-akka openssl bbb-apps bbb-apps-sip bbb-apps-video bbb-apps-screenshare bbb-apps-video-broadcast COPY dummy/dummy.service /etc/systemd/system/redis-server.service
RUN apt-get install -y nodejs
# bbb-html5 installer expects this file
RUN mkdir /usr/share/etherpad-lite && sh -c 'echo invalid > /usr/share/etherpad-lite/APIKEY.txt'
RUN sh -c 'wget -qO - https://www.mongodb.org/static/pgp/server-3.4.asc | sudo apt-key add -' \ RUN touch /etc/init.d/nginx && chmod +x /etc/init.d/nginx
&& sh -c 'echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list' \ RUN apt-get install -y bbb-web bbb-record-core bbb-playback-presentation bbb-freeswitch-core \
&& apt-get update \ bbb-fsesl-akka bbb-apps-akka bbb-transcode-akka bbb-apps bbb-apps-sip \
&& apt-get install -y haveged mongodb-org bbb-apps-video bbb-apps-screenshare bbb-apps-video-broadcast
RUN apt-get -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install grub-pc update-notifier-common RUN mkdir -p /etc/nginx/sites-enabled
RUN apt-get install -y bbb-html5 bbb-config bbb-client bbb-webrtc-sfu
RUN apt-get install -y mongodb-org
RUN apt-get install -y bbb-demo
RUN apt-get install -y bbb-etherpad bbb-html5 bbb-demo
# -- Install nginx (in order to enable it - to avoid the "nginx.service is not active" error)
RUN apt-get install -y nginx
RUN systemctl enable nginx
# -- Disable unneeded services # -- Disable unneeded services
RUN systemctl disable systemd-journal-flush RUN systemctl disable systemd-journal-flush
RUN systemctl disable systemd-update-utmp.service RUN systemctl disable systemd-update-utmp.service
@ -80,7 +77,6 @@ RUN systemctl disable systemd-update-utmp.service
# -- Finish startup # -- Finish startup
# Add a number there to force update of files on build # Add a number there to force update of files on build
RUN echo "Finishing ... @13" RUN echo "Finishing ... @13"
RUN mkdir /opt/docker-bbb/
RUN useradd bbb --uid 1000 -s /bin/bash RUN useradd bbb --uid 1000 -s /bin/bash
RUN mkdir /home/bbb RUN mkdir /home/bbb
@ -91,7 +87,7 @@ RUN sh -c 'echo "bbb:bbb" | chpasswd'
COPY mod/tomcat7 /etc/init.d/tomcat7 COPY mod/tomcat7 /etc/init.d/tomcat7
RUN chmod +x /etc/init.d/tomcat7 RUN chmod +x /etc/init.d/tomcat7
COPY setup.sh /opt/docker-bbb/setup.sh COPY setup.sh /opt/setup.sh
ENTRYPOINT ["/bin/systemd", "--system", "--unit=multi-user.target"] ENTRYPOINT ["/bin/systemd", "--system", "--unit=multi-user.target"]
CMD [] CMD []

View File

@ -1,6 +1,4 @@
version: '2' version: '3.6'
services: services:
bbb: bbb:
@ -26,7 +24,6 @@ services:
- ./mod/web/bigbluebutton.properties:/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties - ./mod/web/bigbluebutton.properties:/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties
- ./mod/kurento/WebRtcEndpoint.conf.ini:/etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini - ./mod/kurento/WebRtcEndpoint.conf.ini:/etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini
- ./mod/bbb-webrtc-sfu/config.yml:/usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml - ./mod/bbb-webrtc-sfu/config.yml:/usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml
- ./mod/pad/settings.json:/usr/share/etherpad-lite/settings.json
network_mode: host network_mode: host
nginx: nginx:
@ -41,12 +38,29 @@ services:
extra_hosts: extra_hosts:
- "host.docker.internal:10.7.7.1" - "host.docker.internal:10.7.7.1"
etherpad:
image: etherpad/etherpad:1.8.0
environment:
ETHERPAD_API_KEY: ${ETHERPAD_API_KEY}
volumes:
- ./mod/pad/settings.json:/opt/etherpad-lite/settings.json
- ./mod/pad/entrypoint.sh:/entrypoint.sh
entrypoint: /entrypoint.sh
networks:
bluenet:
ipv4_address: 10.7.7.4
redis:
image: redis:3.0-alpine
ports:
- "127.0.0.1:6379:6379" # TODO: remove as soon as we updated all redis host references
networks:
bluenet:
ipv4_address: 10.7.7.5
networks: networks:
bluenet: bluenet:
driver: bridge
ipam: ipam:
config: driver: default
- subnet: 10.7.7.0/24 config:
gateway: 10.7.7.1 - subnet: "10.7.7.0/24"

9
dummy/dummy.service Normal file
View File

@ -0,0 +1,9 @@
[Unit]
Description=dummy
[Service]
ExecStart=/bin/sleep 30d
ExecReload=/bin/echo reload
[Install]
WantedBy=multi-user.target

View File

@ -22,7 +22,7 @@ video-transposing-ceiling: 50
audio-transposing-ceiling: 100 audio-transposing-ceiling: 100
localIpAddress: 172.17.0.2 localIpAddress: 172.17.0.2
acceptSelfSignedCertificate: false acceptSelfSignedCertificate: false
redisHost: 127.0.0.1 redisHost: 10.7.7.5
redisPort: "6379" redisPort: "6379"
# Uncomment to set a password if Redis requires auth. # Uncomment to set a password if Redis requires auth.
# redisPassword: foobared # redisPassword: foobared

View File

@ -315,10 +315,10 @@ private:
etherpad: etherpad:
apikey: 9xLdxQJ8XoTUy3q7W4ZgpvKYqX16yqirdESk9i54FVm6PiJ1paRd8JOI1MT4pywm apikey: 9xLdxQJ8XoTUy3q7W4ZgpvKYqX16yqirdESk9i54FVm6PiJ1paRd8JOI1MT4pywm
version: 1.2.13 version: 1.2.13
host: 10.7.7.1 host: 10.7.7.4
port: 9001 port: 9001
redis: redis:
host: 127.0.0.1 host: 10.7.7.5
port: '6379' port: '6379'
timeout: 5000 timeout: 5000
password: null password: null

View File

@ -2,7 +2,7 @@
location ~ "^\/pad\/p\/(\w+)$" { location ~ "^\/pad\/p\/(\w+)$" {
rewrite /pad/(.*) /$1 break; rewrite /pad/(.*) /$1 break;
rewrite ^/pad$ /pad/ permanent; rewrite ^/pad$ /pad/ permanent;
proxy_pass http://host.docker.internal:9001; proxy_pass http://etherpad:9001;
proxy_pass_header Server; proxy_pass_header Server;
proxy_redirect / /pad; proxy_redirect / /pad;
proxy_set_header Host $host; proxy_set_header Host $host;
@ -15,7 +15,7 @@ location ~ "^\/pad\/p\/(\w+)$" {
location /pad { location /pad {
rewrite /pad/(.*) /$1 break; rewrite /pad/(.*) /$1 break;
rewrite ^/pad$ /pad/ permanent; rewrite ^/pad$ /pad/ permanent;
proxy_pass http://host.docker.internal:9001/; proxy_pass http://etherpad:9001/;
proxy_pass_header Server; proxy_pass_header Server;
proxy_redirect / /pad/; proxy_redirect / /pad/;
proxy_set_header Host $host; proxy_set_header Host $host;
@ -24,7 +24,7 @@ location /pad {
location /pad/socket.io { location /pad/socket.io {
rewrite /pad/socket.io/(.*) /socket.io/$1 break; rewrite /pad/socket.io/(.*) /socket.io/$1 break;
proxy_pass http://host.docker.internal:9001/; proxy_pass http://etherpad:9001/;
proxy_redirect / /pad/; proxy_redirect / /pad/;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_buffering off; proxy_buffering off;
@ -40,7 +40,7 @@ location /pad/socket.io {
location /static { location /static {
rewrite /static/(.*) /static/$1 break; rewrite /static/(.*) /static/$1 break;
proxy_pass http://host.docker.internal:9001/; proxy_pass http://etherpad:9001/;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_buffering off; proxy_buffering off;
} }

4
mod/pad/entrypoint.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
echo $ETHERPAD_API_KEY > /tmp/apikey
export NODE_ENV=production
node /opt/etherpad-lite/node_modules/ep_etherpad-lite/node/server.js --apikey /tmp/apikey

View File

@ -85,7 +85,7 @@
/* /*
* IP and port which etherpad should bind at * IP and port which etherpad should bind at
*/ */
"ip": "10.7.7.1", "ip": "0.0.0.0",
"port": 9001, "port": 9001,
/* /*
@ -131,7 +131,7 @@
"dbType": "redis", "dbType": "redis",
"dbSettings": { "dbSettings": {
"host": "localhost", "host": "redis",
"port": 6379 "port": 6379
}, },
@ -432,7 +432,7 @@
*/ */
"ep_redis_publisher": { "ep_redis_publisher": {
"host": "localhost", "host": "redis",
"port": 6379 "port": 6379
}, },