-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #368 from cioos-siooc/migrate-cioos-form
Migrate CIOOS Metadata
- Loading branch information
Showing
28 changed files
with
777 additions
and
148 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node | ||
{ | ||
"name": "Node.js & TypeScript", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bookworm", | ||
"features": { | ||
"ghcr.io/devcontainers-extra/features/firebase-cli:2": { | ||
"version": "13.20.0" | ||
}, | ||
"ghcr.io/devcontainers/features/java:1": { | ||
"version": "23" | ||
} | ||
|
||
}, | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
"forwardPorts": [4000,4500,5001,5002,8081,9001,9150,9099] | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "yarn install", | ||
|
||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ xml | |
key.json | ||
deploy.sh | ||
record.json | ||
metadata |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
# CIOOS Records Update | ||
|
||
This is a basic Flask app to create XML from the metadata form | ||
Section contains all the different compontents used to synchronized the cioos catalogues with the metadata-entry-form. | ||
|
||
Both services share the same volume of data where one generates and maintains the different forms and the second provides access to the forms. | ||
|
||
## metadata-entry-forms-web-api | ||
A basic Flask app to create XML from the metadata form | ||
|
||
Requires `key.json` which contains a service account key json | ||
specifically one from [here](https://console.cloud.google.com/iam-admin/serviceaccounts/details/108735728189650899572/keys?authuser=0&hl=en&project=cioos-metadata-form) you can also generate one [here](https://console.firebase.google.com/u/0/project/cioos-metadata-form/settings/serviceaccounts/adminsdk) | ||
|
||
Alternatively the same service account key json string can be specified in the FIREBASE_SERVICE_ACCOUNT_KEY environment variable. The app will look for the environment variable first and fall back to the key.json file if ot found. | ||
|
||
## metadata-entry-forms-waf | ||
|
||
The metadata-entry-forms-waf service is used to retrieve the metadata forms generated by the metadata entry form. | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
version: "3" | ||
services: | ||
web: | ||
container_name: metadata-entry-forms-web-api | ||
build: . | ||
ports: | ||
- "8091:8000" | ||
volumes: | ||
- /var/www/html/dev/metadata:/usr/src/app/xml | ||
- cioos_metadata_form_files:/usr/src/app/xml | ||
environment: | ||
FLASK_ENV: production | ||
restart: always | ||
waf: | ||
image: nginx:alpine | ||
container_name: metadata-entry-forms-waf | ||
ports: | ||
- "8092:80" | ||
volumes: | ||
- ./waf/nginx.conf:/etc/nginx/conf.d/default.conf | ||
- ./waf/header.html:/usr/share/nginx/html/files/header.txt | ||
- ./waf/footer.html:/usr/share/nginx/html/files/footer.txt | ||
- cioos_metadata_form_files:/usr/share/nginx/html/metadata:ro | ||
|
||
volumes: | ||
cioos_metadata_form_files: | ||
external: true | ||
name: cioos-metadata-form-files |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
wget --no-parent -r "https://pac-dev1.cioos.org/dev/metadata" -A ".xml" -A ".yaml" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Check if the folder to be copied is provided as an argument | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 /path/to/local/folder" | ||
exit 1 | ||
fi | ||
|
||
# Define the folder to be copied and the volume name | ||
FOLDER_TO_COPY=$1 | ||
VOLUME_NAME="cioos-metadata-form-files" | ||
|
||
# if the volume exists remove its content | ||
if docker volume inspect ${VOLUME_NAME} &> /dev/null; then | ||
echo "Volume ${VOLUME_NAME} exists. Removing its content..." | ||
docker run --rm -v ${VOLUME_NAME}:/data busybox rm -rf /data/* | ||
fi | ||
|
||
# Create a temporary container with the volume mounted | ||
TEMP_CONTAINER=$(docker run -d -v ${VOLUME_NAME}:/data busybox sleep 3600) | ||
|
||
# Copy the folder to the volume | ||
docker cp ${FOLDER_TO_COPY} ${TEMP_CONTAINER}:/data | ||
|
||
# Stop and remove the temporary container | ||
docker rm -f ${TEMP_CONTAINER} | ||
|
||
echo "Folder ${FOLDER_TO_COPY} has been copied to the Docker volume ${VOLUME_NAME}." |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
</ul> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Directory Listing</title> | ||
<style> | ||
body { | ||
font-family: Arial, sans-serif; | ||
margin: 0; | ||
padding: 20px; | ||
background-color: #f4f4f4; | ||
} | ||
h1 { | ||
color: #333; | ||
} | ||
ul { | ||
list-style-type: none; | ||
padding: 0; | ||
} | ||
li { | ||
margin: 5px 0; | ||
} | ||
a { | ||
text-decoration: none; | ||
color: #007bff; | ||
} | ||
a:hover { | ||
text-decoration: underline; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>CIOOS Metadata Forms</h1> | ||
This page present the list of metadata forms generated by the <a href="https://cioos-siooc.github.io/metadata-entry-form/#/en/region-select">cioos metadata forms</a> . | ||
<ul> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
location / { | ||
alias /usr/share/nginx/html/; | ||
autoindex on; | ||
autoindex_exact_size off; | ||
autoindex_localtime off; | ||
index index.html; | ||
add_before_body /files/header.txt; | ||
add_after_body /files/footer.txt; | ||
types { | ||
text/plain yaml; | ||
text/xml xml; | ||
} | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.12 |
Oops, something went wrong.