-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support reverse proxies + CI integration test #43
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ CONSISTENCY=delegated | |
ISLANDORA_REPOSITORY=islandora | ||
|
||
# The version of the isle-buildkit images to use. | ||
ISLANDORA_TAG=3.2.4 | ||
ISLANDORA_TAG=3.2.5 | ||
|
||
# The Docker image repository, to push/pull custom images from. | ||
# islandora.io redirects to localhost. | ||
|
@@ -42,6 +42,19 @@ TAG=local | |
# The domain at which your production site is hosted. | ||
DOMAIN=islandora.dev | ||
|
||
# Set to "on" if your ISLE docker deployment is behind a reverse proxy | ||
REVERSE_PROXY=off | ||
|
||
# This list should be all the IPs in front of your Drupal docker container | ||
# this is used to pass the original client IP to the drupal container so | ||
# drupal/php is aware of who sent the original request | ||
# if you're not behind a reverse proxy, you probably do not need to edit these IPs | ||
# if you are behind a reverse proxy, most likely you can just replace FRONTEND_IP_1 | ||
# with the IP address used on your front end // reverse proxy domain | ||
FRONTEND_IP_1=127.0.0.1/32 | ||
FRONTEND_IP_2=172.0.0.0/8 | ||
FRONTEND_IP_3=192.168.0.0/16 | ||
|
||
# The email to use for admin users and Lets Encrypt. | ||
[email protected] | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Run tests | ||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
inputs: | ||
buildkit-tag: | ||
description: "The isle-buildkit tag to pull for the fleet of docker containers" | ||
required: true | ||
type: string | ||
default: 'main' | ||
starter-site-ref: | ||
description: "The islandora-starter-site ref to checkout (heads/BRANCH-NAME or tags/TAG-NAME)" | ||
required: true | ||
type: string | ||
default: 'heads/main' | ||
schedule: | ||
- cron: '15 11 * * *' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why test with cron? Do we expect this to fail without changes to the code base? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah to catch issues with buildkit+starter that are otherwise never discovered There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thought being: this is sort of the last mile before someone installs a site, so if some issue does arise between buildkit and starter site this feels like the best place to discover it since it's the place those two repos converge |
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
ISLANDORA_TAG: "${{ github.event.inputs.buildkit-tag }}" | ||
ISLANDORA_STARTER_REF: "${{ github.event.inputs.starter-site-ref }}" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- run: shellcheck tests/*.sh | ||
|
||
- name: install mkcert | ||
run: |- | ||
curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64" | ||
chmod +x mkcert-v*-linux-amd64 | ||
sudo cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert | ||
|
||
- name: start islandora-starter-site | ||
run: ./tests/init-template-starter.sh | ||
|
||
- name: Notify Slack on nightly test failure | ||
if: failure() && github.event_name == 'schedule' | ||
run: |- | ||
curl -s -o /dev/null -XPOST $SLACK_WEBHOOK_URL -d '{ | ||
"text": "🚨 Scheduled job failed! Click to view the run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | ||
}' | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eou pipefail | ||
|
||
if [ ! -v ISLANDORA_STARTER_REF ] || [ "$ISLANDORA_STARTER_REF" = "" ]; then | ||
ISLANDORA_STARTER_REF=heads/main | ||
fi | ||
|
||
if [ ! -v ISLANDORA_TAG ] || [ "$ISLANDORA_TAG" = "" ]; then | ||
ISLANDORA_TAG=main | ||
fi | ||
|
||
mv drupal/rootfs/var/www/drupal/assets/patches/default_settings.txt . | ||
|
||
curl -L "https://github.com/Islandora-Devops/islandora-starter-site/archive/refs/${ISLANDORA_STARTER_REF}.tar.gz" \ | ||
| tar --strip-components=1 -C drupal/rootfs/var/www/drupal -xz | ||
|
||
mv default_settings.txt drupal/rootfs/var/www/drupal/assets/patches/default_settings.txt | ||
|
||
./generate-certs.sh | ||
./generate-secrets.sh | ||
|
||
docker compose --profile dev up -d | ||
|
||
./tests/ping.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
COUNTER=0 | ||
while true; do | ||
HTTP_STATUS=$(curl -w '%{http_code}' -o /dev/null -s https://islandora.dev/) | ||
echo "Ping returned http status ${HTTP_STATUS}, exit code $?" | ||
if [ "${HTTP_STATUS}" -eq 200 ]; then | ||
echo "We're live 🚀" | ||
exit 0 | ||
fi | ||
|
||
((COUNTER++)) | ||
if [ "${COUNTER}" -eq 50 ]; then | ||
echo "Failed to come online after 4m" | ||
exit 1 | ||
fi | ||
sleep 5; | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shame I didn't see the changes for this go into build kit, we could have made it into a single variable that was delimited by comma. That way we could support any number of IP's.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're welcome to open a new PR to simplify. FWIW I did it this way because the values are used in two places. One comma delimited used in docker compose(traefik), the other is multiple directives in buildkit // nginx directive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the bits on nginx we can iterate on a list using confd, let's not worry about it for now though. If someone wants to use more than 3 ip's in the future we can sort it then.