I have a nodejs application that I need deploy on Heroku
that Connects with a mongodb Database
Now I need to host this on heroku and have a dot env file which contains the creds (which contains DB_URL, DB_NAME , DB PASS)
So should I add .env into gitignore and the push the code into github repo or don't add it to gitignore and then push. Because I will be connecting this repo into heroku for deployment
Related
I'm trying to setup bitbucket pipeline to auto deploy laravel app to heroku
1. Created an app on heroku
2. pushed the code to bitbucket repo
3. added repo environment on bitbucket with the name of the heroku app and app key
4. created .yml file and put this code http://prntscr.com/rb3u4p
5. Pipeline fails http://prntscr.com/rb3ybo
It says the zip file name i mentioned on the yml not found, do i need to create the zip on Heroku. I already created the same zip file on my local and pushed to bitbucket.
You have to zip the source code of you application in your pipelines so the pipe can push in to Heroku. This guide provides a good example https://confluence.atlassian.com/bitbucket/deploy-to-heroku-872013667.html
First thing i am very new in Vue, adonis and heroku. so please tell me all the steps in answer
i have a project build in vuejs(frontend) and adonisjs api-only and i want to deploy this project on heroku with postgresql database.
What i am done till now:-
1). create a heroku account
2). create a project on heroku
3). upload frontend dist/ folder on heroku using these command
git add --all
git commit -m "initial commit"
git push heroku master
And my frontend run perfectly but i don't know how to deploy backend and how to create database
in heroku.
my working directories are
To deploy the back-end application you can do the same steps as you did for the other application.
Here's what's changing:
Add database with heroku add-ons (https://elements.heroku.com/addons/heroku-postgresql)
! When adding the add-on new heroku environment variables are created. (If they do not appear, see below)
Interesting things to know:
To execute Adonis commands : node ace <your_command> (node ace migration:run)
I advise you to use the heroku environment variables. Don't forget to add the variable ENV_SILENT = true to avoid errors because of the.env file.
Get connection db informations: (on your postgresql add-on):
Some additional information
Personal project deployed on heroku (.gitlab-ci.yml) : https://gitlab.com/CrBast/website
Interesting article : https://scotch.io/tutorials/deploying-adonisjs-apps-to-heroku
If my explanations are not clear, don't hesitate to tell me :)
I'm trying to deploy a website via CodeShip unto Heroku. The site is built with Yeoman's Angular-Fullstack generator, which is pushed to GitHub. Codeship detects the push, builds the entire thing and then the trouble start.
Angular-Fullstack is set up so that the dist/ folder contains the entire Heroku app, so blindly deploying everything will not work on Heroku.
Locally, I can use the Heroku toolbelt to login, add a remote inside the dist folder, and then use grunt buildcontrol to deploy the entire thing unto Heroku.
But in Codeship there are a few caveats:
* I cannot install the Heroku toolbelt with wget because it needs sudo and Codeship doesn't support that
* If I could, I couldn't login to Heroku using the CLI because I cannot interact with the shell in Codeship
* I cannot go into the dist/ folder and after adding the remote, simply push to Heroku because I need to enter my credentials.
Is there a way that I missed here? I'd like to let Codeship handle everything from building to deployment to Heroku (only on the master branch).
Figured it out!
I skipped the step where I was trying to install the Heroku Toolbelt, and just added the repo on Heroku as remote:
git remote add heroku ssh://git#heroku.com/[your-heroku-app-name].git
Codeship has public keys available for every build. So, I added that publick key to my Heroku account.
Then I noticed that Git was still trying to push using HTTPS instead of SSH, so I added this to the deployment script:
git config --global url.ssh://git#heroku.com/.insteadOf https://git.heroku.com/
This made sure that Git uses the SSH url for Heroku. I then let Codeship build the entire project and push it with grunt buildcontrol:heroku.
I've got an app, that has 'heroku' configured as a remote, to one application.
Let's call this app 'MyAppDev'
However, I have another app, called 'MyAppLive'
I want to configure deployment like this:
git push staging
push to MyAppDev
git push production
push to MyAppLive
How can I do this?
Also, what about environment variables?
Both apps have MongoLab, so I'd like the MyAppDev app to use it's own db....
Here are the steps that you'd need to follow
git remote rm heroku - this will remove the heroku remote from your application
git remote add production <production apps heroku git repo url> - this will add a new remote named 'production' pointing at the production apps git repo url (you can get this from the My Apps page on heroku.com
git remote add staging <staging apps heroku git repo url>
This now means you can do git push production master or git push staging master to push your codebase to either repo.
NOTE If you need to push branches to Heroku you need to push them into the master branch of Heroku.
eg. assuming a staging branch locally you would do;
git push staging staging:master
To push your locally staging branch into master of the staging remote.
Any addons you use would need to be duplicated to the staging application.
Config variables can either be done manually via heroku config:set or you can use the plugin detailed at the bottom of this page https://devcenter.heroku.com/articles/config-vars which allows you to push and pull your Heroku variables into a .env file suitable for running with Foreman locally. Becareful about overriding variables though - I tend to do my variables manually as I don't typically have many.
I'm trying to migrate my app to Heroku - I have a config file that varies with development/staging/production environments as it contains uniquely assigned keys (from Facebook, S3, etc.), so I keep it out of the repository and keep the configs local.
As such I'm trying to find a solution for Heroku to have that config file since Heroku deploys from the repository. I noticed Heroku deploys from the master branch - can it deploy from another branch? Because then I could commit the Heroku configs there, and have it not overwrite the other environments' configs every time it pulls.
Thanks!
I believe Heroku always launches the master branch of the Gt repo, but they support config vars to address exactly this issue.
You can use foreman and heroku-config for this.
Check out the article at heroku dev center:
http://devcenter.heroku.com/articles/config-vars
I love this because you can keep the .env file in .gitignore and shield your production variables from ending up in the repository.