Skip to content

Commit

Permalink
Further improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 committed Jun 23, 2023
1 parent 41595eb commit 0c58c30
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 33 deletions.
3 changes: 1 addition & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ services:
ports:
- 17070:80
environment:
JIMM_LOG_LEVEL: "debug"
JIMM_UUID: "3217dbc9-8ea9-4381-9e97-01eab0b3f6bb"
JIMM_DSN: "postgresql://jimm:jimm@db/jimm"
CANDID_URL: "http://0.0.0.0:8081" # For external client redirects (in the case of compose and running outside)
Expand Down Expand Up @@ -123,8 +124,6 @@ services:
image: candid:latest
container_name: candid
entrypoint: "/candid.sh"
command: ""
# command: "/etc/candid/config.yaml && echo 'hi' && ls"
expose:
- 8081
ports:
Expand Down
17 changes: 1 addition & 16 deletions local/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ The services included are:
to re-run the compose continuously, but note, if you do bring the compose down, remove the volumes otherwise
vault will not behave correctly, this can be done via `docker compose down -v`

If all was successful, you should seen an output similar to:
```
NAME COMMAND SERVICE STATUS PORTS
candid candid:latest "/candid.sh" candid About a minute ago Up About a minute (healthy) ...
jimmy cosmtrek/air "/go/bin/air" jimm About a minute ago Up 54 seconds (healthy) ...
postgres postgres "docker-entrypoint.s…" db About a minute ago Up About a minute (healthy) ...
traefik traefik:2.9 "/entrypoint.sh trae…" traefik About a minute ago Up About a minute (healthy) ...
vault vault:latest "docker-entrypoint.s…" vault About a minute ago Up About a minute (unhealthy) ...
```

Now please checkout the [Authentication Steps](#authentication-steps) to authenticate postman for local testing & Q/A.

# Q/A Using Postman
Expand All @@ -54,12 +44,7 @@ The `request name` represents the literal WS endpoint, i.e., `API = /api`.

# Q/A Using jimmctl

## Prerequisited

1. Make sure you are using latest juju from their develop branch (at the moment, we're using 3.2-beta1).
2. change jujuClientVersion in `internal/jujuclient/dial.go` to **3.2-beta1** by running: ``sed -i 's/jujuClientVersion = "2.9.42"/jujuClientVersion = "3.2-beta1"/g' ./internal/jujuclient/dial.go``

Steps:
## Prerequisites

1. `juju unregister jimm-dev` - Unregister any other local JIMM you have.
2. `juju login jimm.localhost -c jimm-dev` - Login to local JIMM. (If you name the controller jimm-dev, the script will pick it up!)
Expand Down
12 changes: 1 addition & 11 deletions local/candid/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@

echo "Entrypoint being overriden for local environment."

# Grab curl quickly.
apt update
apt install curl -y
/root/candidsrv /etc/candid/config.yaml &

# Pseudo readiness probe such that we can continue local dev setup.
until eval curl --output /dev/null --silent --fail http://localhost:8081/debug/status; do
printf '.'
sleep 1
done
echo "Server appears to have started."
# If any further configuration to the IdP is required, it can now be done via this script.
wait
exec /root/candidsrv /etc/candid/config.yaml
8 changes: 4 additions & 4 deletions local/jimm/add-controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# - yq (snap)
set -ux

JIMM_CONTROLLER_NAME="${1:-jimm-dev}"
CONTROLLER_NAME="${2:-qa-controller}"
CONTROLLER_YAML_PATH="${3:-qa-controller.yaml}"
CLIENT_CREDENTIAL_NAME="${4:-localhost}"
JIMM_CONTROLLER_NAME="${JIMM_CONTROLLER_NAME:-jimm-dev}"
CONTROLLER_NAME="${CONTROLLER_NAME:-qa-controller}"
CONTROLLER_YAML_PATH="${CONTROLLER_YAML_PATH:-qa-controller.yaml}"
CLIENT_CREDENTIAL_NAME="${CLIENT_CREDENTIAL_NAME:-localhost}"

echo
echo "JIMM controller name is: $JIMM_CONTROLLER_NAME"
Expand Down
4 changes: 4 additions & 0 deletions local/jimm/setup-controller.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/bin/bash
set -ux
echo "Bootstrapping controller"
juju bootstrap localhost qa-controller --config allow-model-access=true --config identity-url=https://candid.localhost
CONTROLLER=$(juju show-controller --format json | jq '."qa-controller"."controller-machines"."0"."instance-id"' | tr -d '"')
echo "Adding proxy to LXC instance"
lxc config device add "${CONTROLLER}" myproxy proxy listen=tcp:0.0.0.0:443 connect=tcp:127.0.0.1:443 bind=instance
echo "Pushing local CA"
lxc file push local/traefik/certs/ca.crt "${CONTROLLER}"/usr/local/share/ca-certificates/
lxc exec "${CONTROLLER}" -- update-ca-certificates
lxc exec "${CONTROLLER}" -- echo "127.0.0.1 candid.localhost" >> /etc/hosts
echo "Restarting controller"
lxc stop "${CONTROLLER}"
lxc start "${CONTROLLER}"

0 comments on commit 0c58c30

Please sign in to comment.