Browse Source

added deploy with heroku button

Shahed Nasser 3 years ago
parent
commit
33c3c4648c
2 changed files with 57 additions and 5 deletions
  1. 48 0
      app.json
  2. 9 5
      medusa-config.js

+ 48 - 0
app.json

@@ -0,0 +1,48 @@
+{
+  "name": "Medusa Server",
+  "description": "A Medusa Server deployed with Redis and Postgres Add-ons",
+  "repository": "https://github.com/medusajs/medusa-starter-default",
+  "logo": "https://i.imgur.com/AT1CMwh.jpg",
+  "keywords": ["node", "express", "ecommerce", "medusa", "ecommerce platform"],
+  "success_url": "/store/products",
+  "addons": [
+    {
+      "plan": "upstash-redis",
+      "as": "REDIS"
+    },
+    {
+      "plan": "heroku-postgresql",
+      "as": "DATABASE"
+    }
+  ],
+  "env": {
+    "JWT_SECRET": {
+      "description": "Secret used to sign JWT tokens",
+      "generator": "secret"
+    },
+    "COOKIE_SECRET": {
+      "description": "Secret used to sign cookie SID",
+      "generator": "secret"
+    },
+    "ADMIN_CORS": {
+      "description": "URL of the Medusa admin",
+      "required": false,
+      "value": "http://localhost:7000,http://localhost:7001"
+    },
+    "STORE_CORS": {
+      "description": "URL of the Medusa storefront",
+      "required": false,
+      "value": "http://localhost:8000"
+    },
+    "NPM_CONFIG_PRODUCTION": {
+      "description": "Keep this false to allow the server to install babel for build",
+      "required": true,
+      "value": "false"
+    }
+  },
+  "buildpacks": [
+    {
+      "url": "heroku/nodejs"
+    }
+  ]
+}

+ 9 - 5
medusa-config.js

@@ -32,14 +32,18 @@ const plugins = [
 
 module.exports = {
   projectConfig: {
-    // redis_url: REDIS_URL,
+    redis_url: REDIS_URL,
     // For more production-like environment install PostgresQL
-    // database_url: DATABASE_URL,
-    // database_type: "postgres",
-    database_database: "./medusa-db.sql",
-    database_type: "sqlite",
+    database_url: DATABASE_URL,
+    database_type: "postgres",
+    // database_database: "./medusa-db.sql",
+    // database_type: "sqlite",
     store_cors: STORE_CORS,
     admin_cors: ADMIN_CORS,
+    database_extra:
+      process.env.NODE_ENV !== "development"
+        ? { ssl: { rejectUnauthorized: false } }
+        : {},
   },
   plugins,
 };