Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
sekulicd committed Oct 9, 2023
2 parents 444ad51 + 2e8e416 commit 8d291af
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 18 deletions.
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ runall:
## stopall: stop prem-gateway and prem-box
stopall:
chmod +x ./script/stop_all.sh
export PREMD_IMAGE=$(PREMD_IMAGE); \
export PREMAPP_IMAGE=$(PREMAPP_IMAGE); \
export BASIC_AUTH_CREDENTIALS=$(BASIC_AUTH_CREDENTIALS); \
./script/stop_all.sh

#### Go lint ####
Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,10 @@ make up LETSENCRYPT_PROD=true SERVICES=premd,premapp

#### Run prem-gateway with prem-app and prem-daemon:
```bash
make runall PREMD_IMAGE={IMG} PREMAPP_IMAGE={IMG} BASIC_AUTH_CREDENTIALS={CREDENTIALS}
make runall PREMD_IMAGE={IMG} PREMAPP_IMAGE={IMG}
```

#### Stop prem-gateway, prem-app and prem-daemon:
```bash
make stopall PREMD_IMAGE={IMG} PREMAPP_IMAGE={IMG} BASIC_AUTH_CREDENTIALS={CREDENTIALS}
make stopall PREMD_IMAGE={IMG} PREMAPP_IMAGE={IMG}
```

#### To generate proper credentials for basic auth, use bellow command.
```bash
echo $(htpasswd -nB {USER}) | sed -e s/\\$/\\$\\$/g
```

4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ services:
- prem-gateway
labels:
- "traefik.enable=true"
- "traefik.http.routers.dnsd.rule=HeadersRegexp(`X-Host-Override`,`dnsd`) && PathPrefix(`/`)"
- "traefik.http.routers.dnsd.rule=PathPrefix(`/dnsd`)"
- "traefik.http.middlewares.dnsd-strip-prefix.stripprefix.prefixes=/dnsd"
- "traefik.http.routers.dnsd.middlewares=dnsd-strip-prefix"
depends_on:
- dnsd-db-pg
- authd
Expand Down
5 changes: 4 additions & 1 deletion script/docker-compose-box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ services:
- PREM_REGISTRY_URL=https://raw.githubusercontent.com/premAI-io/prem-registry/main/manifests.json
- SENTRY_DSN=https://75592545ad6b472e9ad7c8ff51740b73@o1068608.ingest.sentry.io/4505244431941632
- PROXY_ENABLED=True
- DOCKER_NETWORK=prem-gateway
labels:
- "traefik.enable=true"
- "traefik.http.routers.premd.rule=HeadersRegexp(`X-Host-Override`,`premd`) && PathPrefix(`/`)"
- "traefik.http.routers.premd.rule=PathPrefix(`/premd`)"
- "traefik.http.middlewares.premd-strip-prefix.stripprefix.prefixes=/premd"
- "traefik.http.routers.premd.middlewares=premd-strip-prefix"
ports:
- "8084:8000"

Expand Down
15 changes: 15 additions & 0 deletions script/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,22 @@ done
# Navigate back to the ./script directory to run 'docker-compose'
cd ./script || { echo "Directory ./script does not exist. Exiting."; exit 1; }

if ! command -v openssl &> /dev/null
then
sudo apt-get update -qq
sudo apt-get install -y openssl
fi

BASIC_AUTH_USER="admin"
BASIC_AUTH_PASS=$(openssl rand -base64 4)
HASH=$(openssl passwd -apr1 $BASIC_AUTH_PASS)
BASIC_AUTH_CREDENTIALS="$BASIC_AUTH_USER:$HASH"
export BASIC_AUTH_CREDENTIALS

# Run the 'docker-compose' command with environment variables
export PREMD_IMAGE
export PREMAPP_IMAGE
docker-compose -f docker-compose-box.yml up -d --build

echo "Basic auth user: $BASIC_AUTH_USER"
echo "Basic auth pass: $BASIC_AUTH_PASS"
24 changes: 19 additions & 5 deletions script/stop_all.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
#!/bin/bash

make down
# Get all container IDs connected to the 'prem-gateway' network
CONTAINERS=($(docker ps -aq --filter network=prem-gateway))

cd ./script
# Check if CONTAINERS is empty (no containers on the network)
if [ ${#CONTAINERS[@]} -eq 0 ]; then
echo "No containers found on the 'prem-gateway' network."
else
# Stop all containers
echo "Stopping containers on 'prem-gateway' network..."
for CONTAINER in "${CONTAINERS[@]}"; do
docker stop "$CONTAINER"
done

export PREMD_IMAGE
export PREMAPP_IMAGE
docker-compose -f docker-compose-box.yml down -v
# Remove all containers and their anonymous volumes
echo "Removing containers and cleaning up volumes..."
for CONTAINER in "${CONTAINERS[@]}"; do
docker rm -v "$CONTAINER"
done

echo "Containers stopped and removed. Volumes cleaned."
fi

0 comments on commit 8d291af

Please sign in to comment.