Walkthrough setting up and using this template
nutritioneve opened this issue · 5 comments
Hi there, super nice to have a single click deploy button to Heroku!
There's one problem though, as the application runs in production mode on Heroku, it's impossible to create new content types by default (as this is by design). But there doesn't seem to be any documentation as to how to run it in dev mode and create new content types.
As of now, I pulled the git repo locally (by first adding this repository to the remotes as trying to clone the Heroku repository returns an empty one, see here).
Then I can run a yarn install
and finally run the app in dev mode, but now it seems to use a local db (probably the default sqlite one). How should I connect it to the one deployed to Heroku? Is that even the way to go, or is there a way to run the app deployed to heroku in development mode so that I can add content types?
Thanks in advance and keep up the great work with Strapi!
+1 for this.
As mentioned... it seems to be by design that this is working this way, but it essentially makes this pointless.
I cloned this repo, added s3 media storage plugin, and pushed it to a new repo.
Deploying that to heroku works perfectly, but as @nutritioneve mentioned, you are then unable to make/change custom content types - which is kind of the whole point of strapi....
+1 this template is useless with out further instructions on how to make changes
@calumk @nutritioneve just aheads up if you generate strapi with npx create-strapi-app my-project
then select custom -> then select mongoDB. you can make a free DB with mongodb atlas and deploy to heroku it changes will be saved...
Good to know that there are alternative working solutions!
@Mcastres
I think this repo should have some sort of explanation / guide bundled with it, to explain what it is for, or rather, what it is not for.
As I (and i assume others) stumble upon this from google, it might be good to modify the readme in some way to highlight its use case.
Hey @nutritioneve,
Sorry for the very late response. I think the onlly problem here is the database that is not linked from production and dev.
The best thing you can do is to update the config/database.js
(development one) file to use the same postgres database on Heroku.
yarn add pg-connection-string
config/database.js
const { parse } = require("pg-connection-string");
module.exports = ({ env }) => {
const { host, port, database, user, password } = parse(env("DATABASE_URL"));
return {
defaultConnection: "default",
connections: {
default: {
connector: "bookshelf",
settings: {
client: "postgres",
host,
port,
database,
username: user,
password,
ssl: { rejectUnauthorized: false }
},
options: {
ssl: false
},
},
},
};
};
While having a DATABASE_URL
env variable containing the DATABASE_URL of your Heroku postgres url.