From 4023151713247f472548d069ba0121e2157b40bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hampus=20N=C3=A4sstr=C3=B6m?= Date: Wed, 6 Mar 2024 09:07:00 +0100 Subject: [PATCH] 1 make into template (#2) * Updated README and default plugins * Updated nomad-oasis.zip * Update cron schedule for Docker workflow * Add manual workflow dispatch option * Add repository initialization workflow and build workflow --- .github/workflows/docker-publish.yml | 15 +-- .github/workflows/initialize.yml | 124 ++++++++++++++++++ README.md | 45 ++----- nomad-oasis_files/nomad-oasis.zip | Bin 15217 -> 4918 bytes .../nomad-oasis/configs/nomad.yaml | 8 +- .../nomad-oasis/docker-compose.yaml | 8 +- .../scripts/update_nomad_oasis_dir.sh | 20 --- nomad.yaml | 8 +- plugins.txt | 5 +- template_README.md | 86 ++++++++++++ 10 files changed, 239 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/initialize.yml delete mode 100755 nomad-oasis_files/scripts/update_nomad_oasis_dir.sh create mode 100644 template_README.md diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index e60154e..a22ccf3 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -7,13 +7,15 @@ name: Docker on: schedule: - - cron: '43 11 * * *' + - cron: '00 03 * * 0' push: branches: [ "main" ] # Publish semver tags as releases. tags: [ 'v*.*.*' ] pull_request: branches: [ "main" ] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: env: # Use docker.io for Docker Hub if empty @@ -23,17 +25,6 @@ env: jobs: - compress: - - name: Compress nomad-oasis configs - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Updated and compress the nomad-oasis directory - run: bash ${PWD}/nomad-oasis_files/scripts/update_nomad_oasis_dir.sh ${{ github.repository }} build: diff --git a/.github/workflows/initialize.yml b/.github/workflows/initialize.yml new file mode 100644 index 0000000..ac1506e --- /dev/null +++ b/.github/workflows/initialize.yml @@ -0,0 +1,124 @@ + +name: Template Repository Initialization + +on: + # Triggers the workflow on creation of repository + create: + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + +permissions: + contents: write + +jobs: + initialize_repository: + if: github.repository != 'FAIRmat-NFDI/nomad-distribution-template' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + # Replaces the template repository name in the README with the new one + - name: Update README + run: | + sed -i "s|GITHUB_REPOSITORY_OWNER|${{ github.repository_owner }}|g" template_README.md + sed -i "s|GITHUB_REPOSITORY|${{ github.repository }}|g" template_README.md + mv template_README.md README.md + + # Replaces the template repository name in the docker config file with the new one + - name: Update docker-compose.yml + run: | + cd nomad-oasis_files + sed -i "s|FAIRMAT_NFDI/nomad-distribution-template|${{ github.repository }}|g" docker-compose.yml + zip -r nomad-oasis.zip nomad-oasis + cd .. + + # Deletes this workflow file to prevent it from running on branch creation + - name: Delete initialization workflow + run: rm .github/workflows/initialize.yml + + # Commits all changes + - name: Commit repository initialization + run: | + git config --global user.name github-actions + git config --global user.email github-actions@github.com + git commit -am "Repository initialization" + git push + + build: + if: github.repository != 'FAIRmat-NFDI/nomad-distribution-template' + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Install the cosign tool except on PR + # https://github.com/sigstore/cosign-installer + - name: Install cosign + if: github.event_name != 'pull_request' + uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1 + with: + cosign-release: 'v2.1.1' + + # Set up BuildKit Docker container builder to be able to build + # multi-platform images and export cache + # https://github.com/docker/setup-buildx-action + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + # Sign the resulting Docker image digest except on PRs. + # This will only write to the public Rekor transparency log when the Docker + # repository is public to avoid leaking data. If you would like to publish + # transparency data even for private images, pass --force to cosign below. + # https://github.com/sigstore/cosign + - name: Sign the published Docker image + if: ${{ github.event_name != 'pull_request' }} + env: + # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable + TAGS: ${{ steps.meta.outputs.tags }} + DIGEST: ${{ steps.build-and-push.outputs.digest }} + # This step uses the identity token to provision an ephemeral certificate + # against the sigstore community Fulcio instance. + run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} \ No newline at end of file diff --git a/README.md b/README.md index bf180a1..3647ce1 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,18 @@ -![docker image](https://github.com/hampusnasstrom/nomad-example-image/actions/workflows/docker-publish.yml/badge.svg) -# nomad-example-image -An example repository for creating a nomad image with custom plugins. +![docker image](https://github.com/FAIRmat-NFDI/nomad-distribution-template/actions/workflows/docker-publish.yml/badge.svg) + +> [!IMPORTANT] +> The templated repository will run a GitHub action on creation which might take a few momements. +> After the workflow finishes you should refresh the page and this message should disappear. + +# NOMAD Oasis Distribution *Template* +This repository is a template for creating your own custom NOMAD Oasis distribution image. +Click [here](https://github.com/new?template_name=nomad-distribution-template&template_owner=FAIRmat-NFDI) +to use this template, or click the `Use this template` button in the upper right corner of +the main GitHub page for this template. ## Deploying the image -To deploy this NOMAD Oasis image you should follow the instructions on [nomad-lab.eu/prod/v1/docs/oasis/install.html](https://nomad-lab.eu/prod/v1/docs/oasis/install.html) but replace the Docker image in `docker-compose.yaml` with `ghcr.io/hampusnasstrom/nomad-example-image:main` for the services `worker`, `app`, `north`, and `logtransfer`. +To deploy this NOMAD Oasis image you should follow the instructions on [nomad-lab.eu/prod/v1/docs/oasis/install.html](https://nomad-lab.eu/prod/v1/docs/oasis/install.html) but replace the Docker image in `docker-compose.yaml` with `ghcr.io/FAIRmat-NFDI/nomad-distribution-template:main` for the services `worker`, `app`, `north`, and `logtransfer`. Remember to also update the `nomad.yaml` config file to include the new plugins. @@ -34,32 +42,3 @@ the container has to be run under the docker group. You need to replace the defa id `991` in the `docker-compose.yaml`'s `hub` section with your systems docker group id. Run `id` if you are a docker user, or `getent group | grep docker` to find our your systems docker gid. The user id 1000 is used as the nomad user inside all containers. - -## Adding a plugin - -To add a new plugin to the docker image you should add it to the [plugins.txt](plugins.txt) file. - -Here you can put either plugins distributed to PyPI, e.g. -``` -nomad-material-processing -``` -or plugins in a git repository with either the commit hash -``` -git+https://github.com/FAIRmat-NFDI/nomad-measurements.git@71b7e8c9bb376ce9e8610aba9a20be0b5bce6775 -``` -or with a tag -``` -git+https://github.com/FAIRmat-NFDI/nomad-measurements.git@v0.0.4 -``` -To add a plugin in a subdirectory of a git repository you can use the `subdirectory` option, e.g. -``` -git+https://github.com/FAIRmat-NFDI/AreaA-data_modeling_and_schemas.git@30fc90843428d1b36a1d222874803abae8b1cb42#subdirectory=PVD/PLD/jeremy_ikz/ikz_pld_plugin -``` - -Once the changes have been committed to the main branch, the new image will automatically be generated. - -## Create your own image - -To create your own custom NOMAD Oasis image you can fork this repository and publish your own docker image. -1. Fork repository -2. Enable the GitHub workflow action diff --git a/nomad-oasis_files/nomad-oasis.zip b/nomad-oasis_files/nomad-oasis.zip index 606a3debcebc07dc2225a66df835bb632c8b1894..1d6684ef9dc7ab7c3a6d51f626071c9693330c97 100644 GIT binary patch delta 2625 zcmZWr2{e@5AAV{Nu(d}^Ys)oY!}UP!`7CNUK; zNoAxoAzKPr^9g1B&-Cy6jz0H2_dVx6zx({|{hi-E=XvI%>i6>4TEf_N0IWeW#a-jU zaA=_?{FoCQ;S+@^nBqVLOo8L5=!Bn-C<{Y@`A9g-$p8mB!!$YKcTV_S-8pgZ8f*%> zQ`!{gY9d~BGZMl~1_OOyXmAa+6Yt36viOnFTmXb^0tNs-f2r4Bgx=ZDov>`c-dHJm zosYl0B1~Of174a(qM14kK1w*$FDBpp1?n?R-}A{=8hPy$u?L(->$YL?**+Z!P)Yi?P=Gdm6XZ3wk4~%Q)Dcw z-za8-5I_L4Ux_2lSwwaK_$~+ll7JWhRtrjV^f0@{oM4}z9NyxvsVZdUq`uQTU+nvq zrH73{?v4Za$GwaC@7df%7m0(nuLaT#@8##kjQP1CX?uu$85kN1>Qr^)cGeO-m&5g>f~~#>|E#vMasU02>7U- zziQL$fahS(mnD@OIu~y*rO znQPps_pu09GBJ|gsC|nZc1ExFOnaUo+1TDApp6Ma@}Dt(H)P<^@O0mB>-jac^vkg? zi%-8^E2JdZL)6;HseQ`cp^`F$v0?>Zvl>LoL0M&GyZA-*7K|v$qKy;D-^z(Qk7#z= z&ux6zS1Ck4haa*S?^5cl5f}L7neXTdX}u-*>5xuLN#@dV~wOR!1k20qiG-aN`>v0MiK$8wVwS`{tdZF z(Tf9gH%|d!nwWV%#`^j&w+(!-J>y?5_*nEX`9pwA_xJZ z%0%-Axi0$4tRHKn-7fFfA&;XHv#S`9rD=?rbh?w265h`~GH%#=(yz9*+aT>sVnfYT zr$nh=VEHYi#x!=psy|;^m*-m%^tiB^*Kt<@DLwwh>9Ii)CUBvVfAveU^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(L0N)L0P12UKCKyF-YS;43AY@Z#`WlwvQ^|#f ze(Xaek{_3_e^nV4Ac3Zmq-;1G;im8)uK?w8<4tdO@#JkI)@GEVrdv!b8-Tbd4b5c# znZPfjugTziL7aH*1Gl&$N8t2L}1XIO*A1`^4cGEtsKoUs_S-DIeNfD@9$+!Fb zHgcqo#i*r2kB?MQXUCxAPPTC&g-|f&`LGM(9MNd^lcS~J0^*`l0ubU|BkC3M zg>7j5f?!?<1p90LhTt?noc|#RuJSI@)~;sHUC3$22uj+C-1+t{`4dVB1cFO#wtG$D zIUx}2o=uN;S&gzSfFoIhDx^UM#xPMS<-RGM5S&}#knv8v0Jlv79>s%~9keB)do^an zhAeLs?>%{u?$O}1F%+CHb$8ev^3?yXyuqsVa5ar#BM(3?;mFxfc8L-V|Skr zlVi^DotAbO2Zn+BJm7FK{w#raFqQ5e75%lWzpF!;c?YLv$0_P(j6JFYeL{nAq)&d` z{;yOzOFI}2*tq`_o3n=>^#QZ7)6M=x{?Q!pxq^9W-~F2iJecM&ryHF$1%E~f0IWMSON;?Tw6(R%;ysCw$z2+7PtM|ys?;d_Gp zb?_JxR{PceQxfrLIr_Ivsb?^R(hu336pH)B>0^C<}| zIp!_spTT>0Q+ROozx`W}Uzu~3s9`!V$GFM6kKVV5f`FG9y z8FOce>Yr=oM^xYb$6nAS_tCf4za#ajXA#XmZQ-FH-+z~VY{355J|BI#`rEbC)1U6| cTu;jNV>1^4vKt2g7$E;ckZsOA=KWv)2fi2zU;qFB diff --git a/nomad-oasis_files/nomad-oasis/configs/nomad.yaml b/nomad-oasis_files/nomad-oasis/configs/nomad.yaml index dc9f26c..6b03954 100644 --- a/nomad-oasis_files/nomad-oasis/configs/nomad.yaml +++ b/nomad-oasis_files/nomad-oasis/configs/nomad.yaml @@ -26,9 +26,9 @@ elastic: plugins: options: - parsers/nomad_measurements/xrd: - python_package: nomad_measurements.xrd + schemas/nomad_material_processing: + python_package: nomad_material_processing schemas/nomad_measurements: python_package: nomad_measurements - schemas/ikz_pld: - python_package: ikz_pld \ No newline at end of file + parsers/nomad_measurements/xrd: + python_package: nomad_measurements.xrd.parser \ No newline at end of file diff --git a/nomad-oasis_files/nomad-oasis/docker-compose.yaml b/nomad-oasis_files/nomad-oasis/docker-compose.yaml index 7768205..13f6179 100644 --- a/nomad-oasis_files/nomad-oasis/docker-compose.yaml +++ b/nomad-oasis_files/nomad-oasis/docker-compose.yaml @@ -70,7 +70,7 @@ services: # nomad worker (processing) worker: restart: unless-stopped - image: ghcr.io/hampusnasstrom/nomad-example-image:main + image: ghcr.io/FAIRmat-NFDI/nomad-distribution-template:main container_name: nomad_oasis_worker environment: NOMAD_SERVICE: nomad_oasis_worker @@ -93,7 +93,7 @@ services: # nomad app (api + proxy) app: restart: unless-stopped - image: ghcr.io/hampusnasstrom/nomad-example-image:main + image: ghcr.io/FAIRmat-NFDI/nomad-distribution-template:main container_name: nomad_oasis_app environment: NOMAD_SERVICE: nomad_oasis_app @@ -132,7 +132,7 @@ services: # nomad remote tools hub (JupyterHUB, e.g. for AI Toolkit) north: restart: unless-stopped - image: ghcr.io/hampusnasstrom/nomad-example-image:main + image: ghcr.io/FAIRmat-NFDI/nomad-distribution-template:main container_name: nomad_oasis_north environment: NOMAD_SERVICE: nomad_oasis_north @@ -167,7 +167,7 @@ services: # to enable the logtransfer service run "docker compose --profile with_logtransfer up" logtransfer: restart: unless-stopped - image: ghcr.io/hampusnasstrom/nomad-example-image:main + image: ghcr.io/FAIRmat-NFDI/nomad-distribution-template:main container_name: nomad_oasis_logtransfer environment: NOMAD_SERVICE: nomad_oasis_logtransfer diff --git a/nomad-oasis_files/scripts/update_nomad_oasis_dir.sh b/nomad-oasis_files/scripts/update_nomad_oasis_dir.sh deleted file mode 100755 index 11e286a..0000000 --- a/nomad-oasis_files/scripts/update_nomad_oasis_dir.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -set -e - -working_dir=$(pwd) -project_dir=$(dirname $(dirname $(dirname $(realpath $0)))) - -cd $project_dir - -# Copy nomad.yaml to the configs directory -cp -rf nomad.yaml nomad-oasis_files/nomad-oasis/configs/nomad.yaml - -# Replace the default docker image path with the actual docker image path -if [[ -n $1 ]]; then - sed -i "s|hampusnasstrom/nomad-example-image|$1|g" nomad-oasis_files/nomad-oasis/docker-compose.yaml - sed -i "s|hampusnasstrom/nomad-example-image|$1|g" README.md -fi - -# Compress the nomad-oasis directory -zip -r nomad-oasis_files/nomad-oasis.zip nomad-oasis_files/nomad-oasis \ No newline at end of file diff --git a/nomad.yaml b/nomad.yaml index dc9f26c..6b03954 100644 --- a/nomad.yaml +++ b/nomad.yaml @@ -26,9 +26,9 @@ elastic: plugins: options: - parsers/nomad_measurements/xrd: - python_package: nomad_measurements.xrd + schemas/nomad_material_processing: + python_package: nomad_material_processing schemas/nomad_measurements: python_package: nomad_measurements - schemas/ikz_pld: - python_package: ikz_pld \ No newline at end of file + parsers/nomad_measurements/xrd: + python_package: nomad_measurements.xrd.parser \ No newline at end of file diff --git a/plugins.txt b/plugins.txt index bc92784..041a1f0 100644 --- a/plugins.txt +++ b/plugins.txt @@ -1,3 +1,2 @@ -git+https://github.com/FAIRmat-NFDI/nomad-material-processing.git@55918771f1191ac31ae5e0d06a579b513886f3b2 -git+https://github.com/FAIRmat-NFDI/AreaA-data_modeling_and_schemas.git@bb8422d5aefe114ae7e4e677262e99fecf26dcaf#subdirectory=PVD/PLD/jeremy_ikz/ikz_pld_plugin -git+https://github.com/FAIRmat-NFDI/nomad-measurements.git@50f199830517ae9753c5fccea1efe2983ed7781f +nomad-measurements +nomad-material-processing diff --git a/template_README.md b/template_README.md new file mode 100644 index 0000000..93282b5 --- /dev/null +++ b/template_README.md @@ -0,0 +1,86 @@ +![docker image](https://github.com/GITHUB_REPOSITORY/actions/workflows/docker-publish.yml/badge.svg) + +# GITHUB_REPOSITORY_OWNER's NOMAD Oasis Distribution + +This is the NOMAD Oasis distribution of GITHUB_REPOSITORY_OWNER. +Below are instructions for how to [deploy this image](#deploying-the-image) and how to +customize it through [adding plugins](#adding-a-plugin). + +> [!IMPORTANT] +> Depending on the settings of the owner of this repository, the distributed image might +> be private and require authentication to pull. +> If you are the owner you should make sure that your organization settings allow public +> packages and after that set this package public. +> You can read more about this in the GitHub docs [here](https://docs.github.com/en/packages/learn-github-packages/configuring-a-packages-access-control-and-visibility). + +## Deploying the image + +To deploy this NOMAD Oasis image you should follow the instructions on +[nomad-lab.eu/prod/v1/docs/oasis/install.html](https://nomad-lab.eu/prod/v1/docs/oasis/install.html) +but replace the Docker image in `docker-compose.yaml` with `ghcr.io/GITHUB_REPOSITORY:main` +for the services `worker`, `app`, `north`, and `logtransfer`. + +Remember to also update the `nomad.yaml` config file to include the new plugins. + +### Quick-start + +- Find a linux computer. +- Make sure you have [docker](https://docs.docker.com/engine/install/) installed. +Docker nowadays comes with `docker compose` build in. Prior, you needed to +install the stand alone [docker-compose](https://docs.docker.com/compose/install/). +- Download the modified configuration files [nomad-oasis.zip](nomad-oasis_files/nomad-oasis.zip) from this repository. +- Run the following commands (skip `chown` on MacOS and Windows computers) + + +```sh +unzip nomad-oasis.zip +cd nomad-oasis +sudo chown -R 1000 .volumes +docker compose pull +docker compose up -d +curl localhost/nomad-oasis/alive +``` + +- Open [http://localhost/nomad-oasis](http://localhost/nomad-oasis) in your browser. + +To run NORTH (the NOMAD Remote Tools Hub), the `hub` container needs to run docker and +the container has to be run under the docker group. You need to replace the default group +id `991` in the `docker-compose.yaml`'s `hub` section with your systems docker group id. +Run `id` if you are a docker user, or `getent group | grep docker` to find our your +systems docker gid. The user id 1000 is used as the nomad user inside all containers. + +## Adding a plugin + +To add a new plugin to the docker image you should add it to the [plugins.txt](plugins.txt) file. + +Here you can put either plugins distributed to PyPI, e.g. +``` +nomad-material-processing +``` +or plugins in a git repository with either the commit hash +``` +git+https://github.com/FAIRmat-NFDI/nomad-measurements.git@71b7e8c9bb376ce9e8610aba9a20be0b5bce6775 +``` +or with a tag +``` +git+https://github.com/FAIRmat-NFDI/nomad-measurements.git@v0.0.4 +``` +To add a plugin in a subdirectory of a git repository you can use the `subdirectory` option, e.g. +``` +git+https://github.com/FAIRmat-NFDI/AreaA-data_modeling_and_schemas.git@30fc90843428d1b36a1d222874803abae8b1cb42#subdirectory=PVD/PLD/jeremy_ikz/ikz_pld_plugin +``` + +If the plugin is new, you also need to add it under `plugins` in the [nomad.yaml](nomad.yaml) +config file that will be included in the image. +For example, if you have added a schema plugin `nomad_material_processing` you should add +the following: + +```yaml +plugins: + options: + schemas/nomad_material_processing: + python_package: nomad_material_processing +``` + +Once the changes have been committed to the main branch, the new image will automatically +be generated. \ No newline at end of file