Is there some commands to reload your current schema on your Heroku PostgreSQL databse ?
vapor run prepare work fine locally, but i didn't find a way to do that on Heroku
The Release Phase functionality may help you. If you're using Review Apps, or Heroku Buttons, consider the postdeploy script.
When you use the Heroku Vapor Buildpack you shouldn't really call vapor run prepare yourself. Instead, you should prepare your Droplet instance within the main.swift file or using some helper method, depending on how you want to structure your code.
let drop = Droplet()
// ...
drop.preparations.append(MyModel.self)
// ...
drop.run()
Related
Are there any official (or unofficial) ways of storing entire heroku configurations as code?
I think most heroku configurations can be stored in a bash script. But things like scheduled jobs and the like still have to be performed manually.
Is there any way to store entire app configurations as code so that the setup can be used directly or as a starting point for other applications?
I since learned that you can indeed use terraform with heroku.
Source:
Using Terraform with Heroku
I'm using Heroku Pipelines and what to run some scripts only when Heroku builds Review app. Now I use that line in my app.json:
"scripts": {
"postdeploy": "php artisan database:fill-test-data"
}
But I don't want to fill database with test data when anybody clicks on Deploy to Heroku button, because postdeploy scripts run at any first deploy. I want to fill database with test data only at Pull Requests.
Heroku has only 1 command that executed only at Pull Requests, and it is pr-predestroy.
The command is prefixed with “pr-” because it is ONLY run as part of
the pull request (PR) app flow.
But as far as I know there is no pr-postdeploy command. What can you suggest me to use as script command that will be executed only in Review apps created by Pull Requests?
Heroku Documentation: Review Apps
You could add an env var to the parent app (that it inherits from) that tells you it is a non-production app (i.e. staging or whatever) and then in your post-deply script, you could check if it that var is true
Your review app should not inherit from production app anyway, so assuming you are inheriting from a staging app or some other non-prod app, this should work.
let me know! I've struggled with review apps a lot
I have an app running on Heroku with a small handful of settings that I want to change from time to time, and I'd like to use Heroku config vars to store these settings so they persist durably.
I know I can modify the settings from the Heroku dashboard or the Heroku CLI, but I'd like to modify them from within the app UI.
I can't seem to figure out how to modify the app's Heroku config from within the app code. If I simply modify the dyno's environment, for example, those changes do not persist to the app's config.
You can use Heroku Platform API for this. Especially this part. There is also a ruby client
I have Rails 3.2 application hosted on Heroku. My application contains two databases (one for my model, the second is a kind of a dictionary with static data).
I need to push the second database (dictionary) to Heroku, but when I try db:push Heroku thinks that I'm going to push the first database (with Rails model).
The question is - how could I specify that I want to push my local database dictionary.sqlite to heroku dictionary.pg?
You could use the Heroku pg:transfer plugin which will let you set the target destination by it's URL.
https://github.com/ddollar/heroku-pg-transfer
Alternatively, use psql client locally but restore to the heroku pg isntance.
Don't use db:push/pull; those methods are deprecated. Use pgbackups:capture/restore for things like this. It accepts the HEROKU_POSTGRESQL_COLOR as part of the command:
$ heroku pgbackups:restore HEROKU_POSTGRESQL_COLOR 'https://example.com/data.dump' --app app-name
See Importing and Exporting Heroku Postgres Databases with PG Backups for more detailed explanation.
Also, heroku-pg-transfer has been integrated into pg-extras, check that out here: https://github.com/heroku/heroku-pg-extras
I have a main app on heroku and another app A on git in location github:a.
I want to create, when it is necessary, copies of A as A1,A2,A3...AN as separate apps on heroku from my main app automatically with different parameters.
How can i do that?
Edit: This process should be done by my main app automatically.
Updating this answer due to Heroku command DEPRECATION:
heroku fork has been deprecated as a core command as of 12/01/2017.
You will need to install the heroku-fork plugin to continue using this command.
heroku plugins:install heroku-fork
Here is a link to the Github plugin repo.
Use heroku fork to copy an existing application, including add-ons, config vars, and Heroku Postgres data.
See this KB page: Forking Applications.
Heroku toolbelt now provides a fork method to clone an existing application, see my answer here :
how to clone a project on heroku
There is a new feature on Heroku called Review Apps. One can create copies of the app manually or set up automatic copies from new PRs on Github.
Read more at: https://devcenter.heroku.com/articles/github-integration-review-apps
Simply create new applications and push your code to them. If you need to copy data, checkout the pgbackups transfers.
For management purposes, check out this dev center article.
To do this programatically, you'll need to look at the Heroku gem, and then figure out a way of getting something to git push to the appropriate remote. I would be surprised if this was possible to be honest.