https://github.com/nexthis/medusa-coolify
π Seamless deployment of Medusa v2 using Coolify
https://github.com/nexthis/medusa-coolify
coolify devops-tools medusa medusajs-v2
Last synced: 4 months ago
JSON representation
π Seamless deployment of Medusa v2 using Coolify
- Host: GitHub
- URL: https://github.com/nexthis/medusa-coolify
- Owner: nexthis
- Created: 2025-04-27T18:07:44.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-08-10T18:56:58.000Z (11 months ago)
- Last Synced: 2025-08-10T20:35:35.562Z (11 months ago)
- Topics: coolify, devops-tools, medusa, medusajs-v2
- Language: TypeScript
- Homepage: https://www.youtube.com/watch?v=w_4wjA3ZRBw
- Size: 247 KB
- Stars: 22
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# medusa-coolify
> Integration module for deploying Medusa.js projects seamlessly using [Coolify](https://coolify.io).

## π Create PostgreSQL Database
Follow these steps to set up your PostgreSQL database:
1. **Create a PostgreSQL 16 database**
Use the default settings unless your project requires custom configuration.
2. **Enable SSL**
Ensure SSL is enabled for secure database connections. (required on medusa in production mode)

## β‘ Create Redis Database
No special configuration is required β simply create a Redis instance and you're good to go!

## π§© Create `medusa-server`
Set up the Medusa backend service with the following steps:
### 1. Configure Service
Use the Coolify UI to create a new service named **`medusa-server`**.
Refer to the screenshots below for guidance:


---
### 2. Add Environment Variables
Use the Coolify environment UI to set the following variables:
```env
# Secrets (generate securely, e.g. `openssl rand -hex 32`)
COOKIE_SECRET=supersecret
JWT_SECRET=supersecret2
# CORS settings
STORE_CORS=https://front.site.com
ADMIN_CORS=https://admin.site.com
AUTH_CORS=https://admin.site.com,https://front.site.com
# Backend configuration
BACKEND_URL=https://admin.site.com
DISABLE_ADMIN=false
WORKER_MODE=server
PORT=9000
# Database connections
DATABASE_URL=postgres://user:password@host:port/database
REDIS_URL=redis://user:password@host:port/database
```
> β οΈ **Important:**
> Make sure to set **"Build Variable?"** to `true` for at least `DATABASE_URL`, `WORKER_MODE` and `REDIS_URL`.
---
π **For more information**
To better understand how the Medusa server and worker setup works, visit the official documentation:
π [https://docs.medusajs.com/learn/deployment](https://docs.medusajs.com/learn/deployment)
## π§© Create `medusa-worker`


```env
# Secrets (generate securely, e.g. `openssl rand -hex 32`)
COOKIE_SECRET=supersecret
JWT_SECRET=supersecret2
# CORS settings
STORE_CORS=https://front.site.com
ADMIN_CORS=https://admin.site.com
AUTH_CORS=https://admin.site.com,https://front.site.com
# Backend configuration
BACKEND_URL=https://admin.site.com
DISABLE_ADMIN=true
WORKER_MODE=worker
PORT=9000
# Database connections
DATABASE_URL=postgres://user:password@host:port/database
REDIS_URL=redis://user:password@host:port/database
```
> β οΈ **Important:**
> Make sure to set **"Build Variable?"** to `true` for at least `DATABASE_URL`, `WORKER_MODE` and `REDIS_URL`.
## π‘ Advice, Tips, Plans & More
Here are a few things to keep in mind when working with this setup:
- π οΈ **Using the Medusa CLI**
To run Medusa CLI commands inside the `medusa-server`, open the Terminal tab and run:
```bash
node_modules/.bin/medusa
```
- π¦ **Database Migrations**
Only the `medusa-server` is responsible for running database migrations.
- π **S3/File Storage Not Configured**
This setup does **not** include S3 or file storage integration by default.
If needed, you'll need to configure it yourself β fortunately, itβs quite simple!
- π§ͺ **Development Workflow (Optional)**
For local development, you can use the provided `docker-compose.yaml` and fill `/medusa/.env`.
Start the services and run:
```bash
yarn run dev
```
> π¬ _Not sure if this is the optimal dev workflow β feel free to share your thoughts!_
---
π That's all for now β until next time!