Skip to content

Commit

Permalink
bring back the caprover related stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
JessyBarrette committed Jun 25, 2024
1 parent 27ef554 commit cfeb51d
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 175 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/caprover-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Simple workflow for deploying static content to GitHub Pages
name: Caprover Deploy
run-name: Caprover Deploy branch:${{ github.ref_name }}
on:
# Runs on pushes targeting the default branch
push:
branches:
- master
- development
- caprover-*
paths:
- Dockerfile-Caprover
- erddap/**/*
- .github/workflows/*
- init.d/*
workflow_dispatch:

jobs:
# Single deploy job since we're just deploying
deploy:
runs-on: ubuntu-latest
timeout-minutes: 10
environment:
name: ${{ startsWith(github.ref_name, 'caprover-deploy') && 'development' || github.ref_name == 'development' && 'development' || github.ref_name == 'master' && 'production' || github.ref_name == 'caprover-production' && 'production' || 'production' }}
url: ${{ vars.URL }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Compress repo to a tar file step
run: tar -cvf packaged.tar .
- name: Install Caprover CLI
run: npm install -g caprover
- name: Deploy ${{ github.ref_name }} on ${{ vars.URL }}
run: |
caprover deploy \
--caproverUrl ${{ vars.CAPROVER_URL }} \
--caproverApp ${{ vars.CAPROVER_APP_NAME }} \
--appToken ${{ secrets.CAPROVER_TOKEN }} \
--tarFile packaged.tar
34 changes: 34 additions & 0 deletions .github/workflows/update-caprover.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Synchronize ERDDAP datasets.xml on server deployment
run-name: Synchronize ${{github.repository}}[${{ github.ref_name }}] datasets.xml on deployment
on:
push:
branches:
- master
- development
- caprover-*
paths-ignore:
- Dockerfile
- erddap/**/*
- init.d/*
jobs:
update:
name: Update container datasets-xml
runs-on: ubuntu-latest
environment:
name: ${{ startsWith(github.ref_name, 'caprover-') && 'development' || github.ref_name == 'development' && 'development' || github.ref_name == 'master' && 'production' }}
url: ${{ vars.URL }}

steps:
- name: Run `erddap-deploy update action` on ${{ vars.NAME }} at ${{ vars.URL }}
uses: hakaiinstitute/erddap-deploy/sync@v1.3.1
with:
ssh_host: ${{ secrets.SSH_HOST }}
ssh_username: ${{ secrets.SSH_USERNAME }}
ssh_key: ${{ secrets.SSH_KEY }}
ssh_port: ${{ secrets.SSH_PORT }}
container_name: srv-captain--${{ vars.CAPROVER_APP_NAME }}
hard_flag: true
monitor: true
sudo: true


25 changes: 0 additions & 25 deletions .github/workflows/update-erddap-development-server.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/update-erddap-production-server.yaml

This file was deleted.

25 changes: 25 additions & 0 deletions Dockerfile-Caprover
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM --platform=linux/x86_64 axiom/docker-erddap:2.23-jdk17-openjdk

# Install related packages
RUN apt-get update
RUN apt-get install -y git python3-pip
ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
RUN pip install git+https://github.com/HakaiInstitute/erddap-deploy.git@v1.3

ARG HOST_PORT=${HOST_PORT:-8080}
ENV HOST_PORT=${HOST_PORT}

# Copy ERDDAP configuration files
COPY ./erddap/conf/robots.txt /usr/local/tomcat/webapps/ROOT/robots.txt
COPY ./erddap/content /usr/local/tomcat/content/erddap
COPY init.d /init.d

ENTRYPOINT ["/entrypoint.sh"]

#healthcheck to check ERDDAP landing page. the check provides the added bonus
#of triggering ERDDAP initialization before the first user visit
HEALTHCHECK --interval=10s --timeout=10s --start-period=10s \
CMD curl --fail http://localhost:${HOST_PORT}/erddap/index.html || exit 1

EXPOSE ${HOST_PORT}
CMD ["catalina.sh", "run"]
4 changes: 4 additions & 0 deletions captain-definition
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"schemaVersion": 2,
"dockerfilePath": "./Dockerfile-Caprover"
}
8 changes: 0 additions & 8 deletions init.d/replace-datasets-secrets.sh

This file was deleted.

9 changes: 9 additions & 0 deletions init.d/sync-erddap-datasets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

if [[ -n $ERDDAP_DATASETS_REPO_URL ]]; then
erddap_deploy sync
fi

if [[ -n $UPTIME_KUMA_URL ]]; then
erddap_deploy monitor
fi
117 changes: 0 additions & 117 deletions update-erddap.sh

This file was deleted.

0 comments on commit cfeb51d

Please sign in to comment.