Last active
July 14, 2020 17:56
-
-
Save sentriz/834816c9e14fb53528d1625fd3ea07d8 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
URL="https:\/\/notes-extensions.$DOMAIN" | |
ORG='joe' | |
EXT_DIR='exts_data' | |
curl -s "https://api.github.com/orgs/sn-extensions/repos?page=1&per_page=100" \ | |
| jq -r '.[].git_url' \ | |
| grep -E '\/[a-z]+\-[^\/]*.git$' \ | |
| xargs -L 1 git -C "$EXT_DIR" submodule add --depth 1 | |
grep -Po 'path\s=\s\K(.*)' "$EXT_DIR/.gitmodules" | while read name; do | |
title="$(sed -r 's/(^|-)([a-z])/ \U\2/g;s/^.//' <<< "$name")" | |
json="$EXT_DIR/$name.json" | |
[[ "$name" == *theme ]] \ | |
&& area="themes" \ | |
|| area="editor-editor" | |
cp ./standard_notes_ext_tmpl "$json" | |
sed -i "s/{{identifier}}/$ORG.$name/" "$json" | |
sed -i "s/{{title}}/$title/" "$json" | |
sed -i "s/{{area}}/$area/" "$json" | |
sed -i "s/{{url}}/$URL\/$name\/dist\//" "$json" | |
dir="$EXT_DIR/$name" | |
if [[ -f "$dir/index.html" ]]; then | |
cp "$dir/index.html" "$dir/dist/index.html" | |
sed -i 's/\bdist\///' "$dir/dist/index.html" | |
fi | |
done |
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
{ | |
"identifier": "{{identifier}}", | |
"name": "{{title}}", | |
"content_type": "SN|Component", | |
"area": "{{area}}", | |
"version": "0.0.0", | |
"url": "{{url}}" | |
} |
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
networks: | |
reverse_proxy: | |
external: true | |
services: | |
db: | |
build: ${BUILD}/standardfile | |
command: -cors -foreground -noreg | |
environment: | |
- TZ | |
expose: | |
- 8888 | |
labels: | |
traefik.enable: 'true' | |
traefik.http.routers.notes-db.entrypoints: web | |
traefik.http.routers.notes-db.rule: Host(`notes-db.${DOMAIN}`) | |
traefik.http.services.notes-db.loadbalancer.server.port: 8888 | |
networks: | |
- reverse_proxy | |
restart: unless-stopped | |
volumes: | |
- ./db_data:/stdfile | |
extensions: | |
environment: | |
- TZ | |
expose: | |
- 80 | |
image: nginx | |
labels: | |
traefik.enable: 'true' | |
traefik.http.routers.notes-extensions.entrypoints: web | |
traefik.http.routers.notes-extensions.rule: Host(`notes-extensions.${DOMAIN}`) | |
traefik.http.services.notes-extensions.loadbalancer.server.port: 80 | |
networks: | |
- reverse_proxy | |
restart: unless-stopped | |
volumes: | |
- ./exts_data:/usr/share/nginx/html:ro | |
- ./exts_config/nginx.conf:/etc/nginx/nginx.conf:ro | |
main: | |
build: ${BUILD}/standardnotes | |
environment: | |
- TZ | |
- SF_DEFAULT_SERVER=https://notes-db.${DOMAIN}/api | |
expose: | |
- 3000 | |
labels: | |
traefik.enable: 'true' | |
traefik.http.routers.notes.entrypoints: web | |
traefik.http.routers.notes.rule: Host(`notes.${DOMAIN}`) | |
traefik.http.services.notes.loadbalancer.server.port: 3000 | |
xyz.senan.compose-status.group: cloud | |
networks: | |
- reverse_proxy | |
restart: unless-stopped | |
version: '3' |
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
user nginx; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
server { | |
listen *:80; | |
root /usr/share/nginx/html; | |
location / { | |
include /etc/nginx/mime.types; | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS'; | |
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; | |
add_header 'Access-Control-Max-Age' 1728000; | |
add_header 'Content-Type' 'text/plain; charset=utf-8'; | |
add_header 'Content-Length' 0; | |
return 204; | |
} | |
if ($request_method = 'GET') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS'; | |
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; | |
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment