You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Long story short, before 21st November 2024 and some weeks backwards, there has been issue with the implementation of the media storage. Therefore, I implemented a more production ready storage system, using a external MinIO bucket instead of @local-file
If you have an older project launched with this template, and you want to add the MinIO storage, follow this guide.
Change name of service to Bucket
Then go to settings and modify the start command: /bin/sh -c "exec minio server --address [::]:$MINIO_PRIVATE_PORT $RAILWAY_VOLUME_MOUNT_PATH"
Modify health check path: /minio/health/ready
Make sure Networking is set to HTTP
Once finished, it should look like this:
Finally, left click on the Bucket container on the cavas and attach a storage volume. Set the mount path to /data
Under the service should appear a little disk icon followed by /data - (see first image of the layout)
2. Add Bucket url to Railway storefront service variables: NEXT_PUBLIC_MINIO_ENDPOINT="${{Bucket.MINIO_PUBLIC_HOST}}"
Once this is added, you shuold see an arrow from the storefront container pointing to the Bucket container
Optionally, add Bucket console (web interface for your bucket media)
Once these are set, you should see the final arrow, from the Console container to the Bucker container
3. configure settings
Make sure Networking it is set to HTTP
Change name to Console
Change start command to: /bin/sh -c "exec console server --host 0.0.0.0 --port $PORT"
Change healthcheck endpoint to: /login
Apply changes
Click deploy changes in Railway
Push Git changes
The text was updated successfully, but these errors were encountered:
rpuls
changed the title
Addin MinIO storage to existing project launched prior to 21-11-2024
Adding MinIO storage to existing project launched prior to 21-11-2024
Nov 25, 2024
Long story short, before 21st November 2024 and some weeks backwards, there has been issue with the implementation of the media storage. Therefore, I implemented a more production ready storage system, using a external MinIO bucket instead of
@local-file
If you have an older project launched with this template, and you want to add the MinIO storage, follow this guide.
Backend
1. Add the minio storage module
Add backend directory:
backend/src/modules/minio-file
Add all the files and their content from: https://github.com/rpuls/medusajs-2.0-for-railway-boilerplate/tree/master/backend/src/modules/minio-file
2. Add the medusa configuration
Replace existing file module with:
3. Install required
/bacend
dependenciesAdd the following two dependencies to
backend/package.json
"minio": "^8.0.2",
and"ulid": "^2.3.0"
Your dependencies shuold look like this:
Replace
/backend/pnpm-lock.yaml
with the content of https://github.com/rpuls/medusajs-2.0-for-railway-boilerplate/blob/master/backend/pnpm-lock.yaml to ensure exact dependency versions.4. Add the MinIO services in Railway
We are aiming for this layout:
First Click "add new" choose "Docker Image", search of:
minio/minio:latest
Once it added, change variables:
Change name of service to
Bucket
Then go to settings and modify the start command:
/bin/sh -c "exec minio server --address [::]:$MINIO_PRIVATE_PORT $RAILWAY_VOLUME_MOUNT_PATH"
Modify health check path:
/minio/health/ready
Make sure Networking is set to
HTTP
Once finished, it should look like this:
Finally, left click on the Bucket container on the cavas and attach a storage volume. Set the mount path to
/data
Under the service should appear a little disk icon followed by /data - (see first image of the layout)
5. Update Backend variables:
Add the following:
Now you should see an arrow from the backend Container pointing to the Bucket container.
storefront
1. add Bucket URL to next image remote path
Verify that it looks identical to: https://github.com/rpuls/medusajs-2.0-for-railway-boilerplate/blob/master/storefront/next.config.js
2. Add Bucket url to Railway storefront service variables:
NEXT_PUBLIC_MINIO_ENDPOINT="${{Bucket.MINIO_PUBLIC_HOST}}"
Once this is added, you shuold see an arrow from the storefront container pointing to the Bucket container
Optionally, add Bucket console (web interface for your bucket media)
1. Add service
In Railway, once again click "add new", this time choose "github repo"
Enter git url: https://github.com/railwayapp-templates/minio-console
2. Add variables
Once these are set, you should see the final arrow, from the Console container to the Bucker container
3. configure settings
Make sure Networking it is set to
HTTP
Change name to
Console
Change start command to:
/bin/sh -c "exec console server --host 0.0.0.0 --port $PORT"
Change healthcheck endpoint to:
/login
Apply changes
Click deploy changes in Railway
Push Git changes
The text was updated successfully, but these errors were encountered: