Skip to content

Commit

Permalink
Merge branch 'main' into coturn-support
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo authored Nov 23, 2022
2 parents d365886 + 85613a8 commit 284b9bd
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 42 deletions.
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Hubs Compose is a Docker Compose setup than can be used to orchestrate all the
services used by Mozilla Hubs for local development.[^1]

[^1]: This is not a production-ready setup. It does not account for
security or scalability. Additionally the permissions files were generated for development purposes only.
security or scalability. Additionally the permissions files were generated for
development purposes only.

## Usage

Expand Down Expand Up @@ -34,22 +35,22 @@ certificates, you can visit https://hubs.local:4000 from your browser.
### Self-Signed Certificates

Service communication is encrypted with self-signed Transport Layer Security
(TLS) certificates. You will need to accept the certificate at each of the
ports mapped in [`docker-compose.yml`](docker-compose.yml). At the time of this
writing, that means visiting these links in your web browser and following the
prompts:

* [4443: Dialog](https://hubs.local:4443)
* [9090: Spoke](https://hubs.local:9090)
* [8989: Hubs Admin](https://hubs.local:8989)
* [8080: Hubs Client](https://hubs.local:8080)
* [4000: Reticulum](https://hubs.local:4000)
* [5349: Coturn](https://hubs.local:5349)
(TLS) certificates. You will need to accept the proxy certificate and the
certificate at each of the Hubs ports mapped in
[`docker-compose.yml`](docker-compose.yml). At the time of this writing, that
means visiting these links in your web browser and following the prompts:

* [Proxy](https://hubs-proxy.local:4000)
* [Dialog](https://hubs.local:4443)
* [Spoke](https://hubs.local:9090)
* [Hubs Admin](https://hubs.local:8989)
* [Hubs Client](https://hubs.local:8080)
* [Reticulum](https://hubs.local:4000)

### Admin panel access

To connect to the admin panel you will need to manually promote an account to admin:
https://github.com/mozilla/reticulum#6-creating-an-admin-user
To connect to the admin panel you will need to manually
[promote an account to admin](https://github.com/mozilla/reticulum#6-creating-an-admin-user).

### Command Execution

Expand Down
4 changes: 1 addition & 3 deletions bin/down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/bash
hash mutagen-compose || exit 1

basedir=$(readlink -f "$(dirname "$0")/..")
basedir=$(dirname "$0")/..
mutagen-compose -f "$basedir/docker-compose.yml" down
26 changes: 11 additions & 15 deletions bin/init
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash
hash git || exit 1
hash mutagen-compose || exit 1
trap 'exit 1' INT QUIT

basedir=$(readlink -f "$(dirname "$0")/..")
servicesdir=$basedir/services
Expand All @@ -15,19 +13,17 @@ git clone https://github.com/mozilla/dialog.git "$servicesdir/dialog"
git clone https://github.com/mozilla/hubs.git "$servicesdir/hubs"
git clone https://github.com/mozilla/Spoke.git "$servicesdir/spoke"

echo -e "\n${bright}Initializing Reticulum${reset}\n"
mutagen-compose -f "$composefile" run --rm reticulum sh -c 'mix do deps.get, deps.compile, ecto.create'

echo -e "\n${bright}Initializing Dialog${reset}\n"
mutagen-compose -f "$composefile" run --rm dialog sh -c '[ -d "node_modules" ] || npm ci'

echo -e "\n${bright}Initializing Hubs Admin${reset}\n"
mutagen-compose -f "$composefile" run --rm hubs-admin sh -c '[ -d "node_modules" ] || npm ci'

echo -e "\n${bright}Initializing Hubs Client${reset}\n"
mutagen-compose -f "$composefile" run --rm hubs-client sh -c '[ -d "node_modules" ] || npm ci'

echo -e "\n${bright}Initializing Spoke${reset}\n"
echo -e "\n${bright}Initializing Reticulum${reset}\n" &&
mutagen-compose -f "$composefile" run --rm reticulum sh -c 'mix do deps.get, deps.compile, ecto.create' &&
echo -e "\n${bright}Initializing Dialog${reset}\n" &&
mutagen-compose -f "$composefile" run --rm dialog sh -c '[ -d "node_modules" ] || npm ci' &&
echo -e "\n${bright}Initializing Hubs Admin${reset}\n" &&
mutagen-compose -f "$composefile" run --rm hubs-admin sh -c '[ -d "node_modules" ] || npm ci' &&
echo -e "\n${bright}Initializing Hubs Client${reset}\n" &&
mutagen-compose -f "$composefile" run --rm hubs-client sh -c '[ -d "node_modules" ] || npm ci' &&
echo -e "\n${bright}Initializing Spoke${reset}\n" &&
mutagen-compose -f "$composefile" run --rm spoke yarn

code=$?
mutagen-compose down
exit $code
1 change: 0 additions & 1 deletion bin/observe
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash
hash docker-compose || exit 1
hash tmux || exit 1
hash watch || exit 1

basedir=$(readlink -f "$(dirname "$0")/..")
Expand Down
7 changes: 3 additions & 4 deletions bin/reset
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash
hash mutagen-compose || exit 1

basedir=$(readlink -f "$(dirname "$0")/..")
mutagen-compose -f "$basedir/docker-compose.yml" down --volumes --rmi local
rm -r "$basedir/services/reticulum/deps"

mutagen-compose -f "$basedir/docker-compose.yml" down --volumes --rmi local &&
rm -rf "$basedir/services/reticulum/deps" &&
"$basedir/bin/init"
4 changes: 1 addition & 3 deletions bin/up
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/bash
hash mutagen-compose || exit 1

basedir=$(readlink -f "$(dirname "$0")/..")
basedir=$(dirname "$0")/..
mutagen-compose -f "$basedir/docker-compose.yml" up --build --detach
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ services:
db:
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
healthcheck:
test: ["CMD", "pg_isready"]
image: "postgres:14-alpine"
user: postgres
volumes:
- pgdata:/var/lib/postgresql/data
ports:
Expand Down Expand Up @@ -106,6 +106,8 @@ services:
dockerfile: dockerfiles/hubs.Dockerfile
target: dev
command: npm run storybook
healthcheck:
test: ["CMD", "curl", "-fk", "http://hubs.local:6006"]
ports:
- "6006:6006"
volumes:
Expand Down Expand Up @@ -152,6 +154,7 @@ services:
target: dev
command: ./scripts/run-local-reticulum.sh
environment:
CORS_PROXY_SERVER: "hubs-proxy.local:4000"
INTERNAL_HOSTNAME: spoke
ports:
- "9090:9090"
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/reticulum.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG ELIXIR_VERSION=1.8.2
ARG OTP_VERSION=22.3.4

FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-alpine-${ALPINE_LINUX_VERSION} AS dev
HEALTHCHECK CMD wget --no-check-certificate https://localhost:4000/link -O /dev/null || exit 1
HEALTHCHECK CMD wget --no-check-certificate --no-verbose --tries=1 --spider https://localhost:4000/stream-offline.png
RUN mix do local.hex --force, local.rebar --force
RUN apk add --no-cache\
# required by hex\
Expand Down

0 comments on commit 284b9bd

Please sign in to comment.