├── README.md └── create_bbb.sh /README.md: -------------------------------------------------------------------------------- 1 | # docker-dev 2 | 3 | How to use Docker to setup a development environment for BigBlueButton 4 | 5 | ## Environment 6 | 7 | We're considering you are using a [Ubuntu 24.04 LTS](https://ubuntu.com/download/desktop) but other versions/distributions can work too. 8 | 9 | An internet connection is required. It can be a shared network ( no need to forward ports in your router ). 10 | 11 | ## SSL certificate 12 | 13 | Running a BigBlueButton server requires a SSL certificate. The install script will automatically generate an self-signed certificate or you can rather specify a folder which contains a previous generated certificate. 14 | 15 | 16 | ## Docker setup 17 | 18 | The next script depends on having docker available to your user, so before proceeding, run the following command (note that a computer reboot is required): 19 | 20 | ```sh 21 | sudo usermod -aG docker `whoami` 22 | sudo reboot 23 | ``` 24 | 25 | ## Container setup 26 | 27 | 1. Save (right click, save as) the creation script in home directory (`~`): [create_bbb.sh](create_bbb.sh?raw=1) 28 | 29 | 2. Add permissions to the script: 30 | ```sh 31 | chmod +x create_bbb.sh 32 | ``` 33 | 34 | 3. Run the script ( it will remove previously created dockers and create a new one): 35 | Docker **bbb 3.0** 36 | ``` 37 | ./create_bbb.sh --image=imdt/bigbluebutton:3.0.x-develop --update bbb30 38 | ``` 39 | 40 | Parameters: 41 | `./create_bbb.sh [--update] [--fork=github_user] [--fork-skip] [--domain=domain_name] [--ip=ip_address] [--image=docker_image] [--cert=certificate_dir] [--custom-script=path/script.sh] [--docker-custom-params=""] [--docker-network-params=""] {name}` 42 | - {name}: Name of the container (e.g `bbb30`) **(REQUIRED)** 43 | - --update: check for new image version `--update` 44 | - --domain: set the host domain (e.g `--domain=test`), default: `test`. BBB URL will be `https://{NAME} + {DOMAIN}` 45 | - --cert: specify the directory which contains a certificate (`fullchain.pem` and `privkey.pem`) (e.g `--cert=/tmp`) *(if absent a new certificate will be created)* 46 | - --custom-script: path of a shell script file to be executed immediately when the container is created (useful for setting some personal preferences for configs) 47 | - --ip: force container IP (e.g `--ip=172.17.0.2`) 48 | - --fork: Username in Github with bbb Fork `--fork=bigbluebutton` 49 | - --fork-skip: Skip the step to clone Bigbluebutton project 50 | - --image: Force an image different from default `--image=imdt/bigbluebutton:2.6.x-develop` 51 | - --docker-custom-params: Append a custom param to `docker run`, for instance: 52 | - mount a directory from your host into the container `--docker-custom-params="-v $HOME/bbb30/shared:/home/bigbluebutton/shared:rw"` 53 | - run docker with limited resources (8 cores) `--docker-custom-params="--cpuset-cpus=0-7"` 54 | - --docker-network-params: Override the default param if necessary, for instance to make the container use the host's IP set `--docker-network-params="--net=host"` 55 | ## Using the container 56 | 57 | ### SSH session within the container 58 | ``` 59 | ssh bbb30 60 | ``` 61 | Replace **bbb30** with the {name} param of `create_bbb.sh` 62 | 63 | 64 | ### Use `/tmp` to exchange files 65 | The directory `/tmp` is shared between the host and the container. So you can use this directory to exchange files between them. 66 | 67 | Alternatively, you can use the `--docker-custom-params` parameter to designate a different directory as the exchange location. 68 | 69 | ### Start using BigBlueButton 70 | 71 | That's all, open https://bbb30.test (or your custom `https://{name}.{domain}`) in your browser and enjoy. 72 | 73 | PS: if you see certificate error in your browser, you need to add the CA certificate in it's trusted certificates. Instructions for Chrome and Firefox can be found [here](https://github.com/bigbluebutton/docker-dev/issues/1) 74 | 75 | ## Removing an existing container 76 | ``` 77 | ./create_bbb.sh --remove {container_name} 78 | ``` 79 | 80 | or rather you can remove a BBB docker image using `docker image rm imdt/bigbluebutton:2.6.x-develop --force` 81 | 82 | 83 | --- 84 | ## BBB-Conf 85 | Link to the API-Mate: `bbb-conf --salt` 86 | 87 | Restart BBB: `sudo bbb-conf --restart` 88 | 89 | Check configs: `sudo bbb-conf --check` 90 | 91 | --- 92 | ## Hasura (bbb-graphql-server) 93 | Console Url: https://bbb30.test/console (`{your bbb domain}`**`/console`**) 94 | 95 | Password: bigbluebutton 96 | 97 | --- 98 | 99 | ## Troubleshooting 100 | 101 | In case of problems, you can update the packages by running: 102 | 103 | ```sh 104 | sudo apt update 105 | sudo apt dist-upgrade -y 106 | ``` 107 | 108 | --- 109 | # Instructions to run BigBlueButton from source (via command-line) 110 | - **HTML5 - bigbluebutton-html5**: the Front-End (users meeting interface) [*Meteor*] 111 | - **AKKA - akka-bbb-apps**: Backend that exchange msgs with Frontend through Redis pub/sub msgs (stores the meeting state and execute validations for Html5, *e.g: Can John send a message?*) [*Scala*] 112 | - **API - bigbluebutton-web**: Receives requests e.g: Create room, Enter room (when someone asks to enter the room, enters the API and then is redirected to html5) [*Grails*] 113 | - **-bbb-common-web**: Contains useful functions that are used by the API [*JAVA*] 114 | - **bbb-common-message**: Contains all Redis messages! Akka and the API import this project to know the existing messages [*JAVA*] 115 | 116 | Further informations in https://docs.bigbluebutton.org/2.6/dev.html 117 | 118 | --- 119 | ## HTML5 client 120 | 121 | #### Running HTML5 122 | ``` 123 | cd ~/src/bigbluebutton-html5/ 124 | ./run-dev.sh 125 | ``` 126 | 127 | #### Running HTML5 with **Full RESET** (needed sometimes) 128 | ``` 129 | cd ~/src/bigbluebutton-html5/ 130 | ./run-dev.sh --reset 131 | ``` 132 | 133 | --- 134 | ## Common-Message (required for BBB-Web and Akka) 135 | ``` 136 | cd ~/src/bbb-common-message 137 | ./deploy.sh 138 | ``` 139 | 140 | --- 141 | ## BBB-Web (API) 142 | 143 | #### Running Bigbluebutton-web 144 | ``` 145 | cd ~/src/bigbluebutton-web/ 146 | ./run-dev.sh 147 | ``` 148 | 149 | **If `bbb-common-web` was changed run:** 150 | ``` 151 | cd ~/src/bbb-common-web 152 | ./deploy.sh 153 | cd ~/src/bigbluebutton-web/ 154 | ./build.sh 155 | ``` 156 | 157 | 158 | --- 159 | ## Akka-apps 160 | 161 | #### Running Akka within **bbb-docker-dev** 162 | ```bash 163 | cd ~/src/akka-bbb-apps/ 164 | ./run-dev.sh 165 | ``` 166 | 167 | #### Running Akka on **IntelliJ IDEA** 168 | - [Requires Common-Message](#common-message-required-for-bbb-web-and-akka) 169 | - Open bbb-docker-dev SSH connection appending `-with-ports` to the command *(it will create tunnel for Redis port 6379)* 170 | ```bash 171 | ssh {container_name}-with-ports 172 | ``` 173 | - Run Akka within Docker once, to set the configs 174 | ```bash 175 | cd ~/src/akka-bbb-apps/ 176 | ./run-dev.sh 177 | ``` 178 | - If everything is working, press `Ctrl + C` to stop 179 | 180 | - Open IDEA, open the Sbt tab and run: 181 | ``` 182 | ~reStart 183 | ``` 184 | ![image](https://user-images.githubusercontent.com/5660191/158892260-8356d117-3be8-424a-aa24-ca405511f4e5.png) 185 | 186 | 187 | --- 188 | ## Redis 189 | - To track the exchange of messages between applications 190 | ``` 191 | redis-cli psubscribe "*" | grep --line-buffered -v 'pmessage\|CheckRunningAndRecording\|MeetingInfoAnalyticsServiceMsg\|CheckAliveP\|GetUsersStatusToVoiceConfSysMsg\|SendCursorPosition\|DoLatencyTracerMsg' 192 | ``` 193 | 194 | ## Simulate Dial-in user 195 | 196 | - Create a meeting and copy the Voice Bridge number 197 | 198 | ![simulate-dial-in](https://github.com/bigbluebutton/docker-dev/assets/5660191/da17835f-fd49-4072-835f-e210e0c8cb75) 199 | 200 | 201 | Within the container run (replacing by the voice bridge you just copied): 202 | 203 | ``` 204 | VOICE_BRIDGE=76034 205 | cd /opt/sipp 206 | sudo sipp -sn uac_pcap -m 1 -aa -d 30000 -s $VOICE_BRIDGE "$(hostname -I | awk '{print $1}')":5060 207 | ``` 208 | -------------------------------------------------------------------------------- /create_bbb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if ! command -v docker &> /dev/null 6 | then 7 | echo "Docker not found! Required Docker 20 or greater" 8 | exit 9 | fi 10 | 11 | DOCKER_VERSION=$(docker version -f "{{.Server.Version}}") 12 | DOCKER_VERSION_MAJOR=$(echo "$DOCKER_VERSION"| cut -d'.' -f 1) 13 | 14 | if [ ! "${DOCKER_VERSION_MAJOR}" -ge 20 ] ; then 15 | echo "Invalid Docker version! Required Docker 20 or greater" 16 | exit 17 | fi 18 | 19 | NAME= 20 | DOMAIN=test 21 | IP=172.17.0.2 22 | IMAGE=imdt/bigbluebutton:3.0.x-develop 23 | GITHUB_FORK_SKIP=0 24 | GITHUB_USER= 25 | CERT_DIR= 26 | CUSTOM_SCRIPT= 27 | REMOVE_CONTAINER=0 28 | CONTAINER_IMAGE= 29 | DOCKER_CUSTOM_PARAMS="" 30 | DOCKER_NETWORK_PARAMS="" 31 | 32 | 33 | for var in "$@" 34 | do 35 | if [[ ! "$var" == *"--"* ]] && [ ! $NAME ]; then 36 | NAME="$var" 37 | elif [[ "$var" == --image* ]] ; then 38 | IMAGE=${var#*=} 39 | CONTAINER_IMAGE=$IMAGE 40 | elif [[ "$var" == "--remove" ]] ; then 41 | REMOVE_CONTAINER=1 42 | fi 43 | done 44 | 45 | if [ ! $NAME ] ; then 46 | echo "" 47 | echo "Missing param name: ./create_bbb.sh [OPTION] {name}" 48 | echo "" 49 | echo "" 50 | echo "List of options:" 51 | echo "--update" 52 | echo "--fork-skip" 53 | echo "--fork=github_user" 54 | echo "--domain=domain_name" 55 | echo "--ip=ip_address" 56 | echo "--image=docker_image" 57 | echo "--cert=certificate_dir" 58 | echo "--custom-script=path/script.sh" 59 | echo "--docker-custom-params=\"-v /tmp:/tmp:rw\"" 60 | echo "--docker-network-params=\"--net=host\"" 61 | echo "" 62 | echo "" 63 | exit 1 64 | fi 65 | 66 | echo "Container name: $NAME" 67 | 68 | #for container_id in $(docker ps -f name=$NAME -q) ; do 69 | for container_name in $(docker ps --format '{{.Names}}' | grep -w "^$NAME$"); do 70 | echo "Killing container $container_name" 71 | docker kill $container_name; 72 | done 73 | 74 | # for container_id in $(docker ps -f name=$NAME -q -a); do 75 | for container_name in $(docker ps -a --format '{{.Names}}' | grep -w "^$NAME$"); do 76 | CONTAINER_IMAGE="$(docker inspect --format '{{ .Config.Image }}' $container_name)" 77 | echo "Removing container $NAME" 78 | docker rm $container_name; 79 | done 80 | 81 | # Remove entries from ~/.ssh/config 82 | if [ -f ~/.ssh/config ] ; then 83 | sed -i '/^Host '"$NAME"'$/,/^$/d' ~/.ssh/config 84 | sed -i '/^Host '"$NAME-with-ports"'$/,/^$/d' ~/.ssh/config 85 | fi 86 | 87 | if [ $REMOVE_CONTAINER == 1 ]; then 88 | if [ $CONTAINER_IMAGE ]; then 89 | echo 90 | echo "----" 91 | read -p "Do you want to remove the image $CONTAINER_IMAGE (y/n)? " -n 1 -r 92 | echo 93 | if [[ $REPLY =~ ^[Yy]$ ]]; then 94 | docker image rm $CONTAINER_IMAGE --force 95 | echo "Image $CONTAINER_IMAGE removed!" 96 | fi 97 | fi 98 | 99 | if [ -d $HOME/$NAME ] ; then 100 | echo 101 | echo "----" 102 | read -p "Do you want to remove all files from $HOME/$NAME (y/n)? " -n 1 -r 103 | echo 104 | if [[ $REPLY =~ ^[Yy]$ ]]; then 105 | rm -rf $HOME/$NAME 106 | fi 107 | fi 108 | 109 | echo "Container $NAME removed!" 110 | exit 0 111 | fi 112 | 113 | 114 | echo "Using image $IMAGE" 115 | 116 | for var in "$@" 117 | do 118 | if [ "$var" == "--update" ] ; then 119 | has_docker_image=$(docker image ls $IMAGE -q | wc -l) 120 | if [[ "$has_docker_image" != "0" ]]; then 121 | echo "Image '$IMAGE' available on your system, checking for newer version" 122 | docker image tag $IMAGE ${IMAGE}_previous 123 | docker image rm $IMAGE 124 | else 125 | echo "Image '$IMAGE' not available on your system, downloading it..." 126 | fi 127 | 128 | docker pull $IMAGE 129 | 130 | if [[ "$has_docker_image" != "0" ]]; then 131 | docker rmi -f ${IMAGE}_previous 132 | fi 133 | elif [[ "$var" == --ip* ]] ; then 134 | IP=${var#*=} 135 | if [[ $IP == 172.17.* ]] ; then 136 | echo "IP address can't start with 172.17" 137 | return 1 2>/dev/null 138 | exit 1 139 | else 140 | echo "Setting IP to $IP" 141 | fi 142 | elif [ "$var" == "--fork-skip" ] ; then 143 | GITHUB_FORK_SKIP=1 144 | elif [[ "$var" == --fork* ]] ; then 145 | GITHUB_USER=${var#*=} 146 | elif [[ "$var" == --cert* ]] ; then 147 | CERT_DIR=${var#*=} 148 | elif [[ "$var" == --custom-script* ]] ; then 149 | CUSTOM_SCRIPT=${var#*=} 150 | elif [[ "$var" == --domain* ]] ; then 151 | DOMAIN=${var#*=} 152 | elif [[ "$var" == --docker-custom-params* ]] ; then 153 | DOCKER_CUSTOM_PARAMS=${var#*=} 154 | echo "Custom params will be appended to 'docker run': $DOCKER_CUSTOM_PARAMS" 155 | elif [[ "$var" == --docker-network-params* ]] ; then 156 | DOCKER_NETWORK_PARAMS=${var#*=} 157 | fi 158 | done 159 | 160 | mkdir -p $HOME/$NAME/ 161 | HOSTNAME=$NAME.$DOMAIN 162 | 163 | 164 | BBB_SRC_FOLDER=$HOME/$NAME/bigbluebutton 165 | if [ $GITHUB_FORK_SKIP == 1 ]; then 166 | mkdir -p $BBB_SRC_FOLDER 167 | echo "Skipping 'git clone' of Bigbluebutton project" 168 | elif [ -d $BBB_SRC_FOLDER ] ; then 169 | echo "Directory $HOME/$NAME/bigbluebutton already exists, not initializing." 170 | sleep 2; 171 | else 172 | cd $HOME/$NAME/ 173 | 174 | if [ $GITHUB_USER ] ; then 175 | git clone git@github.com:$GITHUB_USER/bigbluebutton.git 176 | 177 | echo "Adding Git Upstream to https://github.com/bigbluebutton/bigbluebutton.git" 178 | cd $HOME/$NAME/bigbluebutton 179 | git remote add upstream https://github.com/bigbluebutton/bigbluebutton.git 180 | else 181 | git clone https://github.com/bigbluebutton/bigbluebutton.git 182 | fi 183 | fi 184 | 185 | cd 186 | 187 | ###Certificate start --> 188 | mkdir $HOME/$NAME/certs/ -p 189 | if [ $CERT_DIR ] ; then 190 | echo "Certificate directory passed: $CERT_DIR" 191 | if [ ! -f $CERT_DIR/fullchain.pem ] ; then 192 | echo "Error! $CERT_DIR/fullchain.pem not found." 193 | exit 0 194 | elif [ ! -f $CERT_DIR/privkey.pem ] ; then 195 | echo "Error! $CERT_DIR/privkey.pem not found." 196 | exit 0 197 | fi 198 | 199 | cp $CERT_DIR/fullchain.pem $HOME/$NAME/certs/fullchain.pem 200 | cp $CERT_DIR/privkey.pem $HOME/$NAME/certs/privkey.pem 201 | echo "Using provided certificate successfully!" 202 | elif [ -f $HOME/$NAME/certs/fullchain.pem ] && [ -f $HOME/$NAME/certs/privkey.pem ] ; then 203 | echo "Certificate already exists, not creating." 204 | sleep 2; 205 | else 206 | mkdir $HOME/$NAME/certs-source/ -p 207 | #Create root CA 208 | cd $HOME/$NAME/certs-source/ 209 | openssl rand -base64 48 > bbb-dev-ca.pass ; 210 | chmod 600 bbb-dev-ca.pass ; 211 | openssl genrsa -des3 -out bbb-dev-ca.key -passout file:bbb-dev-ca.pass 2048 ; 212 | 213 | openssl req -x509 -new -nodes -key bbb-dev-ca.key -sha256 -days 1460 -passin file:bbb-dev-ca.pass -out bbb-dev-ca.crt -subj "/C=CA/ST=BBB/L=BBB/O=BBB/OU=BBB/CN=BBB-DEV" ; 214 | 215 | #Copy the CA to your trusted certificates ( so your browser will accept this certificate ) 216 | sudo mkdir /usr/local/share/ca-certificates/bbb-dev/ -p 217 | sudo cp $HOME/$NAME/certs-source/bbb-dev-ca.crt /usr/local/share/ca-certificates/bbb-dev/ 218 | sudo chmod 644 /usr/local/share/ca-certificates/bbb-dev/bbb-dev-ca.crt 219 | 220 | if command -v update-ca-certificates >/dev/null 2>&1; then 221 | sudo update-ca-certificates 222 | elif command -v update-ca-trust >/dev/null 2>&1; then 223 | sudo update-ca-trust extract 224 | else 225 | echo "Warning: No certificate update tool found." 226 | fi 227 | 228 | #Generate a certificate for your first local BBB server 229 | cd $HOME/$NAME/certs-source/ 230 | openssl genrsa -out ${HOSTNAME}.key 2048 231 | rm ${HOSTNAME}.csr ${HOSTNAME}.crt ${HOSTNAME}.key -f 232 | cat > ${HOSTNAME}.ext << EOF 233 | authorityKeyIdentifier=keyid,issuer 234 | basicConstraints=CA:FALSE 235 | keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment 236 | subjectAltName = @alt_names 237 | [alt_names] 238 | DNS.1 = ${HOSTNAME} 239 | EOF 240 | 241 | openssl req -nodes -newkey rsa:2048 -keyout ${HOSTNAME}.key -out ${HOSTNAME}.csr -subj "/C=CA/ST=BBB/L=BBB/O=BBB/OU=BBB/CN=${HOSTNAME}" -addext "subjectAltName = DNS:${HOSTNAME}" 242 | openssl x509 -req -in ${HOSTNAME}.csr -CA bbb-dev-ca.crt -CAkey bbb-dev-ca.key -CAcreateserial -out ${HOSTNAME}.crt -days 825 -sha256 -passin file:bbb-dev-ca.pass -extfile ${HOSTNAME}.ext 243 | 244 | cd $HOME/$NAME/ 245 | cp $HOME/$NAME/certs-source/bbb-dev-ca.crt certs/ 246 | cat $HOME/$NAME/certs-source/$HOSTNAME.crt > certs/fullchain.pem 247 | cat $HOME/$NAME/certs-source/bbb-dev-ca.crt >> certs/fullchain.pem 248 | cat $HOME/$NAME/certs-source/$HOSTNAME.key > certs/privkey.pem 249 | rm -r $HOME/$NAME/certs-source 250 | echo "Self-signed certificate created successfully!" 251 | fi 252 | ### <-- Certificate end 253 | 254 | 255 | SUBNET="$(echo $IP |cut -d "." -f 1).$(echo $IP |cut -d "." -f 2).0.0" 256 | 257 | if [ $SUBNET == "172.17.0.0" ] ; then 258 | SUBNETNAME="bridge" 259 | else 260 | SUBNETNAME="bbb_network_$(echo $IP |cut -d "." -f 1)_$(echo $IP |cut -d "." -f 2)" 261 | fi 262 | 263 | if [ ! "$(docker network ls | grep $SUBNETNAME)" ]; then 264 | echo "Creating $SUBNETNAME network ..." 265 | docker network create --driver=bridge --subnet=$SUBNET/16 $SUBNETNAME 266 | else 267 | echo "$SUBNETNAME network exists." 268 | fi 269 | 270 | 271 | if [ $SUBNETNAME != "bridge" ] && [ "$DOCKER_NETWORK_PARAMS" == "" ] ; then 272 | DOCKER_NETWORK_PARAMS="--ip=$IP --network $SUBNETNAME" 273 | fi 274 | 275 | 276 | #Sync cache dirs between host machine and Docker container (to speed up building time) 277 | mkdir -p $HOME/.m2 #Sbt publish 278 | mkdir -p $HOME/.ivy2 #Sbt publish 279 | mkdir -p $HOME/.cache #Maven 280 | mkdir -p $HOME/.gradle #Gradle 281 | mkdir -p $HOME/.npm #Npm 282 | 283 | docker run -d --name=$NAME --hostname=$HOSTNAME $DOCKER_NETWORK_PARAMS $DOCKER_CUSTOM_PARAMS -env="container=docker" --env="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" --env="DEBIAN_FRONTEND=noninteractive" -v "/var/run/docker.sock:/docker.sock:rw" --cap-add="NET_ADMIN" --privileged -v "$HOME/$NAME/certs/:/local/certs:rw" --cgroupns=host -v "$BBB_SRC_FOLDER:/home/bigbluebutton/src:rw" -v "/tmp:/tmp:rw" -v "$HOME/.m2:/home/bigbluebutton/.m2:rw" -v "$HOME/.ivy2:/home/bigbluebutton/.ivy2:rw" -v "$HOME/.cache:/home/bigbluebutton/.cache:rw" -v "$HOME/.gradle:/home/bigbluebutton/.gradle:rw" -v "$HOME/.npm:/home/bigbluebutton/.npm:rw" -t $IMAGE 284 | 285 | if [ $CUSTOM_SCRIPT ] && [ -f $CUSTOM_SCRIPT ] ; then 286 | echo "Executing $CUSTOM_SCRIPT on container $NAME" 287 | cat $CUSTOM_SCRIPT | docker exec -i $NAME bash 288 | fi 289 | 290 | mkdir -p $HOME/.bbb/ 291 | echo "docker exec -u bigbluebutton -w /home/bigbluebutton/ -it $NAME /bin/bash -l" > $HOME/.bbb/$NAME.sh 292 | chmod 755 $HOME/.bbb/$NAME.sh 293 | 294 | # Create SSH key if absent. Prefer ed25519 if available. 295 | if [ ! -e ~/.ssh/id_ed25519.pub ] && [ ! -e ~/.ssh/id_rsa.pub ]; then 296 | echo "No SSH key found, generating ed25519 key pair." 297 | ssh-keygen -t ed25519 -N '' -f ~/.ssh/id_ed25519 298 | fi 299 | 300 | # Determine which public key to use. 301 | if [ -e ~/.ssh/id_ed25519.pub ]; then 302 | SSH_PUB_KEY=$(cat ~/.ssh/id_ed25519.pub) 303 | elif [ -e ~/.ssh/id_rsa.pub ]; then 304 | SSH_PUB_KEY=$(cat ~/.ssh/id_rsa.pub) 305 | fi 306 | 307 | docker exec -u bigbluebutton $NAME bash -c "mkdir -p ~/.ssh && echo '$SSH_PUB_KEY' >> ~/.ssh/authorized_keys" 308 | sleep 5s 309 | 310 | if [ "$DOCKER_NETWORK_PARAMS" == "--net=host" ] ; then 311 | DOCKERIP="$(hostname -I | awk '{print $1}')" 312 | echo "It seems you are using the param --net=host, the container will receive the same IP of the Host: $DOCKERIP" 313 | elif [ "$SUBNETNAME" == "bridge" ] ; then 314 | DOCKERIP="$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $NAME)" 315 | else 316 | DOCKERIP="$(docker inspect --format '{{ .NetworkSettings.Networks.'"$SUBNETNAME"'.IPAddress }}' $NAME)" 317 | fi 318 | 319 | if [ ! $DOCKERIP ] ; then 320 | echo "ERROR! Trying to discover Docker IP" 321 | exit 0 322 | fi 323 | 324 | sudo sed -i "/$HOSTNAME/d" /etc/hosts 325 | echo $DOCKERIP $HOSTNAME | sudo tee -a /etc/hosts 326 | 327 | touch ~/.ssh/known_hosts 328 | ssh-keygen -R "$HOSTNAME" 329 | ssh-keygen -R "$DOCKERIP" 330 | # ssh-keygen -R [hostname],[ip_address] 331 | 332 | ssh-keyscan -H "$DOCKERIP" >> ~/.ssh/known_hosts 333 | ssh-keyscan -H "$HOSTNAME" >> ~/.ssh/known_hosts 334 | # ssh-keyscan -H [hostname],[ip_address] >> ~/.ssh/known_hosts 335 | 336 | if [ ! -z "$(tail -1 ~/.ssh/config)" ] ; then 337 | echo "" >> ~/.ssh/config 338 | fi 339 | 340 | if ! grep -q "\Host ${NAME}$" ~/.ssh/config ; then 341 | echo "Adding alias $NAME to ~/.ssh/config" 342 | echo "Host $NAME 343 | HostName $HOSTNAME 344 | User bigbluebutton 345 | Port 22 346 | " >> ~/.ssh/config 347 | fi 348 | 349 | # Create tunnel for Redis (6379) and Mongodb (4101) 350 | if ! grep -q "\Host ${NAME}-with-ports$" ~/.ssh/config ; then 351 | echo "Adding alias $NAME-with-ports to ~/.ssh/config" 352 | 353 | # Don't LocalForward ports case it's running on the host itself IP 354 | if [ "$DOCKER_NETWORK_PARAMS" != "--net=host" ] ; then 355 | echo "Host $NAME-with-ports 356 | HostName $HOSTNAME 357 | User bigbluebutton 358 | Port 22 359 | LocalForward 6379 localhost:6379 360 | LocalForward 4101 localhost:4101 361 | " >> ~/.ssh/config 362 | else 363 | echo "Host $NAME-with-ports 364 | HostName $HOSTNAME 365 | User bigbluebutton 366 | Port 22 367 | " >> ~/.ssh/config 368 | fi 369 | fi 370 | 371 | #Set Zsh as default and copy local bindkeys 372 | if [ -d ~/.oh-my-zsh ]; then 373 | echo "Found oh-my-zsh installed. Setting as default in Docker as well." 374 | docker exec -u bigbluebutton $NAME bash -c "sudo chsh -s /bin/zsh bigbluebutton" 375 | grep "^bindkey" ~/.zshrc | xargs -I{} docker exec -u bigbluebutton $NAME bash -c "echo {} >> /home/bigbluebutton/.zshrc" 376 | fi 377 | 378 | 379 | echo "------------------" 380 | echo "Docker infos" 381 | echo "IP $DOCKERIP" 382 | echo "Default user: bigbluebutton" 383 | echo "Default passwork: bigbluebutton" 384 | echo "" 385 | echo "" 386 | docker exec -u bigbluebutton $NAME bash -c "bbb-conf --salt" 387 | echo "" 388 | echo "" 389 | echo "------------------" 390 | tput setaf 2; echo "Container created successfully!"; tput sgr0 391 | echo "" 392 | tput setaf 3; echo "BBB URL: https://$HOSTNAME"; tput sgr0 393 | tput setaf 3; echo "Access Docker using: ssh $NAME"; tput sgr0 394 | echo "" 395 | echo "------------------" 396 | echo "" 397 | echo "" 398 | tput setaf 4; echo "or to run Akka/Mongo locally use: ssh $NAME-with-ports"; tput sgr0 399 | echo "" 400 | echo "" 401 | --------------------------------------------------------------------------------