Skip to content

Commit

Permalink
Merge pull request #14 from BouyguesTelecom/clean/code
Browse files Browse the repository at this point in the history
Clean/code
  • Loading branch information
AmelieLoulergue authored Nov 26, 2024
2 parents 4535cc8 + b2052fb commit 340e0e4
Show file tree
Hide file tree
Showing 46 changed files with 1,237 additions and 771 deletions.
4 changes: 1 addition & 3 deletions TESTS/environments/LOCAL.bru
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ vars {
URL_NGINX: http://localhost:8080
CATALOG_ROUTE: /catalog
URL_API_PREFIX: /palpatine
AUTH_TOKEN: cooltokenyeah
}
vars:secret [
AUTH_TOKEN
]
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@ script:pre-request {
const srcFile = path.join(src, file);
const destFile = path.join(dest, file);

fs.copyFile(srcFile, destFile, err => {
if (err) {
console.error('Error copying file:', err);
} else {
console.log(`Copied ${srcFile} to ${destFile}`);
}
});
fs.copyFile(srcFile, destFile, ()=>{});
});
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

get {
url: {{PATCH_PUBLIC_URL}}
url: {{IMAGE_URL}}
body: none
auth: none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ body:multipart-form {
}

vars:post-response {
PATCH_PUBLIC_URL: res.body?.data[0]?.public_url
PATCH_PUBLIC_URL: "{{URL_API}}" + res.body?.data[0]?.base_url + '/full'+res.body?.data[0]?.unique_name
}

assert {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

get {
url: {{PATCH_PUBLIC_URL_NO_EXPIRED}}
url: {{PATCH_PUBLIC_URL_NO_EXPIRED_FULL}}
body: none
auth: none
}
Expand Down
167 changes: 167 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
x-environment-variables:
&default-environment
API_PREFIX: "/palpatine"
DELEGATED_STORAGE_RATE_LIMIT: 5
DELEGATED_STORAGE_RATE_LIMIT_WINDOW: 30000
THUMBOR_SERVICE: http://localhost:8888
NGINX_SERVICE: http://host.docker.internal:8080
IMAGE_SERVICE: http://localhost:3001
NGINX_INGRESS: http://localhost:8080

VERSION: 0.0.1
NAMESPACES: CMS,FORMS,DEV
VALID_MIMETYPES: image/png,image/jpeg,application/pdf,image/jpg,image/webp,image/svg+xml

DEV_ENV: true

# GLOUTON API:
# DELEGATED_STORAGE_HOST: http://host.docker.internal:3002
# DELEGATED_STORAGE_READINESS_CHECK: /readiness-check
# DELEGATED_STORAGE_GET_PATH:
# DELEGATED_STORAGE_POST_PATH:
# DELEGATED_STORAGE_PUT_PATH:
# DELEGATED_STORAGE_DELETE_PATH:
# DELEGATED_STORAGE_TOKEN: NinjaDesIles

# S3 BACKUP :
DELEGATED_STORAGE_READINESS_CHECK: /minio/health/live
DELEGATED_STORAGE_HOST: http://localhost:9000

DELEGATED_STORAGE_METHOD: S3

S3_ENDPOINT: localhost
S3_PORT: 9000
S3_ACCESS_KEY: minioadmin
S3_SECRET_KEY: minioadmin
S3_BUCKET_NAME: media

DUMP_FOLDER_PATH: /dumps
REDIS_SERVICE: localhost

HEALTHCHECK_ROUTE: /readiness-check

PAYLOAD_MAX_SIZE: "10mb"
BASE_TIMEOUT_MS: 1000

ORIGINS_ALLOWED: localhost,*
METHODS_ALLOWED: GET,POST

USE_STRIPMETADATA: true
TMP_FILES_PATH: './images'


services:
redis:
image: bitnami/redis:7.0.15-debian-12-r20
container_name: redis_server
command: redis-server --protected-mode no --dir /dumps
ports:
- '6379:6379'
volumes:
- ./local/redis/dumps:/dumps
networks:
- redis_net
redisinsight:
image: redis/redisinsight:latest
container_name: redisinsight
ports:
- '5540:5540'
networks:
- redis_net
depends_on:
- redis

minio:
image: minio/minio
ports:
- 9000:9000
- 8900:8900
environment:
MINIO_ROOT_USER: 'minioadmin'
MINIO_ROOT_PASSWORD: 'minioadmin'
command: 'minio server /data/minio --console-address ":8900"'
volumes:
- pv-minio:/data/minio
networks:
- media_network

images-provider:
build:
context: src/api
dockerfile: Dockerfile.dev
ports:
- 3001:3001
networks:
- media_network
- redis_net
volumes:
- ./local/redis/dumps:/dumps
- ./local/logs:/logs
environment:
<<: *default-environment
THUMBOR_SERVICE: http://thumbor:8888
NGINX_SERVICE: http://nginx:8080
IMAGE_SERVICE: http://images-provider:3001
NGINX_INGRESS: http://localhost:8080
DELEGATED_STORAGE_HOST: http://minio:9000
REDIS_SERVICE: redis
S3_ENDPOINT: minio
healthcheck:
test: ["CMD-SHELL", "wget --spider --quiet http://images-provider:3001$$API_PREFIX/readiness-check || exit 1"]
interval: 10s
timeout: 7s
retries: 5
nginx-purge:
image: emcniece/nginx-cache-purge:1.13-alpine
ports:
- 8081:8081
volumes:
- ./local/nginx/nginx-purge.conf:/etc/nginx/nginx.conf
networks:
- media_network
depends_on:
- images-provider
nginx:
image: bitnami/nginx:latest
ports:
- 8080:8080
volumes:
- ./local/nginx/nginx.conf:/opt/bitnami/nginx/conf/nginx.conf
networks:
- media_network
depends_on:
- images-provider
job:
build:
context: src/
dockerfile: Dockerfile.dev
ports:
- 3006:3006
networks:
- media_network
volumes:
- ./local/logs:/logs
depends_on:
images-provider:
condition: service_healthy
environment:
<<: *default-environment
IMAGE_SERVICE: http://images-provider:3001
API_SERVICE: http://images-provider:3001
API_PREFIX: /palpatine
DEV_ENV: true
CATALOG_ROUTE: '/catalog'
GET_ROUTE: '/assets/media/'

volumes:
pv-minio:
minio:
driver: local
caddy_data:
caddy_config:

networks:
redis_net:
driver: bridge
media_network:
driver: bridge
55 changes: 51 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,54 @@
x-environment-variables:
&default-environment
API_PREFIX: "/palpatine"
DELEGATED_STORAGE_RATE_LIMIT: 5
DELEGATED_STORAGE_RATE_LIMIT_WINDOW: 30000
THUMBOR_SERVICE: http://localhost:8888
NGINX_SERVICE: http://host.docker.internal:8080
IMAGE_SERVICE: http://localhost:3001
NGINX_INGRESS: http://localhost:8080

VERSION: 0.0.1
NAMESPACES: CMS,FORMS,DEV
VALID_MIMETYPES: image/png,image/jpeg,application/pdf,image/jpg,image/webp,image/svg+xml

DEV_ENV: true

# GLOUTON API:
# DELEGATED_STORAGE_HOST: http://host.docker.internal:3002
# DELEGATED_STORAGE_READINESS_CHECK: /readiness-check
# DELEGATED_STORAGE_GET_PATH:
# DELEGATED_STORAGE_POST_PATH:
# DELEGATED_STORAGE_PUT_PATH:
# DELEGATED_STORAGE_DELETE_PATH:
# DELEGATED_STORAGE_TOKEN: NinjaDesIles

# S3 BACKUP :
DELEGATED_STORAGE_READINESS_CHECK: /minio/health/live
DELEGATED_STORAGE_HOST: http://localhost:9000

DELEGATED_STORAGE_METHOD: S3

S3_ENDPOINT: localhost
S3_PORT: 9000
S3_ACCESS_KEY: minioadmin
S3_SECRET_KEY: minioadmin
S3_BUCKET_NAME: media

DUMP_FOLDER_PATH: /dumps
REDIS_SERVICE: localhost

HEALTHCHECK_ROUTE: /readiness-check

PAYLOAD_MAX_SIZE: "10mb"
BASE_TIMEOUT_MS: 1000

ORIGINS_ALLOWED: localhost,*
METHODS_ALLOWED: GET,POST

USE_STRIPMETADATA: true
TMP_FILES_PATH: './images'


services:
redis:
Expand Down Expand Up @@ -40,7 +88,7 @@ services:
images-provider:
build:
context: src/api
dockerfile: Dockerfile.dev
dockerfile: Dockerfile
ports:
- 3001:3001
networks:
Expand Down Expand Up @@ -86,7 +134,7 @@ services:
job:
build:
context: src/
dockerfile: Dockerfile.dev
dockerfile: Dockerfile
ports:
- 3006:3006
networks:
Expand All @@ -96,9 +144,8 @@ services:
depends_on:
images-provider:
condition: service_healthy
env_file:
- ./src/api/.env
environment:
<<: *default-environment
IMAGE_SERVICE: http://images-provider:3001
API_SERVICE: http://images-provider:3001
API_PREFIX: /palpatine
Expand Down
Binary file modified local/redis/dumps/dump.rdb
Binary file not shown.
50 changes: 0 additions & 50 deletions local/update-local-bru.js

This file was deleted.

Loading

0 comments on commit 340e0e4

Please sign in to comment.