Skip to content

Commit feba1ba

Browse files
authored
Implement storage volume sync with MinIO integration (#324)
Signed-off-by: Dave Augustus <[email protected]>
1 parent 0f278d9 commit feba1ba

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

docker-compose.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ services:
210210
- db-migrations
211211
- the_monkeys_db
212212
volumes:
213-
- ./profile:/app/profile # Mount existing production files
214-
- ./blogs:/app/blogs # Mount existing production files
215-
- profile_volume:/app/profile # Persist /app/profile data
216-
- blogs_volume:/app/blogs # Persist /app/blogs data
213+
- ./profile:/app/profile # Mount existing production files where code expects them
214+
- ./blogs:/app/blogs # Mount existing production files where code expects them
215+
- ./local_profiles:/app/local_profiles # Mount local profiles sync directory
216+
- ./local_blogs:/app/local_blogs # Mount local blogs sync directory
217217
ports:
218218
- "${MICROSERVICES_STORAGE_PORT}:${MICROSERVICES_STORAGE_INTERNAL_PORT}"
219219
restart: unless-stopped
@@ -411,7 +411,3 @@ volumes:
411411
driver: local
412412
minio_data:
413413
driver: local
414-
profile_volume:
415-
driver: local
416-
blogs_volume:
417-
driver: local

microservices/the_monkeys_storage/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ RUN apk --no-cache add ca-certificates tzdata && \
3737
WORKDIR /app
3838

3939
# Create directories for storage (matching volume mounts)
40-
RUN mkdir -p /profile /blogs && \
41-
chown -R appuser:appgroup /profile /blogs
40+
RUN mkdir -p /profile /blogs local_blogs local_profiles && \
41+
chown -R appuser:appgroup /profile /blogs local_blogs local_profiles
4242

4343
# Copy the binary and health probe from builder stage
4444
COPY --from=builder /app/storage-service .

microservices/the_monkeys_storage/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import (
1919
)
2020

2121
func init() {
22-
// Define the complete path including `/` and the folder name
23-
folderPath := "/" + constant.ProfileDir
24-
blogPath := "/" + constant.BlogDir
22+
// Define the complete path including the working directory and the folder name
23+
folderPath := constant.ProfileDir
24+
blogPath := constant.BlogDir
2525

2626
// Check if the directory already exists
2727
_, err := os.Stat(folderPath)

0 commit comments

Comments
 (0)