-
Notifications
You must be signed in to change notification settings - Fork 0
add mvp #1
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
Merged
Merged
add mvp #1
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
faa3961
add mvp
jashan-lco 4588805
add github actions workflow to push docker image
jashan-lco d83dc1b
clean up on ctrl-c
jashan-lco 9a2b82b
set site --name default to 'ogg'
jashan-lco b78baf5
just use last_schedule_time as the last sync time
jashan-lco 9a84776
don't wait until observation end time
jashan-lco f87adf0
rename ObservationTask.waiting to .started
jashan-lco 40d0f51
only fetch the schedule for the next 7 days
jashan-lco b2f7ab6
update docs
jashan-lco 8479db0
remove v prefix for match on semver tags
jashan-lco b66de75
tag default branch docker image as latest too
jashan-lco 5ee4c72
spell check
jashan-lco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| **/*.pyc | ||
| **/*__pycache__ |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| name: Publish Docker Image | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - mvp # TODO: remove after testing | ||
| # Publish semver tags as releases. | ||
| tags: | ||
| - '*.*.*' | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| env: | ||
| # Use docker.io for Docker Hub if empty | ||
| REGISTRY: ghcr.io | ||
| # github.repository as <account>/<repo> | ||
| IMAGE_NAME: ${{ github.repository }} | ||
|
|
||
|
|
||
| jobs: | ||
| build: | ||
|
|
||
| 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@v2 | ||
|
|
||
| # 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@1e95c1de343b5b0c23352d6417ee3e48d5bcd422 | ||
| with: | ||
| cosign-release: 'v1.4.0' | ||
|
|
||
|
|
||
| # Workaround: https://github.com/docker/build-push-action/issues/461 | ||
| - name: Setup Docker buildx | ||
| uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf | ||
|
|
||
| # 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@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | ||
| 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@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
| tags: | | ||
| type=schedule | ||
| type=ref,event=branch | ||
| type=ref,event=tag | ||
| type=ref,event=pr | ||
| type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} | ||
|
|
||
| # 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@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
| with: | ||
| context: . | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
|
|
||
| # 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: | ||
| COSIGN_EXPERIMENTAL: "true" | ||
| # This step uses the identity token to provision an ephemeral certificate | ||
| # against the sigstore community Fulcio instance. | ||
| run: cosign sign ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }} | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| **/*.pyc | ||
| **/*__pycache__ |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| FROM python:3.10-slim | ||
|
|
||
| SHELL ["/bin/bash", "-c"] | ||
|
|
||
| RUN pip install poetry | ||
|
|
||
| WORKDIR /src | ||
|
|
||
| COPY pyproject.toml poetry.lock README.rst ./ | ||
|
|
||
| RUN pip install -r <(poetry export) | ||
|
|
||
| COPY ./virtual_site.py ./virtual_site.py | ||
|
|
||
| RUN pip install . | ||
|
|
||
| ENV PYTHONUNBUFFERED=true | ||
|
|
||
| ENTRYPOINT ["virtual-site"] |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| virtual-site | ||
| #### | ||
|
jashan-lco marked this conversation as resolved.
|
||
|
|
||
| Example application showcasing OCS API interactions needed to fulfill | ||
| observation requests at a telescope site. | ||
|
|
||
| You might find this helpful if you're looking to integrate your telescope's | ||
| control system with the Observatory Control System. Also, see | ||
| https://observatorycontrolsystem.github.io/integration/tcs/. | ||
|
|
||
| Usage | ||
| ---- | ||
|
|
||
| You can spin up the client straight from docker:: | ||
|
|
||
| $ docker run ghcr.io/observatorycontrolsystem/virtual-site --help | ||
| $ docker run ghcr.io/observatorycontrolsystem/virtual-site \ | ||
| --name ogg \ | ||
| --api-url http://localhost:8000/api/ \ | ||
| --api-token 'sutoken1234abcd' | ||
|
|
||
| Development | ||
| ---- | ||
|
|
||
| Install dependencies:: | ||
|
|
||
| $ poetry install | ||
|
|
||
| Run:: | ||
|
|
||
| $ poetry run virtual-site --name ogg --api-url http://localhost:8000/api/ --api-token 'sutoken1234abcd' | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| [tool.poetry] | ||
| name = "virtual-site" | ||
| version = "0.1.0" | ||
| description = "Virtual OCS Site" | ||
| authors = ["Jashandeep Sohi <jsohi.lco.global>"] | ||
|
|
||
| [tool.poetry.dependencies] | ||
| python = "^3.10" | ||
| click = "^8.0.3" | ||
| httpx = "^0.21.3" | ||
| arrow = "^1.2.1" | ||
|
|
||
| [build-system] | ||
| requires = ["poetry-core>=1.0.0"] | ||
| build-backend = "poetry.core.masonry.api" | ||
|
|
||
| [tool.poetry.scripts] | ||
| virtual-site = "virtual_site:cli" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.