Skip to content

File server that tracks, downloads, and serves the latest published artifacts from a github repo based on configuration

Notifications You must be signed in to change notification settings

CHTC/ArtifactServer

Repository files navigation

Release File Server

Serves artifact files from a configured Github repository.

Features include:

  • Automatic content updates
  • Atomic updates to files to eliminate downtime
  • Provided webhook to manually trigger updates
  • Build information available at /.ArtifactServer/metadata.json
    • Last update, last check, errors

How to Use

In your Github Action

Rebuild your artifacts at least more often then the retention period you set in the upload-pages-artifact step.

on:
  # Run at least every month to be safe
  schedule:
    - cron: "0 0 1 * *"

Use upload-pages-artifact to upload the files you want to serve. https://github.com/actions/upload-pages-artifact

- name: Upload static files as artifact
  id: deployment
  uses: actions/upload-pages-artifact@v3
  with:
    path: <path to build output>
    retention-days: 90

Hit the webhook after artifact upload to toggle a reload of assets.

  # Deployment job
  deploy:
    if: github.event_name != 'pull_request' && github.ref =='refs/heads/main'
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Hit Web Hook
        run: |
          curl -X 'POST' \
            'https://<site-root>/api/api/hooks/release-download-toggle' \
            -H 'accept: application/json' \
            -d ''

Set the following environment variables in your images (NGINX and Webhook)

GITHUB_REPO=<repo_owner>/<repo_name> # e.g., CHTC/chtc-website-source
GITHUB_TOKEN=<>

Development

Build, Run, Release

Build

docker build -t artifact-webhook .
docker run -it -p 8080:8000 --env-file .env -v ${PWD}/srv:/srv artifact-webhook

Release

docker build --platform linux/amd64 -t hub.opensciencegrid.org/opensciencegrid/artifact-webhook:latest .
docker push hub.opensciencegrid.org/opensciencegrid/artifact-webhook:latest

Run the NGINX server that sits in front of the webhook

docker run -it -p 80:80 -v ${PWD}/srv:/srv  -v ${PWD}/nginx.conf:/etc/nginx/nginx.conf:ro nginx

About

File server that tracks, downloads, and serves the latest published artifacts from a github repo based on configuration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published