-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b1ab25
commit 041ec06
Showing
14 changed files
with
234 additions
and
1 deletion.
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 @@ | ||
.gitkeep |
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,11 @@ | ||
FROM ghcr.io/sjinks/codespaces/nodejs:latest | ||
|
||
RUN \ | ||
apk add --no-cache nginx && \ | ||
sed -i "s/user nginx;/user vscode;/" /etc/nginx/nginx.conf && \ | ||
chown -R vscode:vscode /run/nginx /var/log/nginx /var/lib/nginx | ||
|
||
COPY rootfs / | ||
WORKDIR /usr/src/service | ||
|
||
RUN chown -R vscode:vscode /usr/src/service |
41 changes: 41 additions & 0 deletions
41
.devcontainer/.docker/identigraf-uploader/rootfs/etc/nginx/http.d/default.conf
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,41 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
client_body_buffer_size 10m; | ||
|
||
proxy_http_version 1.1; | ||
proxy_set_header Host $host; | ||
proxy_set_header Accept-Encoding ""; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_set_header X-Forwarded-Host $host:$server_port; | ||
proxy_set_header X-Forwarded-Server $host; | ||
proxy_set_header X-Forwarded-Port $server_port; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_read_timeout 300s; | ||
|
||
location / { | ||
proxy_set_header traceparent ""; | ||
proxy_set_header tracestate ""; | ||
proxy_pass http://localhost:3000; | ||
} | ||
|
||
location /identigraf-upload/v1/ { | ||
proxy_set_header traceparent ""; | ||
proxy_set_header tracestate ""; | ||
proxy_pass http://localhost:3000/; | ||
} | ||
|
||
location /swagger { | ||
proxy_pass http://swagger:8080; | ||
} | ||
} | ||
|
||
server { | ||
listen 9411; | ||
server_name localhost; | ||
|
||
location / { | ||
proxy_pass http://zipkin:9411; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
.devcontainer/.docker/identigraf-uploader/rootfs/etc/service/identigraf-uploader
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 @@ | ||
../sv/identigraf-uploader/ |
1 change: 1 addition & 0 deletions
1
.devcontainer/.docker/identigraf-uploader/rootfs/etc/service/nginx
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 @@ | ||
../sv/nginx |
Empty file.
10 changes: 10 additions & 0 deletions
10
.devcontainer/.docker/identigraf-uploader/rootfs/etc/sv/identigraf-uploader/run
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,10 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
exec 2>&1 | ||
|
||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
SERVICE=identigraf-uploader | ||
|
||
install -d -o vscode -g vscode -m 0755 "/var/log/${SERVICE}" | ||
exec sudo -u vscode -H /usr/local/bin/start-service.sh > "/var/log/${SERVICE}/start.log" 2>&1 |
16 changes: 16 additions & 0 deletions
16
.devcontainer/.docker/identigraf-uploader/rootfs/etc/sv/nginx/run
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,16 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
|
||
exec 2>&1 | ||
|
||
NGINX_USER="${CONTAINER_USER:-vscode}" | ||
|
||
COMMAND=/usr/sbin/nginx | ||
PID_FILE=/run/nginx/nginx.pid | ||
|
||
/usr/bin/install -d -o "${NGINX_USER}" -g "${NGINX_USER}" "${PID_FILE%/*}" /var/log/nginx | ||
/usr/bin/install -d -o "${NGINX_USER}" -g "${NGINX_USER}" -m 0750 /var/lib/nginx | ||
exec "${COMMAND}" -c /etc/nginx/nginx.conf -g "pid ${PID_FILE}; daemon off;" |
21 changes: 21 additions & 0 deletions
21
.devcontainer/.docker/identigraf-uploader/rootfs/usr/local/bin/post-create.sh
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,21 @@ | ||
#!/bin/sh | ||
|
||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
|
||
cd /usr/src/service || exit 1 | ||
|
||
if [ ! -f .npmrc.local ] || ! grep -q '//npm.pkg.github.com/:_authToken=' .npmrc.local; then | ||
if [ -n "${GITHUB_TOKEN}" ]; then | ||
echo "Using GITHUB_TOKEN to authenticate to npm.pkg.github.com" | ||
echo "//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}" >> .npmrc.local | ||
elif [ -n "${READ_PACKAGES_TOKEN}" ]; then | ||
echo "Using READ_PACKAGES_TOKEN to authenticate to npm.pkg.github.com" | ||
echo "//npm.pkg.github.com/:_authToken=${READ_PACKAGES_TOKEN}" >> .npmrc.local | ||
else | ||
echo "WARNING: Neither GITHUB_TOKEN nor READ_PACKAGES_TOKEN is available; package download may fail." | ||
fi | ||
else | ||
echo ".npmrc.local already exists and has an authentication token for npm.pkg.github.com" | ||
fi | ||
|
||
exec sudo sv start identigraf-uploader |
25 changes: 25 additions & 0 deletions
25
.devcontainer/.docker/identigraf-uploader/rootfs/usr/local/bin/start-service.sh
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,25 @@ | ||
#!/bin/sh | ||
|
||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
SERVICE=identigraf-uploader | ||
|
||
cd /usr/src/service || exit 1 | ||
|
||
if [ ! -f src/specs/identigraf-uploader.yaml ] && [ -d .git ]; then | ||
git submodule update --init --recursive | ||
fi | ||
|
||
export NPM_CONFIG_AUDIT=0 | ||
|
||
if [ ! -d node_modules ]; then | ||
npm ci --ignore-scripts --userconfig .npmrc.local && npm rebuild && npm run prepare --if-present | ||
else | ||
npm install --ignore-scripts --userconfig .npmrc.local && npm rebuild && npm run prepare --if-present | ||
fi | ||
|
||
if [ ! -d node_modules ]; then | ||
echo "FATAL: Failed to install dependencies" | ||
exit 1 | ||
fi | ||
|
||
npm run start:dev 2>&1 | tee -a "/var/log/${SERVICE}/${SERVICE}.log" |
Empty file.
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,54 @@ | ||
{ | ||
"name": "IDentigraF Uploader", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "identigraf-uploader", | ||
"workspaceFolder": "/usr/src/service", | ||
"forwardPorts": [80, 9411], | ||
"portsAttributes": { | ||
"80": { | ||
"label": "Application (Frontend)", | ||
"onAutoForward": "notify" | ||
}, | ||
"3000": { | ||
"label": "Application (Backend)", | ||
"onAutoForward": "ignore" | ||
}, | ||
"9411": { | ||
"label": "Zipkin", | ||
"onAutoForward": "notify" | ||
} | ||
}, | ||
"remoteUser": "vscode", | ||
"postCreateCommand": "/usr/local/bin/post-create.sh", | ||
"secrets": { | ||
"READ_PACKAGES_TOKEN": { | ||
"description": "Personal access token to install packages from ghcr.io" | ||
} | ||
}, | ||
"customizations": { | ||
"codespaces": { | ||
"repositories": { | ||
"myrotvorets/psb-api-identigraf-uploader": { | ||
"permissions": { | ||
"packages": "read" | ||
} | ||
} | ||
} | ||
}, | ||
"vscode": { | ||
"extensions": [ | ||
"dlech.chmod", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"timonwong.shellcheck", | ||
"ms-azuretools.vscode-docker", | ||
"zhiayang.tabindentspacealign", | ||
"42Crunch.vscode-openapi", | ||
"natqe.reload" | ||
], | ||
"settings": { | ||
"files.autoSave": "onWindowChange" | ||
} | ||
} | ||
} | ||
} |
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 @@ | ||
services: | ||
identigraf-uploader: | ||
build: | ||
context: .docker/identigraf-uploader | ||
dockerfile: Dockerfile | ||
environment: | ||
- NODE_ENV=development | ||
- NO_UPDATE_NOTIFIER=true | ||
- NPM_CONFIG_FUND=0 | ||
- SUPPRESS_SUPPORT=1 | ||
- HTTPS=0 | ||
- PORT=3000 | ||
- ENABLE_TRACING=1 | ||
- OTEL_EXPORTER_ZIPKIN_ENDPOINT=http://zipkin:9411/api/v2/spans | ||
- IDENTIGRAF_UPLOAD_FOLDER=/var/lib/identigraf-uploader/uploads | ||
- IDENTIGRAF_MAX_FILE_SIZE=5242880 | ||
- HAVE_SWAGGER=true | ||
- npm_config_userconfig=/usr/src/service/.npmrc.local | ||
restart: always | ||
volumes: | ||
- "../:/usr/src/service" | ||
- uploads:/var/lib/identigraf-uploader/uploads | ||
working_dir: /usr/src/service | ||
|
||
zipkin: | ||
image: openzipkin/zipkin:latest@sha256:5fd55e6a109233b36d419d7fd2449588d17a6e4da7ed7a3fd0d09c86f1c75a15 | ||
restart: always | ||
|
||
swagger: | ||
image: swaggerapi/swagger-ui:latest@sha256:3b4f51470fed56b1ce5a064f57ce7a0d585f50192731f458e7b376713b286d57 | ||
environment: | ||
- SWAGGER_JSON_URL=/specs/identigraf-uploader.yaml | ||
- BASE_URL=/swagger | ||
|
||
volumes: | ||
uploads: |
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