Run DFG-Viewer test system over ngrok #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run DFG-Viewer test system over ngrok | |
on: | |
# Allows you to run this workflow manually | |
workflow_dispatch: | |
jobs: | |
build-and-run: | |
name: DFG-Viewer with ngrok tunnel | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout DLF 3D Viewer Repository | |
uses: actions/checkout@v4 | |
- name: Checkout DFG-Viewer Repository | |
uses: actions/checkout@v4 | |
with: | |
repository: 'markusweigelt/dfg-viewer' | |
ref: 'docker' | |
path: 'dfg-viewer' | |
- name: Prepare environment | |
working-directory: dfg-viewer/Docker | |
run: | | |
# Rename example .env file | |
mv .env.example .env | |
# overwrite image path | |
sed -i "s|ghcr.io/slub/dfg-viewer|ghcr.io/markusweigelt/dfg-viewer|g" .env | |
- name: Run DFG-Viewer using Docker Compose | |
working-directory: dfg-viewer/Docker | |
run: | | |
docker compose up -d | |
- name: Install 3D viewer integrations | |
run: | | |
docker exec -u root -i dfg-viewer-app-1 sh -c "\ | |
apt-get update && apt-get install unzip \ | |
&& wget "https://github.com/slub/dlf-3d-viewers/archive/refs/heads/main.zip" -O /tmp/dlf-3d-viewers.zip \ | |
&& cd /var/www/html/dfg-viewer/public/fileadmin\ | |
&& unzip /tmp/dlf-3d-viewers.zip\ | |
&& mv dlf-3d-viewers-main dlf_3d_viewers\ | |
&& rm /tmp/dlf-3d-viewers.zip\ | |
&& sh dlf_3d_viewers/install.sh\ | |
&& chown -R www-data:www-data dlf_3d_viewers" | |
# workaround for issue https://github.com/slub/dlf-3d-viewers/issues/93 | |
- name: Install PLY 3D model | |
run: | | |
docker exec -u root -i dfg-viewer-app-1 sh -c "\ | |
wget "https://github.com/cnr-isti-vclab/3DHOP/raw/refs/heads/master/examples/models/gargo.ply" -O /var/www/html/dfg-viewer/public/fileadmin/models/gargo.ply \ | |
&& chown -R www-data:www-data models" | |
# installation routine of ngrok https://dashboard.ngrok.com/get-started/setup/linux | |
- name: Install ngrok | |
run: | | |
curl -sSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc \ | |
| sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null \ | |
&& echo "deb https://ngrok-agent.s3.amazonaws.com buster main" \ | |
| sudo tee /etc/apt/sources.list.d/ngrok.list \ | |
&& sudo apt update \ | |
&& sudo apt install ngrok | |
- name: Run ngrok to make DFG-Viewer available | |
timeout-minutes: 61 | |
run: | | |
# set auth token from repository secrets | |
ngrok config add-authtoken ${{ secrets.NGROK_AUTH_TOKEN }} | |
# set timeout for ngrok command and exit without failure of the current step | |
timeout 60m ngrok http --url=bear-genuine-hookworm.ngrok-free.app 80 \ | |
|| ( [[ $? -eq 124 ]] && echo "WARNING: Timeout reached, but step succeed" ) | |