Private
Public Access
chg: pkg: add a process that removes the unnecessary minio-init when it does not needed anymore #14
This commit is contained in:
@@ -36,4 +36,7 @@ jobs:
|
|||||||
- name: Start services
|
- name: Start services
|
||||||
run: |
|
run: |
|
||||||
cd "${{ vars.PROD_APP_DIR }}"
|
cd "${{ vars.PROD_APP_DIR }}"
|
||||||
|
docker compose up -d minio
|
||||||
|
docker compose rm -sf minio_init
|
||||||
|
docker compose run --rm minio_init
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "Available commands:"
|
@echo "Available commands:"
|
||||||
@echo " make start - Start services without building (uses existing images)"
|
@echo " make start - Start services and initialize MinIO (uses existing images)"
|
||||||
@echo " make start-build - Start services and build images if needed"
|
@echo " make start-build - Build, start services, and initialize MinIO"
|
||||||
@echo " make stop - Stop running services"
|
@echo " make stop - Stop running services"
|
||||||
@echo " make build - Build Docker images only"
|
@echo " make build - Build Docker images only"
|
||||||
@echo " make down - Stop and remove containers/networks"
|
@echo " make down - Stop and remove containers/networks"
|
||||||
@@ -19,11 +19,17 @@ help:
|
|||||||
@echo " make test - Run PHPUnit tests"
|
@echo " make test - Run PHPUnit tests"
|
||||||
|
|
||||||
start:
|
start:
|
||||||
|
docker compose up -d minio
|
||||||
|
docker compose rm -sf minio_init
|
||||||
|
docker compose run --rm minio_init
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
|
|
||||||
start-build:
|
start-build:
|
||||||
composer i
|
composer i
|
||||||
bun run build
|
bun run build
|
||||||
|
docker compose up -d --build minio
|
||||||
|
docker compose rm -sf minio_init
|
||||||
|
docker compose run --rm minio_init
|
||||||
docker compose up -d --build
|
docker compose up -d --build
|
||||||
|
|
||||||
stop:
|
stop:
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ services:
|
|||||||
start_period: 10s
|
start_period: 10s
|
||||||
minio_init:
|
minio_init:
|
||||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z-cpuv1
|
image: minio/minio:RELEASE.2025-09-07T16-13-09Z-cpuv1
|
||||||
|
profiles: ['bootstrap']
|
||||||
restart: "no"
|
restart: "no"
|
||||||
container_name: '${APP_NAME}-minio-init'
|
container_name: '${APP_NAME}-minio-init'
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "[minio-init] Configuring alias..."
|
echo "[minio-init] Waiting for MinIO..."
|
||||||
mc alias set local http://minio:9000 "$MINIO_ROOT_USER" "$MINIO_ROOT_PASSWORD"
|
until mc alias set local http://minio:9000 "$MINIO_ROOT_USER" "$MINIO_ROOT_PASSWORD" > /dev/null 2>&1; do
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "[minio-init] Configuring bucket..."
|
||||||
|
|
||||||
if mc ls local/mineseeker > /dev/null 2>&1; then
|
if mc ls local/mineseeker > /dev/null 2>&1; then
|
||||||
echo "[minio-init] Already initialized, skipping."
|
echo "[minio-init] Already initialized, skipping."
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# MinIO Initialization
|
||||||
|
|
||||||
|
The `minio_init` Compose service creates the `mineseeker` bucket and applies
|
||||||
|
its public read policy. It is an idempotent bootstrap task: after the bucket
|
||||||
|
exists, it exits without changing it.
|
||||||
|
|
||||||
|
It belongs to the `bootstrap` Compose profile, so normal `docker compose up`
|
||||||
|
does not create a stopped `mineseeker-minio-init` container.
|
||||||
|
|
||||||
|
`make start`, `make start-build`, and the production deployment workflow run
|
||||||
|
the bootstrap task automatically with `docker compose run --rm minio_init`.
|
||||||
|
They also remove any stopped legacy initializer container first. The temporary
|
||||||
|
container is removed as soon as the task succeeds.
|
||||||
|
|
||||||
|
To run it manually when needed:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose run --rm minio_init
|
||||||
|
```
|
||||||
@@ -60,6 +60,9 @@ Quick command reference for testing:
|
|||||||
### [Scheduled Tasks](./SCHEDULER.md)
|
### [Scheduled Tasks](./SCHEDULER.md)
|
||||||
Symfony Scheduler tasks and the Docker worker that runs them.
|
Symfony Scheduler tasks and the Docker worker that runs them.
|
||||||
|
|
||||||
|
### [MinIO Initialization](./MINIO_INITIALIZATION.md)
|
||||||
|
Automatic, one-shot setup of the MinIO bucket and its access policy.
|
||||||
|
|
||||||
### [CI/CD Integration Guide](./CI_CD.md)
|
### [CI/CD Integration Guide](./CI_CD.md)
|
||||||
Comprehensive guide for continuous integration and deployment:
|
Comprehensive guide for continuous integration and deployment:
|
||||||
- Gitea Actions workflows (CI and CD pipelines)
|
- Gitea Actions workflows (CI and CD pipelines)
|
||||||
|
|||||||
Reference in New Issue
Block a user