diff --git a/.env b/.env new file mode 100644 index 0000000..f9ecbe9 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +ETHERPAD_API_KEY=9xLdxQJ8XoTUy3q7W4ZgpvKYqX16yqirdESk9i54FVm6PiJ1paRd8JOI1MT4pywm \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 235e7a1..7089cfe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,72 +7,69 @@ ENV container docker # just to speed up development, TODO: remove COPY sources.list /etc/apt/sources.list -RUN apt-get update && apt-get install -y netcat - -# -- Install utils -RUN apt-get update && apt-get install -y wget apt-transport-https curl - -RUN apt-get install -y language-pack-en +RUN apt-get update && apt-get install -y software-properties-common language-pack-en 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 apt update -RUN LC_CTYPE=C.UTF-8 apt install yq -y - -# -- 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 install -y --no-install-recommends apt-utils +RUN apt-get -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install grub-pc update-notifier-common RUN apt-get update \ && apt-get install -y systemd + # -- 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 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 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//redis-server/g' redis-server.control \ + && equivs-build redis-server.control \ + && equivs-control nginx.control \ + && sed -i 's//nginx/g' nginx.control \ + && equivs-build nginx.control \ + && equivs-control bbb-etherpad.control \ + && sed -i 's//bbb-etherpad/g' bbb-etherpad.control \ + && equivs-build bbb-etherpad.control \ + && dpkg -i /*.deb \ + && rm /*.deb -# bbb repo & packages -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' \ - && apt update \ - && 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 +# -- create nginx service (in order to enable it - to avoid the "nginx.service is not active" error) +RUN rm -f /etc/systemd/system/nginx.service +COPY dummy/dummy.service /etc/systemd/system/nginx.service +COPY dummy/dummy.service /etc/systemd/system/redis.service +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 -' \ - && 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' \ - && apt-get update \ - && apt-get install -y haveged mongodb-org +RUN touch /etc/init.d/nginx && chmod +x /etc/init.d/nginx +RUN apt-get install -y bbb-web bbb-record-core bbb-playback-presentation bbb-freeswitch-core \ + bbb-fsesl-akka bbb-apps-akka bbb-transcode-akka bbb-apps bbb-apps-sip \ + 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 RUN systemctl disable systemd-journal-flush RUN systemctl disable systemd-update-utmp.service @@ -80,7 +77,6 @@ RUN systemctl disable systemd-update-utmp.service # -- Finish startup # Add a number there to force update of files on build RUN echo "Finishing ... @13" -RUN mkdir /opt/docker-bbb/ RUN useradd bbb --uid 1000 -s /bin/bash RUN mkdir /home/bbb @@ -91,7 +87,7 @@ RUN sh -c 'echo "bbb:bbb" | chpasswd' COPY mod/tomcat7 /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"] CMD [] diff --git a/docker-compose.yml b/docker-compose.yml index 3a1f4ed..56811a3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,4 @@ -version: '2' - - +version: '3.6' services: bbb: @@ -26,7 +24,6 @@ services: - ./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/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 nginx: @@ -41,12 +38,29 @@ services: extra_hosts: - "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: bluenet: - driver: bridge ipam: - config: - - subnet: 10.7.7.0/24 - gateway: 10.7.7.1 \ No newline at end of file + driver: default + config: + - subnet: "10.7.7.0/24" \ No newline at end of file diff --git a/dummy/dummy.service b/dummy/dummy.service new file mode 100644 index 0000000..72d0825 --- /dev/null +++ b/dummy/dummy.service @@ -0,0 +1,9 @@ +[Unit] +Description=dummy + +[Service] +ExecStart=/bin/sleep 30d +ExecReload=/bin/echo reload + +[Install] +WantedBy=multi-user.target diff --git a/mod/bbb-webrtc-sfu/config.yml b/mod/bbb-webrtc-sfu/config.yml index 7afe050..af3c271 100644 --- a/mod/bbb-webrtc-sfu/config.yml +++ b/mod/bbb-webrtc-sfu/config.yml @@ -22,7 +22,7 @@ video-transposing-ceiling: 50 audio-transposing-ceiling: 100 localIpAddress: 172.17.0.2 acceptSelfSignedCertificate: false -redisHost: 127.0.0.1 +redisHost: 10.7.7.5 redisPort: "6379" # Uncomment to set a password if Redis requires auth. # redisPassword: foobared diff --git a/mod/html5/config.yml b/mod/html5/config.yml index 6aa8011..53d0fb3 100644 --- a/mod/html5/config.yml +++ b/mod/html5/config.yml @@ -315,10 +315,10 @@ private: etherpad: apikey: 9xLdxQJ8XoTUy3q7W4ZgpvKYqX16yqirdESk9i54FVm6PiJ1paRd8JOI1MT4pywm version: 1.2.13 - host: 10.7.7.1 + host: 10.7.7.4 port: 9001 redis: - host: 127.0.0.1 + host: 10.7.7.5 port: '6379' timeout: 5000 password: null diff --git a/mod/nginx/bbb/notes.nginx b/mod/nginx/bbb/notes.nginx index 0d0c172..6a1b0ce 100644 --- a/mod/nginx/bbb/notes.nginx +++ b/mod/nginx/bbb/notes.nginx @@ -2,7 +2,7 @@ location ~ "^\/pad\/p\/(\w+)$" { rewrite /pad/(.*) /$1 break; rewrite ^/pad$ /pad/ permanent; - proxy_pass http://host.docker.internal:9001; + proxy_pass http://etherpad:9001; proxy_pass_header Server; proxy_redirect / /pad; proxy_set_header Host $host; @@ -15,7 +15,7 @@ location ~ "^\/pad\/p\/(\w+)$" { location /pad { rewrite /pad/(.*) /$1 break; rewrite ^/pad$ /pad/ permanent; - proxy_pass http://host.docker.internal:9001/; + proxy_pass http://etherpad:9001/; proxy_pass_header Server; proxy_redirect / /pad/; proxy_set_header Host $host; @@ -24,7 +24,7 @@ location /pad { location /pad/socket.io { rewrite /pad/socket.io/(.*) /socket.io/$1 break; - proxy_pass http://host.docker.internal:9001/; + proxy_pass http://etherpad:9001/; proxy_redirect / /pad/; proxy_set_header Host $host; proxy_buffering off; @@ -40,7 +40,7 @@ location /pad/socket.io { location /static { rewrite /static/(.*) /static/$1 break; - proxy_pass http://host.docker.internal:9001/; + proxy_pass http://etherpad:9001/; proxy_set_header Host $host; proxy_buffering off; } diff --git a/mod/pad/entrypoint.sh b/mod/pad/entrypoint.sh new file mode 100755 index 0000000..21012d4 --- /dev/null +++ b/mod/pad/entrypoint.sh @@ -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 \ No newline at end of file diff --git a/mod/pad/settings.json b/mod/pad/settings.json index f7c9ebc..1261824 100644 --- a/mod/pad/settings.json +++ b/mod/pad/settings.json @@ -85,7 +85,7 @@ /* * IP and port which etherpad should bind at */ - "ip": "10.7.7.1", + "ip": "0.0.0.0", "port": 9001, /* @@ -131,7 +131,7 @@ "dbType": "redis", "dbSettings": { - "host": "localhost", + "host": "redis", "port": 6379 }, @@ -432,7 +432,7 @@ */ "ep_redis_publisher": { - "host": "localhost", + "host": "redis", "port": 6379 },