Skip to content

Commit cfdf243

Browse files
authored
Merge pull request #59 from kongying-tavern/feat/image-api
feat: image alist host
2 parents 501cd38 + df6d7cc commit cfdf243

File tree

31 files changed

+535
-62
lines changed

31 files changed

+535
-62
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ database/**/.back_*
4646
application-datasource-dev.yml
4747
application-datasource-prod.yml
4848
application-datasource-uat.yml
49+
application-image-dev.yml
50+
application-image-prod.yml
51+
application-image-uat.yml
4952

5053
### Docker ###
5154
docker/.env

docker/Makefile.toml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,9 @@ check_env
3434
ENV_FILE = get_env ENV_FILE
3535
PROJECT_NAME = get_env PROJECT_NAME
3636
37-
# Generate datasource YAML
38-
yaml_ds_tpl = readfile ./config/api/application-datasource-tpl.yml
39-
yaml_ds_slots = json_parse --collection "[\"PGSQL_USER\", \"PGSQL_PASS\", \"PGSQL_DB\", \"PGSQL_SCHEMA\"]"
40-
yaml_ds_content = replace_env_value ${yaml_ds_tpl} ${yaml_ds_slots}
41-
release ${yaml_ds_slots}
42-
writefile ./cache/application-datasource.yml "${yaml_ds_content}"
43-
44-
# Generate nacos YAML
45-
yaml_nacos_tpl = readfile ./config/api/application-nacos-tpl.yml
46-
yaml_nacos_slots = json_parse --collection "[\"NACOS_USER\", \"NACOS_PASS\"]"
47-
yaml_nacos_content = replace_env_value ${yaml_nacos_tpl} ${yaml_nacos_slots}
48-
release ${yaml_nacos_slots}
49-
writefile ./cache/application-nacos.yml "${yaml_nacos_content}"
37+
replace_env_values_in_file ${ENV_FILE} ./config/api/application-datasource-tpl.yml ./cache/application-datasource.yml
38+
replace_env_values_in_file ${ENV_FILE} ./config/api/application-nacos-tpl.yml ./cache/application-nacos.yml
39+
replace_env_values_in_file ${ENV_FILE} ./config/api/application-image-tpl.yml ./cache/application-image.yml
5040
5141
docker_build "${ENV_FILE}" "${PROJECT_NAME}" "./composer/docker-compose.dev-build.yml"
5242
'''

docker/composer/docker-compose.dataenv.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ services:
2020
restart: always
2121
healthcheck:
2222
test: ["CMD-SHELL", "pg_isready -h localhost -p 5432 -U \"${PGSQL_USER}\" | grep accept || exit 1"]
23-
interval: 5m
24-
timeout: 60s
23+
interval: 30s
24+
timeout: 30s
2525
retries: 3
26-
start_period: 30s
27-
start_interval: 5s
26+
start_period: 2m
2827
nacos:
2928
container_name: gsapi-nacos
3029
hostname: gsapi-nacos
@@ -42,8 +41,7 @@ services:
4241
restart: always
4342
healthcheck:
4443
test: ["CMD-SHELL", "curl -f 'http://localhost:8848/nacos' || exit 1"]
45-
interval: 5m
46-
timeout: 60s
44+
interval: 30s
45+
timeout: 30s
4746
retries: 3
48-
start_period: 60s
49-
start_interval: 5s
47+
start_period: 2m

docker/composer/docker-compose.dev-api.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ services:
1616
gsapi-api:
1717
aliases:
1818
- api.local
19+
gsapi-img-alist:
20+
aliases:
21+
- img-alist.local
1922
volumes:
2023
- ${DATA_DIR}/api/logs:/data/logs
2124
ports:

docker/composer/docker-compose.dev-build.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ ADD docker/cache docker/cache
1717
RUN --mount=type=cache,target=/root/.m2,rw \
1818
cp -f ./docker/cache/application-datasource.yml ./genshin-map-config/src/main/resources-dev/application-datasource-dev.yml && \
1919
cp -f ./docker/cache/application-nacos.yml ./genshin-map-config/src/main/resources-dev/application-nacos-dev.yml && \
20+
cp -f ./docker/cache/application-image.yml ./genshin-map-config/src/main/resources-dev/application-image-dev.yml && \
2021
cp -f ./docker/cache/application-nacos.yml ./genshin-map-ability/genshin-map-ability-gateway/src/main/resources/application.yml && \
2122
mvn clean package -s ./docker/config/maven.xml -P dev -f pom.xml && \
2223
mkdir -p ./dist && \

docker/composer/docker-compose.img-alist-run.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ services:
1919
restart: always
2020
healthcheck:
2121
test: ["CMD", "redis-cli", "ping"]
22-
interval: 1m
23-
timeout: 60s
22+
interval: 30s
23+
timeout: 30s
2424
retries: 3
25-
start_period: 15s
26-
start_interval: 10s
25+
start_period: 2m
2726
minio:
2827
container_name: gsapi-minio
2928
hostname: gsapi-minio
@@ -45,11 +44,10 @@ services:
4544
restart: always
4645
healthcheck:
4746
test: ["CMD", "bash", "/minio/healthcheck.sh"]
48-
interval: 1m
49-
timeout: 60s
50-
retries: 5
51-
start_period: 30s
52-
start_interval: 5s
47+
interval: 30s
48+
timeout: 30s
49+
retries: 3
50+
start_period: 2m
5351
minio-proxy:
5452
container_name: gsapi-minio-proxy
5553
hostname: gsapi-minio-proxy
@@ -110,11 +108,10 @@ services:
110108
restart: always
111109
healthcheck:
112110
test: ["CMD", "bash", "/alist/healthcheck.sh"]
113-
interval: 1m
114-
timeout: 60s
111+
interval: 30s
112+
timeout: 30s
115113
retries: 3
116-
start_period: 15s
117-
start_interval: 10s
114+
start_period: 2m
118115

119116
# Initialization services
120117
minio-init:

docker/config/api/api-core.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Wants=network-online.target
88
Type=simple
99
User=root
1010
WorkingDirectory=/data/
11-
ExecStart=/bin/java -server -jar /data/genshin-map-api-core-core-1.0.jar
11+
ExecStart=/bin/java -server -Dfile.encoding=UTF-8 -jar /data/genshin-map-api-core-core-1.0.jar
1212
ExecStop=/bin/kill -s QUIT $MAINPID
1313
Restart=always
1414
StandOutput=syslog

docker/config/api/api-gateway.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Wants=network-online.target
88
Type=simple
99
User=root
1010
WorkingDirectory=/data/
11-
ExecStart=/bin/java -server -jar /data/genshin-map-ability-gateway-1.0.jar
11+
ExecStart=/bin/java -server -Dfile.encoding=UTF-8 -jar /data/genshin-map-ability-gateway-1.0.jar
1212
ExecStop=/bin/kill -s QUIT $MAINPID
1313
Restart=always
1414
StandOutput=syslog
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
image:
2+
minio:
3+
endpoint: http://minio-proxy.local:80
4+
key: {{MINIO_KEY}}
5+
secret: {{MINIO_SECRET}}
6+
bucket: {{MINIO_BUCKET_IMAGE}}
7+
static-url-template: http://localhost:{{MINIO_PORT_PROXY}}/[[fullPath]]

docker/config/img-alist-builder/minio-init/init.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ function step_init_minio () {
1010
mc admin user svcacct add \
1111
--access-key "${MINIO_KEY}" \
1212
--secret-key "${MINIO_SECRET}" \
13+
--policy /data/policy/uploadService.json \
14+
--name "UploadSvc" \
15+
--description "Image Upload Service" \
1316
minio "${MINIO_ROOT_USERNAME}"
1417
}
1518

0 commit comments

Comments
 (0)