Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti committed Nov 12, 2024
0 parents commit ebfdaca
Show file tree
Hide file tree
Showing 44 changed files with 2,511 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[Makefile]
indent_style = tab
66 changes: 66 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Sourcemeta Schemas

on:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref_type }}
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
packages: read
deployments: write
contents: write
env:
KRAFTCLOUD_METRO: was1
KRAFTKIT_NO_CHECK_UPDATES: true
SERVICE_DOMAIN: schemas.sourcemeta.com
steps:
- uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}

- uses: actions/checkout@v4

- uses: chrnorm/deployment-action@v2
id: deploy-github
with:
token: '${{ github.token }}'
environment-url: https://${{ env.SERVICE_DOMAIN }}
environment: production

- id: deploy
uses: unikraft/[email protected]
with:
run: |
set -o errexit
set -o nounset
kraft cloud service create --name schemas --domain ${{ env.SERVICE_DOMAIN }} 443:8000 || true
kraft cloud deploy --memory 64 --rollout remove --image schemas --service schemas --kraftfile Kraftfile --restart on-failure --replicas 2 .
kraft cloud service get schemas
kraft cloud instance logs "$(kraft cloud service get schemas --output json | jq --raw-output '.[0].instances | split(" ") | .[0]')"
curl --location --fail https://${{ env.SERVICE_DOMAIN }}
env:
KRAFTCLOUD_TOKEN: ${{ secrets.KRAFTCLOUD_TOKEN }}

# Update deployment status
- if: ${{ steps.deploy.outcome == 'success' }}
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
environment-url: '${{ steps.deploy-github.outputs.environment_url }}'
deployment-id: '${{ steps.deploy-github.outputs.deployment_id }}'
state: 'success'
- if: ${{ steps.deploy.outcome != 'success' }}
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
environment-url: '${{ steps.deploy-github.outputs.environment_url }}'
deployment-id: '${{ steps.deploy-github.outputs.deployment_id }}'
state: 'failure'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
/build
3 changes: 3 additions & 0 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vendorpull https://github.com/sourcemeta/vendorpull dea311b5bfb53b6926a4140267959ae334d3ecf4
nasa-gcn-4-1-0 https://github.com/nasa-gcn/gcn-schema v4.1.0
osv-schema-1-6-3 https://github.com/ossf/osv-schema v1.6.3
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ghcr.io/sourcemeta/registry:main AS builder
COPY configuration.json /app/configuration.json
COPY vendor /app/vendor
RUN sourcemeta-registry-index /app/configuration.json /app/index

FROM scratch
COPY --from=builder /usr/bin/sourcemeta-registry-server \
/usr/bin/sourcemeta-registry-server
COPY --from=builder /app/index /app/index

# Linker
COPY --from=builder /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2
COPY --from=builder /etc/ld.so.cache /etc/ld.so.cache
# Based on an ldd(1) output on Debian Bookworm
COPY --from=builder /lib/x86_64-linux-gnu/libstdc++.so.6 /lib/x86_64-linux-gnu/
COPY --from=builder /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib/x86_64-linux-gnu/
COPY --from=builder /lib/x86_64-linux-gnu/libc.so.6 /lib/x86_64-linux-gnu/
COPY --from=builder /lib/x86_64-linux-gnu/libm.so.6 /lib/x86_64-linux-gnu/
7 changes: 7 additions & 0 deletions Kraftfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
spec: v0.6
runtime: base:latest
rootfs: ./Dockerfile
labels:
cloud.unikraft.v1.instances/scale_to_zero.policy: "on"
cloud.unikraft.v1.instances/scale_to_zero.cooldown_time_ms: 5000
cmd: [ "/usr/bin/sourcemeta-registry-server", "/app/index" ]
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
all: local
# For local development, assuming https://github.com/sourcemeta/registry
# is cloned and built as a sibling directory of this repository
local: .always
../registry/build/dist/bin/sourcemeta-registry-index configuration.json ./build
../registry/build/dist/bin/sourcemeta-registry-server ./build
.always:
16 changes: 16 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Welcome to Sourcemeta Schemas
=============================

This repository manages the public deployment of
[https://schemas.sourcemeta.com](https://schemas.sourcemeta.com), a public
instance of the [Sourcemeta Registry](https://github.com/sourcemeta/registry)
service offering a centralized and superior experience when browsing the world
schemas.

[**Visit Sourcemeta Schemas**](https://schemas.sourcemeta.com)

Adding Schemas
--------------

If you want any GitHub repository of schemas included, please open a [GitHub
Issue](https://github.com/sourcemeta/schemas/issues) and we will get into it.
14 changes: 14 additions & 0 deletions configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"url": "https://schemas.sourcemeta.com",
"port": 8000,
"collections": {
"nasa/gcn/v4.1.0": {
"base": "https://gcn.nasa.gov/schema/v4.1.0/gcn",
"path": "./vendor/nasa-gcn-4-1-0"
},
"ossf/osv/v1.6.3": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-6-3"
}
}
}
30 changes: 30 additions & 0 deletions vendor/nasa-gcn-4-1-0.mask
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.husky/
.npmrc
index.js
package-lock.json
package.json
README.md
update-tags.mjs
validate.mjs
gcn/notices/glowbug/Alert.example.json
gcn/notices/core/Reporter.example.json
gcn/notices/core/Statistics.example.json
gcn/notices/core/Localization.example.json
gcn/notices/core/Pointing.example.json
gcn/notices/burstcube/test.example.json
gcn/notices/burstcube/alert.example.json
gcn/notices/heasarc/archive_alert.example.json
gcn/notices/swift/bat/guano.loc_map.example.json
gcn/notices/swift/bat/Guano.example.json
gcn/notices/swift/bat/Guano.Retraction.example.json
gcn/notices/swift/bat/guano.loc_arc_min.example.json
gcn/notices/icecube/test/gold_bronze_track_alerts.example.json
gcn/notices/icecube/test/gold_bronze.update.example.json
gcn/notices/icecube/lvk_nu_track_search.example.json
gcn/notices/einstein_probe/wxt/alert.example.json
gcn/notices/svom/eclairs/trigger.catalog.example.json
gcn/notices/svom/eclairs/trigger.slewing.example.json
gcn/notices/svom/eclairs/trigger.not-slewing.example.json
gcn/notices/svom/eclairs/trigger.wakeup.example.json
gcn/notices/svom/grm/trigger.example.json
gcn/circulars.example.json
46 changes: 46 additions & 0 deletions vendor/nasa-gcn-4-1-0/gcn/circulars.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$id": "https://gcn.nasa.gov/schema/v4.1.0/gcn/circulars.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "GCN Circular",
"description": "GCN Circulars are rapid astronomical bulletins submitted by and distributed to community members worldwide. They are used to share discoveries, observations, quantitative near-term predictions, requests for follow-up observations, or future observing plans related to high-energy, multi-messenger, and variable or transient astrophysical events. An archive of all GCN Circulars can be found at https://gcn.nasa.gov/circulars",
"properties": {
"eventId": {
"type": "string",
"description": "Event name, automatically inferred from the subject"
},
"submitter": {
"type": "string",
"description": "Name, affiliation, and email address of the person who submitted the Circular, in the form `A. E. Einstein at IAS <[email protected]>`"
},
"submittedHow": {
"enum": ["web", "email", "email-legacy", "api"],
"description": "Specifies the method by which the user submitted the Circular"
},
"subject": {
"type": "string",
"description": "Subject line of the Circular"
},
"circularId": {
"type": "number",
"description": "Circular ID assigned to the Circular in the GCN Circulars archive. This value is unique to each published Circular and increments by 1"
},
"format": {
"enum": ["text/plain", "text/markdown"],
"description": "Format of the body text as a MIME type. See https://gcn.nasa.gov/docs/circulars/markdown for documentation on using Markdown in Circulars"
},
"body": { "type": "string", "description": "Body text" },
"createdOn": {
"type": "number",
"description": "Date and time the Circular is accepted and published onto the GCN Circulars archive, formatted as a UNIX timestamp (milliseconds since the UNIX epoch)"
}
},
"required": [
"eventId",
"submitter",
"subject",
"circularId",
"body",
"createdOn"
]
}
27 changes: 27 additions & 0 deletions vendor/nasa-gcn-4-1-0/gcn/notices/burstcube/alert.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$id": "https://gcn.nasa.gov/schema/v4.1.0/gcn/notices/burstcube/alert.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Alert",
"description": "BurstCube Trigger Alert",
"type": "object",
"allOf": [
{ "$ref": "../core/Alert.schema.json" },
{ "$ref": "../core/Reporter.schema.json" },
{ "$ref": "../core/DateTime.schema.json" },
{ "$ref": "../core/Event.schema.json" },
{ "$ref": "../core/Localization.schema.json" },
{ "$ref": "../core/Statistics.schema.json" },
{ "$ref": "../core/Duration.schema.json" }
],
"properties": {
"detector_status": {
"type": "object",
"properties": {
"CsI0": { "$ref": "../core/DetectorStatus.schema.json" },
"CsI1": { "$ref": "../core/DetectorStatus.schema.json" },
"CsI2": { "$ref": "../core/DetectorStatus.schema.json" },
"CsI3": { "$ref": "../core/DetectorStatus.schema.json" }
}
}
}
}
27 changes: 27 additions & 0 deletions vendor/nasa-gcn-4-1-0/gcn/notices/burstcube/test.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$id": "https://gcn.nasa.gov/schema/v4.1.0/gcn/notices/burstcube/test.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Alert",
"description": "BurstCube Trigger Alert",
"type": "object",
"allOf": [
{ "$ref": "../core/Alert.schema.json" },
{ "$ref": "../core/Reporter.schema.json" },
{ "$ref": "../core/DateTime.schema.json" },
{ "$ref": "../core/Event.schema.json" },
{ "$ref": "../core/Localization.schema.json" },
{ "$ref": "../core/Statistics.schema.json" },
{ "$ref": "../core/Duration.schema.json" }
],
"properties": {
"detector_status": {
"type": "object",
"properties": {
"CsI0": { "$ref": "../core/DetectorStatus.schema.json" },
"CsI1": { "$ref": "../core/DetectorStatus.schema.json" },
"CsI2": { "$ref": "../core/DetectorStatus.schema.json" },
"CsI3": { "$ref": "../core/DetectorStatus.schema.json" }
}
}
}
}
13 changes: 13 additions & 0 deletions vendor/nasa-gcn-4-1-0/gcn/notices/core/AdditionalInfo.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$id": "https://gcn.nasa.gov/schema/v4.1.0/gcn/notices/core/AdditionalInfo.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Comments",
"description": "Comments that are not summarized elsewhere in schema",
"properties": {
"additional_info": {
"type": "string",
"description": "Additional information about the event"
}
}
}
28 changes: 28 additions & 0 deletions vendor/nasa-gcn-4-1-0/gcn/notices/core/Alert.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$id": "https://gcn.nasa.gov/schema/v4.1.0/gcn/notices/core/Alert.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Alert",
"description": "Alert Information description properties of this notice",
"type": "object",
"properties": {
"alert_datetime": {
"type": "string",
"description": "Date and time of notice creation [UTC, ISO 8601], ex YYYY-MM-DDTHH:MM:SS.ssssssZ"
},
"alert_tense": {
"enum": [
"current",
"archival",
"planned",
"injection",
"commanded",
"test"
],
"description": "Indication of whether this alert refers to a recent observation (current), re-analysis of archival data (archival), a planned observation in the future (planned), a signal injection (injection), commanded trigger (commanded) or a test trigger (test)."
},
"alert_type": {
"enum": ["initial", "update", "retraction"],
"description": "Indication of alert sequence if multiple of same type sent"
}
}
}
25 changes: 25 additions & 0 deletions vendor/nasa-gcn-4-1-0/gcn/notices/core/DateTime.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$id": "https://gcn.nasa.gov/schema/v4.1.0/gcn/notices/core/DateTime.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "DateTime",
"description": "Time descriptions of transient event and observation",
"type": "object",
"properties": {
"trigger_time": {
"type": "string",
"description": "Time of the trigger [ISO 8601], ex YYYY-MM-DDTHH:MM:SS.ssssssZ"
},
"observation_start": {
"type": "string",
"description": "Start time of the observation [ISO 8601]"
},
"observation_stop": {
"type": "string",
"description": "Stop time of the observation [ISO 8601]"
},
"observation_livetime": {
"type": "number",
"description": "Livetime of the observation [s]"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$id": "https://gcn.nasa.gov/schema/v4.1.0/gcn/notices/core/DetectorStatus.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "DetectorStatus",
"enum": ["on", "off", "triggered"],
"description": "Status of a specified detector at the time of the alert"
}
19 changes: 19 additions & 0 deletions vendor/nasa-gcn-4-1-0/gcn/notices/core/Distance.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$id": "https://gcn.nasa.gov/schema/v4.1.0/gcn/notices/core/Distance.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Distance",
"description": "Luminosity Distance",
"properties": {
"luminosity_distance": {
"type": "number",
"description": "Luminosity distance [Mpc]"
},
"luminosity_distance_error": {
"type": "array",
"items": { "type": "number" },
"maxItems": 2,
"description": "Luminosity distance uncertainty [Mpc, 1-sigma], with optional asymmetric uncertainty"
}
}
}
Loading

0 comments on commit ebfdaca

Please sign in to comment.