-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fishing-map/vessel-profile-3
- Loading branch information
Showing
83 changed files
with
5,569 additions
and
2,107 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
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 @@ | ||
NEXT_PUBLIC_API_GATEWAY=https://gateway.api.dev.globalfishingwatch.org |
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 @@ | ||
{ | ||
"extends": ["../../.eslintrc.js"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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,4 @@ | ||
## https://github.com/nrwl/nx/issues/8796#issuecomment-1775515199 | ||
|
||
docker-compose.yaml | ||
Dockerfile |
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 @@ | ||
module.exports = require('@globalfishingwatch/linting/stylelint') |
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,24 @@ | ||
################################################################################# | ||
# Generate htpasswd file | ||
################################################################################# | ||
# FROM appsoa/docker-alpine-htpasswd as htpasswd | ||
# ARG BASIC_AUTH_USER=gfw | ||
# ARG BASIC_AUTH_PASS=default | ||
# ENV BASIC_AUTH_USER $BASIC_AUTH_USER | ||
# ENV BASIC_AUTH_PASS $BASIC_AUTH_PASS | ||
# RUN htpasswd -Bbn "$BASIC_AUTH_USER" "$BASIC_AUTH_PASS" > /home/.htpasswd | ||
|
||
################################################################################# | ||
# Actual application to run | ||
################################################################################# | ||
# Using stable version that uses alpine 3.14 to fix build errors | ||
# https://github.com/alpinelinux/docker-alpine/issues/182 | ||
FROM nginx:stable-alpine as production | ||
|
||
COPY ./nginx.conf /etc/nginx/nginx.template | ||
# COPY --from=htpasswd /home/.htpasswd /home/.htpasswd | ||
# RUN cat /home/.htpasswd >> /etc/nginx/.htpasswd | ||
COPY ./entrypoint.sh entrypoint.sh | ||
COPY ./ /usr/share/nginx/www/ | ||
ENTRYPOINT ["./entrypoint.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,104 @@ | ||
steps: | ||
- name: 'gcr.io/$PROJECT_ID/restore_cache' | ||
id: restore_cache | ||
waitFor: ['-'] | ||
script: | | ||
#!/usr/bin/env bash | ||
restore_cache \ | ||
--bucket=gs://frontend-cache-dependencies \ | ||
--key=node_modules-$( checksum yarn.lock ) | ||
restore_cache \ | ||
--bucket=gs://frontend-cache-dependencies \ | ||
--key=yarn-$( checksum yarn.lock ) | ||
restore_cache \ | ||
--bucket=gs://frontend-cache-dependencies \ | ||
--key=yarn-install-state-$( checksum yarn.lock ) | ||
- id: 'install-yarn' | ||
waitFor: ['restore_cache'] | ||
name: node:21 | ||
script: | | ||
yarn set version 4.4.0 | ||
yarn -v | ||
yarn install --immutable | ||
- id: 'save_cache' | ||
waitFor: ['install-yarn'] | ||
name: 'gcr.io/$PROJECT_ID/restore_cache' | ||
script: | | ||
#!/usr/bin/env bash | ||
save_cache \ | ||
--bucket=gs://frontend-cache-dependencies \ | ||
--key=node_modules-$( checksum yarn.lock ) \ | ||
--path=./node_modules \ | ||
--no-clobber | ||
save_cache \ | ||
--bucket=gs://frontend-cache-dependencies \ | ||
--key=yarn-$( checksum yarn.lock ) \ | ||
--path=.yarn/cache \ | ||
--no-clobber | ||
save_cache \ | ||
--bucket=gs://frontend-cache-dependencies \ | ||
--key=yarn-install-state-$( checksum yarn.lock ) \ | ||
--path=.yarn/install-state.gz \ | ||
--no-clobber | ||
- id: 'build-app' | ||
waitFor: ['install-yarn'] | ||
name: node:21 | ||
entrypoint: yarn | ||
args: ['nx', 'build', 'data-download-portal', '--parallel'] | ||
env: | ||
- 'NX_BRANCH=$_NX_BRANCH' | ||
- 'NX_CLOUD_AUTH_TOKEN=$_NX_CLOUD_AUTH_TOKEN' | ||
- 'API_GATEWAY=$_API_GATEWAY' | ||
|
||
- name: 'gcr.io/kaniko-project/executor:latest' | ||
id: 'build-image' | ||
waitFor: ['build-app'] | ||
args: | ||
[ | ||
'--destination=gcr.io/world-fishing-827/github.com/globalfishingwatch/data-download-portal:$SHORT_SHA', | ||
'--cache=true', | ||
'--build-arg', | ||
'BASIC_AUTH_USER=$_BASIC_AUTH_USER', | ||
'--build-arg', | ||
'BASIC_AUTH_PASS=$_BASIC_AUTH_PASS', | ||
'--target', | ||
'production', | ||
'-f', | ||
'./apps/data-download-portal/Dockerfile', | ||
'-c', | ||
'./dist/apps/data-download-portal', | ||
] | ||
|
||
# Deploy to the appropriate environment | ||
- name: 'gcr.io/cloud-builders/gcloud' | ||
waitFor: ['build-image'] | ||
id: 'deploy-cloud-run' | ||
entrypoint: 'bash' | ||
env: | ||
- '_RUN_SERVICE_NAME=$_RUN_SERVICE_NAME' | ||
args: | ||
- '-eEuo' | ||
- 'pipefail' | ||
- '-c' | ||
- |- | ||
branch_service_name=`echo data-download-portal-$BRANCH_NAME | sed -r 's,[/\.],-,g' | awk '{print substr(tolower($0),0,62)}'` | ||
service_name=${_RUN_SERVICE_NAME:-${branch_service_name}} | ||
gcloud beta run deploy \ | ||
$service_name \ | ||
--project \ | ||
$_RUN_PROJECT \ | ||
--image \ | ||
gcr.io/world-fishing-827/github.com/globalfishingwatch/data-download-portal:$SHORT_SHA \ | ||
--region \ | ||
$_RUN_REGION \ | ||
--platform managed \ | ||
--set-env-vars \ | ||
BASIC_AUTH=$_BASIC_AUTH \ | ||
--allow-unauthenticated | ||
timeout: 1800s | ||
options: | ||
machineType: 'E2_HIGHCPU_8' |
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,14 @@ | ||
services: | ||
data-download-portal: | ||
build: | ||
context: ../../dist/apps/data-download-portal | ||
dockerfile: ../../../apps/data-download-portal/Dockerfile | ||
target: production | ||
container_name: data-download-portal | ||
ports: | ||
- 3000:80 | ||
env_file: | ||
- .env | ||
environment: | ||
- PORT=80 | ||
- API_GATEWAY=https://gateway.api.dev.globalfishingwatch.org |
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,22 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Data Download Portal</title> | ||
<base href="/" /> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com/" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin="anonymous" /> | ||
<link | ||
href="https://fonts.googleapis.com/css?family=Roboto:400,500&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<link rel="stylesheet" href="/src/index.css" /> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/index.jsx"></script> | ||
</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,48 @@ | ||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
keepalive_timeout 65; | ||
types_hash_max_size 2048; | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
client_header_buffer_size 64k; | ||
large_client_header_buffers 4 64k; | ||
|
||
access_log /var/log/nginx/access.log; | ||
error_log /var/log/nginx/error.log warn; | ||
|
||
gzip on; | ||
gzip_disable "msie6"; | ||
gzip_vary on; | ||
gzip_proxied any; | ||
gzip_comp_level 6; | ||
gzip_buffers 16 8k; | ||
gzip_http_version 1.1; | ||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; | ||
# Specify the minimum length of the response to compress (default 20) | ||
gzip_min_length 100; | ||
|
||
server { | ||
listen ${PORT}; | ||
root /usr/share/nginx/www/; | ||
|
||
location ~* ^/image-labeler/(.+\..+)$ { | ||
alias /usr/share/nginx/www/$1; | ||
} | ||
|
||
location ~* ^/(.+\..+)$ { | ||
alias /usr/share/nginx/www/$1; | ||
} | ||
|
||
location / { | ||
# auth_basic ${BASIC_AUTH}; | ||
# auth_basic_user_file /etc/nginx/.htpasswd; | ||
try_files /index.html =404; | ||
} | ||
} | ||
} |
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,58 @@ | ||
{ | ||
"name": "data-download-portal", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "apps/data-download-portal/src", | ||
"projectType": "application", | ||
"tags": [], | ||
"targets": { | ||
"build": { | ||
"executor": "@nx/vite:build", | ||
"outputs": ["{options.outputPath}"], | ||
"defaultConfiguration": "production", | ||
"options": { | ||
"outputPath": "dist/apps/data-download-portal" | ||
}, | ||
"configurations": { | ||
"development": { | ||
"mode": "development" | ||
}, | ||
"production": { | ||
"mode": "production" | ||
} | ||
} | ||
}, | ||
"start": { | ||
"executor": "@nx/vite:dev-server", | ||
"defaultConfiguration": "development", | ||
"options": { | ||
"buildTarget": "data-download-portal:build" | ||
}, | ||
"configurations": { | ||
"development": { | ||
"buildTarget": "data-download-portal:build:development", | ||
"hmr": true | ||
}, | ||
"production": { | ||
"buildTarget": "data-download-portal:build:production", | ||
"hmr": false | ||
} | ||
} | ||
}, | ||
"preview": { | ||
"executor": "@nx/vite:preview-server", | ||
"defaultConfiguration": "development", | ||
"options": { | ||
"buildTarget": "data-download-portal:build" | ||
}, | ||
"configurations": { | ||
"development": { | ||
"buildTarget": "data-download-portal:build:development" | ||
}, | ||
"production": { | ||
"buildTarget": "data-download-portal:build:production" | ||
} | ||
}, | ||
"dependsOn": ["build"] | ||
} | ||
} | ||
} |
Binary file not shown.
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 @@ | ||
# https://www.robotstxt.org/robotstxt.html | ||
User-agent: * | ||
Disallow: |
Oops, something went wrong.