I'm trying to create a buildpack with libwebp, and I'm trying to follow this tutorial, which starts with the following commands:
heroku create buildpack-stager
heroku run bash --app buildpack-stager
curl -O https://mupdf.googlecode.com/files/mupdf-1.3-source.tar.gz
tar -xvzf mupdf-1.3-source.tar.gz
...
Should these initial commands be run in the terminal of my application on heroku?
heroku create should be run on your local machine. This creates a new app on Heroku, so if you already have an app to work with it may not be necessary.
heroku run bash should also be run on your local machine. This spins up a one-off dyno for your app and runs the command bash on it.
From there, it looks like they want you to continue with curl, tar, etc. in the same shell as the previous step. The effect will be that these commands are run on the one-off dyno you're using, but you don't need to change terminals or anything.
You might find the Heroku CLI commands documentation page helpful.
All these commands you should run on your local terminal (bash, etc.)
Related
Is it possible to run cutechess tournament on heroku. I can run normally run fishtest on heroku btw.
I tried it with docker but its giving me qt5 error. I tried to install cutechess from sources inside docker, copied cutechess-cli files to repo it runs but givin me uci or xboard error.
We've been experimenting with CF over Heroku and running into some issues. One of them deals with accessing the rails console in a CF AI. We're using Pivotal's PWS and have tried a number of things, including:
cd app; export HOME=$(pwd); source .profile.d/0_ruby.sh; rails c
and
cd app; export HOME=$(pwd); source .profile.d/*.sh; rails c
Both of which are hit or miss and typically don't work.
It seems a bit ridiculous that it's THIS much work to access the rails console via CF. I feel like there has to be a better, faster way.
Does anyone have any tips?
For anyone saying we should cf ssh in, here is what happens:
vcap#2f4663e4-f876-490c-65e2-a498:~$ cd app
vcap#2f4663e4-f876-490c-65e2-a498:~/app$ ls .profile.d/000_multi-supply.sh 0_ruby.sh
vcap#2f4663e4-f876-490c-65e2-a498:~/app$ source .profile.d/0_ruby.sh
vcap#2f4663e4-f876-490c-65e2-a498:~/app$ cd ..
vcap#2f4663e4-f876-490c-65e2-a498:~$ rails c
bash: rails: command not found
vcap#2f4663e4-f876-490c-65e2-a498:~$ source app/.profile.d/000_multisupply.sh
vcap#2f4663e4-f876-490c-65e2-a498:~$ rails c
bash: rails: command not found
As of writing this, to fire up a Rails console run cf ssh my-app -t -c "/tmp/lifecycle/launcher /home/vcap/app 'rails c' ''".
This will SSH into the container and use the lifecycle launcher, which sets up the environment for you, to execute the command.
I'd like to develop a rails app using docker so I don't have to install a database locally. Therefore I created the following basic example (new rails app):
https://gist.github.com/solars/62eeae2f86ab6ec3fa35
As you can see there is a problem with the bundler environment, can anyone tell me how to fix this?
Usually the Gemfile is copied over in the Dockerfile - but I think this is not necessary if mounting the app in a volume, is this right? (Most of the examples are using ADD or COPY for either the Gemfile or the app, but as I'm developing, I'd like to avoid that so I can always change things.
I also thought that something like docker-compose run app echo $PATH should return the $PATH in my container, but it seems to be the same as my local path? Same with echo $RAILS_ENV which returns nothing, although it's set in the compose file..
Solution: The container of course does not persist the bundled gems, that was the problem. So the solution is to either bundle in the Dockerfile, or have the gems in the app directory which is shared as a volume.
docker-compose run app echo $PATH will always return your local path, as the environment variable is interpreted by the local shell.
This would work better:
docker-compose run app sh -c 'echo $PATH'
Regarding rails, check "Rails 4 bundler: command not found: rails"
A bundle exec rake rails:update:bin might help (for instance, as a RUN directive in your Dockerfile).
Can I invoke "rake jobs:work" automatically after running "rails s" in console?
Currently, after running rails s in cmd I will also run rake jobs:work in the other console, what i want to happen is After running "rails s" the jobs:work will automatically start.
The right way to go about this would be to use a process manager, like Invoker or Foreman. There is ample documentation on the links, but it boils down to the following steps:
Install the software
Create a configuration file where you declare what processes do you intend to run. Both support Procfile style declaration.
Use the command line client to start the process manager.
Based on my personal experience, I highly recommend Invoker, it goes beyond just a process manager, and packs in a few more handy features, like support for .dev local domain.
One you can do is simply:
rails server & rake jobs:work
It'll run rails server as background job, which you can get back to foreground with fg. It can be annoying that you'll get output from both processes mixed.
I'm not sure what are your needs and what you expect but maybe it would be good for you to use screen (or tmux) to run them in parallel and be able to switch between.
You can do your own .screenrc script which will run the server and any other commands when automatically for you.
There is a little problem that if you run the server from it and you close it (ctrl+c) than you'll loose it's screen window. Fortunately there is a solution for that as well (worked-out on the SO as well - you can read more about it here)
So, I use some helper script for that .run_screen (don't forget to chmod +x it):
#!/bin/bash
/bin/bash -i <<<"$*; exec </dev/tty"
Than I have .screenrc_rails file:
#shell -${SHELL}
caption always "%n(%t) %= %{b}#%H[%l] : %{r}%c:%s"
termcapinfo xterm ti#:te#
termcap xterm 'AF=\E[3%dm:AB=\E[4%dm'
terminfo xterm 'AF=\E[3%p1%dm:AB=\E[4%p1%dm'
startup_message off
screen -t server 2 ${HOME}/.run_screen rails s
screen -t spork 3 ${HOME}/.run_screen bundle exec spork
screen -t dev_log 4 ${HOME}/.run_screen tail -f ./log/development.log
screen -t test_log 5 ${HOME}/.run_screen tail -f ./log/test.log
screen -t bash 0
screen -t bash 1
And an alias ( screenr(ails) ) defined at .bash_profile:
alias screenr='screen -c ~/.screenrc_rails'
If you don't know screen than start from ctrl+a, ". ctrl+a, ? will give you some help.
I hope you'll enjoy it.
In a windows environment I am getting the following error when trying to deploy to Heroku
C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/base.rb:32:in ': No such file or directory - git
remote (Errno::ENOENT)
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/ba
se.rb:32:in shell'
from C:/Ruby/lib/ruby/1.8/fileutils.rb:121:in
chdir'
from C:/Ruby/lib/ruby/1.8/fileutils.rb:121:in
cd'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/ba
se.rb:32:inshell'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/ap
p.rb:52:in create'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/command.rb:
48:insend'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/command.rb:
48:in run_internal'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/command.rb:
20:inrun'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/bin/heroku:13
from C:/Ruby/bin/heroku:19:in `load'
from C:/Ruby/bin/heroku:19
Any idea how I can correct this? This is being run from the Ruby Command line (which seems to me like the regular command line)
Ok so I figured out a way to make it work and why it is likely happening.
For some reason I can only run the Ruby commands from the CMD prompt however the GIT commands only seem to work from the GIT Bash. When in the GIT Bash the Ruby commands don't work.
When you run the Heroku commands to create the service it seems to want to run certain GIT commands which don't work from the CMD prompt the way I have it set up.
To get around this for the moment I am adding the Heroku path for GIT as a remote manually and then pushing that manually when needed. An extra step but everything still works as intended.
If you need help with the work around check out the information in this link: http://www.wiki.devchix.com/index.php?title=Working_around_the_%22heroku_create%22_error
I'd still recommend using Git Bash over the normal windows CMD prompt.. but I know how tedious that can be sometimes.
You can bypass the need to do this however and get your Heroku gem working properly in your windows CMD prompt by adding your msysgit/bin path to your system Path variable.
That'll give your heroku gem access to the git command.
To add heroku as remote use the following:
git remote add heroku git#heroku.com:yourappname.git
Then push your master copy to Heroku:
git push heroku master