-
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.
chore: update configuration files and improve caching mechanism
- Added cache directory to the application configuration for better cache management. - Updated Docker Compose and production YAML files to include a cache volume for improved performance. - Enhanced the .gitignore file to exclude cache files. - Refactored the Restricted component in the frontend to improve user authorization handling and loading state management. These changes aim to streamline the application setup and enhance user experience by ensuring proper caching and authorization checks.
- Loading branch information
Showing
5 changed files
with
168 additions
and
144 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 |
---|---|---|
|
@@ -56,3 +56,6 @@ s3data/* | |
|
||
# Logs | ||
logs/* | ||
|
||
# | ||
cache/* |
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,90 +1,93 @@ | ||
--- | ||
version: "3.4" | ||
services: | ||
database: | ||
restart: always | ||
image: postgres:12 | ||
container_name: herdbook-db | ||
env_file: | ||
- ./.docker/database-variables.env | ||
environment: | ||
- POSTGRES_HOST_AUTH_METHOD=trust | ||
volumes: | ||
- ./postgres-data:/var/lib/postgresql/data | ||
herdbook-frontend: | ||
image: herdbook_frontend | ||
container_name: herdbook_frontend | ||
build: | ||
context: ./ | ||
dockerfile: .docker/frontend | ||
cache_from: | ||
- ghcr.io/nbisweden/herdbook_frontend | ||
command: bash -c "rm -rf /home/node/app/node_modules/* && npm run start" | ||
volumes: | ||
- ./frontend:/home/node/app/ | ||
- exclude:/home/node/app/node_modules | ||
environment: | ||
- NODE_OPTIONS="--max-old-space-size=2048" | ||
main: | ||
image: herdbook_main | ||
build: | ||
context: ./ | ||
dockerfile: .docker/main | ||
cache_from: | ||
- ghcr.io/nbisweden/herdbook_main | ||
container_name: herdbook-main | ||
env_file: | ||
- ./.docker/database-variables.env | ||
- ./.docker/r-api-variables.env | ||
- ./.docker/main-api-variables.env | ||
ports: | ||
- 8080:8080 | ||
- 8443:8443 | ||
volumes: | ||
- type: bind | ||
source: ./app | ||
target: /api_src | ||
- type: bind | ||
source: ./config | ||
target: /config | ||
- type: bind | ||
source: ./logs | ||
target: /logs | ||
depends_on: | ||
- database | ||
- herdbook-frontend | ||
r-api: | ||
container_name: r-api | ||
build: | ||
context: ./ | ||
dockerfile: .docker/r-api | ||
cache_from: | ||
- ghcr.io/nbisweden/herdbook_r-api | ||
env_file: | ||
- ./.docker/database-variables.env | ||
- ./.docker/r-api-variables.env | ||
image: herdbook_r-api | ||
volumes: | ||
- type: bind | ||
source: ./R | ||
target: /code | ||
s3backend: | ||
command: -c 'echo s3user:x:$$(stat -c %u /data):0:s3 user:/:/bin/sh >> /etc/passwd && su s3user -c "mkdir -p /data/$${S3_BUCKET} && minio server /data"' | ||
entrypoint: /bin/sh | ||
container_name: s3backend | ||
environment: | ||
- MINIO_ACCESS_KEY=accesskeytest | ||
- MINIO_SECRET_KEY=secretkeytest | ||
env_file: | ||
- ./.docker/main-api-variables.env | ||
volumes: | ||
- ./s3data:/data | ||
healthcheck: | ||
test: ["CMD", "curl", "-fkq", "http://localhost:9000/minio/health/live"] | ||
interval: 5s | ||
timeout: 20s | ||
retries: 3 | ||
image: minio/minio:RELEASE.2021-04-18T19-26-29Z | ||
database: | ||
restart: always | ||
image: postgres:12 | ||
container_name: herdbook-db | ||
env_file: | ||
- ./.docker/database-variables.env | ||
environment: | ||
- POSTGRES_HOST_AUTH_METHOD=trust | ||
volumes: | ||
- ./postgres-data:/var/lib/postgresql/data | ||
herdbook-frontend: | ||
image: herdbook_frontend | ||
container_name: herdbook_frontend | ||
build: | ||
context: ./ | ||
dockerfile: .docker/frontend | ||
cache_from: | ||
- ghcr.io/nbisweden/herdbook_frontend | ||
command: bash -c "rm -rf /home/node/app/node_modules/* && npm run start" | ||
volumes: | ||
- ./frontend:/home/node/app/ | ||
- exclude:/home/node/app/node_modules | ||
environment: | ||
- NODE_OPTIONS="--max-old-space-size=2048" | ||
main: | ||
image: herdbook_main | ||
build: | ||
context: ./ | ||
dockerfile: .docker/main | ||
cache_from: | ||
- ghcr.io/nbisweden/herdbook_main | ||
container_name: herdbook-main | ||
env_file: | ||
- ./.docker/database-variables.env | ||
- ./.docker/r-api-variables.env | ||
- ./.docker/main-api-variables.env | ||
ports: | ||
- 8080:8080 | ||
- 8443:8443 | ||
volumes: | ||
- type: bind | ||
source: ./app | ||
target: /api_src | ||
- type: bind | ||
source: ./config | ||
target: /config | ||
- type: bind | ||
source: ./logs | ||
target: /logs | ||
- type: bind | ||
source: ./cache | ||
target: /var/cache/herdbook | ||
depends_on: | ||
- database | ||
- herdbook-frontend | ||
r-api: | ||
container_name: r-api | ||
build: | ||
context: ./ | ||
dockerfile: .docker/r-api | ||
cache_from: | ||
- ghcr.io/nbisweden/herdbook_r-api | ||
env_file: | ||
- ./.docker/database-variables.env | ||
- ./.docker/r-api-variables.env | ||
image: herdbook_r-api | ||
volumes: | ||
- type: bind | ||
source: ./R | ||
target: /code | ||
s3backend: | ||
command: -c 'echo s3user:x:$$(stat -c %u /data):0:s3 user:/:/bin/sh >> /etc/passwd && su s3user -c "mkdir -p /data/$${S3_BUCKET} && minio server /data"' | ||
entrypoint: /bin/sh | ||
container_name: s3backend | ||
environment: | ||
- MINIO_ACCESS_KEY=accesskeytest | ||
- MINIO_SECRET_KEY=secretkeytest | ||
env_file: | ||
- ./.docker/main-api-variables.env | ||
volumes: | ||
- ./s3data:/data | ||
healthcheck: | ||
test: ["CMD", "curl", "-fkq", "http://localhost:9000/minio/health/live"] | ||
interval: 5s | ||
timeout: 20s | ||
retries: 3 | ||
image: minio/minio:RELEASE.2021-04-18T19-26-29Z | ||
|
||
volumes: | ||
exclude: null |
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,46 +1,49 @@ | ||
--- | ||
version: "3.4" | ||
services: | ||
database: | ||
restart: always | ||
image: postgres:12 | ||
container_name: herdbook-db | ||
env_file: | ||
- ./.docker/database-variables.env | ||
environment: | ||
- POSTGRES_HOST_AUTH_METHOD=trust | ||
volumes: | ||
- ./postgres-data:/var/lib/postgresql/data | ||
main: | ||
image: ghcr.io/nbisweden/herdbook_main:${TAG:?TAG-not-set} | ||
container_name: herdbook-main | ||
env_file: | ||
- ./.docker/database-variables.env | ||
- ./.docker/r-api-variables.env | ||
- ./.docker/main-api-variables.env | ||
ports: | ||
- 80:8080 | ||
- 443:8443 | ||
- 9090:9090 | ||
volumes: | ||
- type: bind | ||
source: ./app | ||
target: /api_src | ||
- type: bind | ||
source: ./config | ||
target: /config | ||
- type: bind | ||
source: ./logs | ||
target: /logs | ||
depends_on: | ||
- database | ||
- r-api | ||
restart: always | ||
database: | ||
restart: always | ||
image: postgres:12 | ||
container_name: herdbook-db | ||
env_file: | ||
- ./.docker/database-variables.env | ||
environment: | ||
- POSTGRES_HOST_AUTH_METHOD=trust | ||
volumes: | ||
- ./postgres-data:/var/lib/postgresql/data | ||
main: | ||
image: ghcr.io/nbisweden/herdbook_main:${TAG:?TAG-not-set} | ||
container_name: herdbook-main | ||
env_file: | ||
- ./.docker/database-variables.env | ||
- ./.docker/r-api-variables.env | ||
- ./.docker/main-api-variables.env | ||
ports: | ||
- 80:8080 | ||
- 443:8443 | ||
- 9090:9090 | ||
volumes: | ||
- type: bind | ||
source: ./app | ||
target: /api_src | ||
- type: bind | ||
source: ./config | ||
target: /config | ||
- type: bind | ||
source: ./logs | ||
target: /logs | ||
- type: bind | ||
source: ./cache | ||
target: /var/cache/herdbook | ||
depends_on: | ||
- database | ||
- r-api | ||
restart: always | ||
|
||
r-api: | ||
image: ghcr.io/nbisweden/herdbook_r-api:${TAG:?TAG-not-set} | ||
container_name: r-api | ||
env_file: | ||
- ./.docker/database-variables.env | ||
- ./.docker/r-api-variables.env | ||
restart: always | ||
r-api: | ||
image: ghcr.io/nbisweden/herdbook_r-api:${TAG:?TAG-not-set} | ||
container_name: r-api | ||
env_file: | ||
- ./.docker/database-variables.env | ||
- ./.docker/r-api-variables.env | ||
restart: always |