what can i add to my .travis.yml to run heroku client commands?
e.g. before deploy:
$ heroku maintenance:on
$ heroku pgbackups:capture --expire
and after deploy:
$ heroku maintenance:on
i've tried adding those commands to before_deploy in .travis.yml, but it doesn't have access to the heroku cli tool.
bonus points if i can do this on the app level, e.g. do backups on the production branch, but not staging.
I just installed Heroku toolbelt in a build container. That's how it looks in my build:
sudo: required
before_script:
# this install.sh script requires sudo
- wget -qO- https://toolbelt.heroku.com/install.sh | sh
script:
- /usr/local/heroku/bin/heroku restart --app my-heroku-app-name # requires HEROKU_API_KEY env variable
Note: installing Heroku requires sudo privilege (sudo: required) and if you have to access your app - $HEROKU_API_KEY environment variable must be set.
You might be able to everything you need with the Heroku deployment support available on Travis CI.
If you need to do more, you need to install Heroku toolbelt, and figure out how to do what you want.
Related
after uploading my project Laravel in Heroku say "Vite manifest not found at: /app/public/build/manifest.json"
it work perfectly in localhost but in Heroku not working.
this is a preview of the problem
https://res.cloudinary.com/wanis4007/image/upload/v1656872417/Screenshot_2022-07-03_211622_ohzgs5.png
I run this code before push the project in Heroku
npm install
npm run dev
npm run build
any suggestion ?
okay , the solution is to add both nodejs and php buildpacks to the project before deployment (you can do this also after deployment but you have to redeploy the project)
heroku buildpacks:set heroku/php
heroku buildpacks:set heroku/nodejs
and make sure you have the two buildpacks (php and node js) in your project by using this code
heroku buildpacks
note : you can add buildpacks with heroku dashboard in setting section
I fixed mine:
This solution is inspired by zneharks
$ heroku plugins:install buildpack-registry
$ heroku plugins:install buildpacks
Solution of zneharks
And I set nodejs
$ heroku buildpacks
Or
$ heroku buildpacks:set heroku/nodejs
I solved my code with this
$ heroku buildpacks:add --index 1 heroku/nodejs and
$ heroku buildpacks
after running this in my terminal, I adjusted my code and push to heroku again.
Note: The --index 1 means nodejs build pack will run first before php. PHP Buildpack has already been reinstalled with laravel/heroku.
when you run
heroku buildpacks
it should give you the two buildpacks which is
$ heroku/nodejs and heroku/php
I have tried
$ npm install -g heroku
$ npm install -g heroku-cli
and I have also tried downloading Heroku-CLI from the heroku site and when I attempt to run
heroku login
It comes back with
Warning: login is not a heroku command. Did you mean join? [y/n]:
I can't figure out what is going on. I have my environmental variables set up and everything.
Try uninstalling heroku cli by npm -g uninstall heroku cli and then run heroku login
For more refer to this: https://github.com/heroku/cli/issues/855
I can't run bulma on Heroku and npm is not a Heroku command.
What should I type to do npm install bulma on Heroku? Do I need to use yarn?
brew install yarn, yarn add bulma doesn't work on Heroku either.
Here is the error I'm seeing:
Sass::SyntaxError: File to import not found or unreadable: bulma/sass/utilities/_all.sass.
Don't install Bulma yourself, and certainly don't try to install yarn via Homebrew.
Heroku's ephemeral filesystem will prevent it from working properly, interactive commands run on temporary one-off dynos that only exist as long as your session runs, and brew is mostly a macOS package manager (though a Linux version does technically exist).
Heroku will build your application for you as long as you tell it how.
Make sure to include a package.json and package.lock or yarn.lock that includes the JavaScript libraries you need
Tell Heroku which buildpacks to use for your application:
$ heroku buildpacks:set heroku/ruby
$ heroku buildpacks:add --index 1 heroku/nodejs
Make sure the Ruby buildpack is last:
$ heroku buildpacks
=== your-app Buildpack
1. heroku/nodejs
2. heroku/ruby
Deploy your code
Heroku will run the Node.js buildpack first and install JavaScript packages from your lock file, then run the Ruby buildpack and install your gems.
I would like to use the AWS CLI in an Heroku Ruby project (mainly to use it with a thin wrapper from the ruby application).
Is there any standard way to install additional software like this into an existing application with a Gemfile?
Here are the steps that worked for me:
1) use buildpack-multi to install buildpacks both for ruby and python:
heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
echo "https://github.com/heroku/heroku-buildpack-ruby" >> .buildpacks
echo "https://github.com/heroku/heroku-buildpack-python" >> .buildpacks
echo "web: bundle exec rails server -p $PORT" > Procfile
2) add a requirements.txt file to the root of the project, containing the desired pip package:
echo "awscli" >> requirements.txt
3) deploy to Heroku
git add .buildpacks requirements.txt Procfile
git commit -a -m "use buildpacks for ruby and python, install aws cli"
git push heroku
This works just fine and allows me to use my aws scripts from my ruby app.
As was pointed out to me, using fog is probably the better solution in the long term.
You can use Docker to vendor things for Heroku apps.
Add a Dockerfile
FROM ubuntu:14.04
COPY . /app
Then build an image and run a container:
$ docker build .
$ docker run -it $image_id bash
# apt-get update && apt-get install jq
Now you can copy the data out from another terminal:
$ docker cp $container_id:/usr/bin/jq .
The aws-cli tool is tricker because it needs a whole Python environment.
You should add the Heroku buildpack for the AWS CLI via running:
$ heroku buildpacks:add heroku-community/awscli
More details can be found on herokus page, or in the buildpack's git repo.
ON MAC OS X 1.7.2
I tried following the instructions https://devcenter.heroku.com/articles/migrating-from-shared-database-to-heroku-postgres
So I tried running the command on my-app:
$ heroku addons:add heroku-postgresql:dev -a my-app
-----> Adding heroku-postgresql:dev to test-biowatts... failed
! You're running an outdated version of the Heroku gem/toolbelt that cannot perform the requested action. Please update your client and try again.
So I tried to update Heroku
$ heroku update
! update is not a heroku command. See 'heroku help'.
Where
$ heroku version
heroku-gem/2.4.0
QUESTION UPDATE 1 - Heroku update now gives a different message
$ heroku update
! `heroku update` is only available from Heroku Toolbelt.
! Download and install from https://toolbelt.heroku.com
so I downloaded and installed toolbelt but the heroku update still gives the same message
QUESTION UPDATE 2 - Removed heroku installed TOOLBELT - RESOLVED
sudo rm -rf /usr/local/heroku
sudo rm -rf /usr/bin/heroku
gem uninstall heroku
then installed https://toolbelt.heroku.com/
Restarted terminal
AND IT WORKED!
Cheers,
joel
Have you tried gem update heroku?
If you are using Mac OSX mountain lion. Maybe you should better use heroku toolbelt. I had almost same issue, and it fixed after I installed Heroku toolbelt.