foreman interview questions
Top foreman frequently asked interview questions
I think this is a little easy question!
I'm using .env
file to keep all my environment variables, and i'm using foreman
.
Unfortunately, these environment variables are not being loaded when running rails console rails c
so, i'm now loading them manually after running the console, which is not the best way.
I'd like to know if there any better way for that.
Source: (StackOverflow)
A web app I am writing in JavaScript using node.js. I use Foreman, but I don't want to manually restart the server every time I change my code. Can I tell Foreman to reload the entire web app before handling an HTTP request (i.e. restart the node
process)?
Source: (StackOverflow)
When I run foreman I get the following:
> foreman start
16:47:56 web.1 | started with pid 27122
Only if I stop it (via ctrl-c) it shows me what is missing:
^CSIGINT received
16:49:26 system | sending SIGTERM to all processes
16:49:26 web.1 | => Booting Thin
16:49:26 web.1 | => Rails 3.0.0 application starting in development on http://0.0.0.0:5000
16:49:26 web.1 | => Call with -d to detach
16:49:26 web.1 | => Ctrl-C to shutdown server
16:49:26 web.1 | >> Thin web server (v1.3.1 codename Triple Espresso)
16:49:26 web.1 | >> Maximum connections set to 1024
16:49:26 web.1 | >> Listening on 0.0.0.0:5000, CTRL+C to stop
16:49:26 web.1 | >> Stopping ...
16:49:26 web.1 | Exiting
16:49:26 web.1 | >> Stopping ...
How do I fix it?
Source: (StackOverflow)
I have been attempting to complete this tutorial, but have run into a problem with the foreman start
line. I am using a windows 7, 64 bit machine and am attempting to do this in the git bash terminal provided by the Heroku Toolbelt.
When I enter foreman start
I receive:
sh.exe": /c/Program Files (x86)/Heroku/ruby-1.9.2/bin/foreman: "c:/Program: bad
interpreter: No such file or directory
So I tried entering the cmd in git bash by typing cmd
and then using foreman start
(similar to a comment on one of the answers to this question suggests). This is what that produced:
Bad file descriptor
c:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.62.0
/lib/foreman/engine.rb:377:in `read_nonblock'
c:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.62.0
/lib/foreman/engine.rb:377:in `block (2 levels) in watch_for_output'
c:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.62.0
/lib/foreman/engine.rb:373:in `loop'
c:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.62.0
/lib/foreman/engine.rb:373:in `block in watch_for_output'
21:06:08 web.1 | exited with code 1
21:06:08 system | sending SIGKILL to all processes
I have no clue what the second set of errors is trying to tell me, since the file location it seems to claim engine.rb is running from does not even exist on my computer.
I have looked at other answers to similar problems, however I am not receiving similar errors and so do not believe a solution to my problem currently exists.
Source: (StackOverflow)
I am trying to export my application to another process management format/system (specifically, upstart). In doing so, I have come across a number of roadblocks, mostly due to lacking documentation.
As a non-root user, I ran the following command (as shown here):
-bash> foreman export upstart /etc/init
ERROR: Could not create: /etc/init
I "could not create" the directory due to inadequate permissions, so I used sudo
:
-bash> sudo foreman export upstart /etc/init
Password:
ERROR: Could not chown /var/log/app to app
I "could not chown... to app" because there is no user named app
.
Where is app
coming from?
How should I use forman to export to upstart?
Source: (StackOverflow)
I'm following the heroku tutorial for Heroku/Facebook integration (but I suspect this issue has nothing to do with facebook integration) and I got stuck on the stage where I was supposed to start foreman (I've installed the Heroku installbelt for windows, which includes foreman):
> foreman start
gives:
C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find foreman (>= 0) amongst [POpen4-0.1.4, Platform-0.4.0, ZenTest-4.6.2, abstract-1.0.0, actionm
ailer-3.0.11, actionmailer-3.0.9, actionpack-3.0.11, actionpack-3.0.9, activemodel-3.0.11, activemodel-3.0.9, activerecord-3.0.11, activerecord-3.0.9, activerecord-sqlserver-adapter-3.0.15, activereso
urce-3.0.11, activeresource-3.0.9, activesupport-3.0.11, activesupport-3.0.9, addressable-2.2.6, annotate-2.4.0, arel-2.0.10, autotest-4.4.6, autotest-growl-0.2.16, autotest-rails-pure-4.1.2, autotest
-standalone-4.5.8, builder-2.1.2, bundler-1.0.15, diff-lcs-1.1.3, erubis-2.6.6, factory_girl-1.3.3, factory_girl_rails-1.0, faker-0.3.1, gravatar_image_tag-1.0.0.pre2, heroku-2.14.0, i18n-0.5.0, json-
1.6.1, launchy-2.0.5, mail-2.2.19, mime-types-1.17.2, mime-types-1.16, nokogiri-1.5.0-x86-mingw32, open4-1.1.0, pg-0.11.0-x86-mingw32, polyglot-0.3.3, polyglot-0.3.1, rack-1.2.4, rack-1.2.3, rack-moun
t-0.6.14, rack-test-0.5.7, rails-3.0.11, rails-3.0.9, railties-3.0.11, railties-3.0.9, rake-0.9.2.2, rake-0.8.7, rb-readline-0.4.0, rdoc-3.11, rdoc-3.8, rest-client-1.6.7, rspec-2.6.0, rspec-core-2.6.
4, rspec-expectations-2.6.0, rspec-mocks-2.6.0, rspec-rails-2.6.1, rubygems-update-1.8.11, rubyzip-0.9.4, rubyzip2-2.0.1, spork-0.9.0.rc8-x86-mingw32, sqlite3-1.3.3-x86-mingw32, sqlite3-ruby-1.3.3, te
rm-ansicolor-1.0.7, thor-0.14.6, tiny_tds-0.4.5-x86-mingw32, treetop-1.4.10, treetop-1.4.9, tzinfo-0.3.31, tzinfo-0.3.29, webrat-0.7.1, will_paginate-3.0.pre2, win32-api-1.4.8-x86-mingw32, win32-open3
-0.3.2-x86-mingw32, win32-process-0.6.5, windows-api-0.4.0, windows-pr-1.2.1, zip-2.0.2] (Gem::LoadError)
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:256:in `to_spec'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems.rb:1210:in `gem'
from C:/Program Files (x86)/ruby-1.9.3/bin/foreman:18
Since I'm a complete noob in this I'm not sure if my question here is a duplicate for Error on 'foreman start' while following the Python/Flask Heroku tutorial (because it's not quite the same error). If so, does anyone have a method for deploying a development environment on windows (for Heruko, Python, Facebook app)? Or should I use Ubuntu for this?
Thanks
Source: (StackOverflow)
what is the "foreman way" for behaving differently in production vs
development? That is we want foreman start to start up a bunch of
stuff in dev, however in heroku production we don't need it to start
(for example) solr.
Source: (StackOverflow)
I have a homemade Sinatra application for which I intend to use Heroku to host it.
I use foreman and shotgun in development, with the following Procfile:
web: shotgun config.ru -s thin -o 0.0.0.0 -p $PORT -E $RACK_ENV
It works great with both development and production. But the thing is, I don't want to use shotgun in production since it's too slow.
Can we use separate Procfile configurations for both dev and prod?
Source: (StackOverflow)
I just got into rails programming and it looks like there are two programs I can use to run my project locally: rackup and foreman.
One difference I noticed is that foreman will not output some things that I would expect to see and I would see if I ran rackup instead, until I press ctrl+c to close the server. Then all those messages appear, as if they were being hidden.
Is there a reason for this? How can I get foreman to be more verbose?
Source: (StackOverflow)
I'm trying to get a node.js app to start using foreman. I run the forman start
command in the projects root directory and I keep getting the following error:
/Users/Hebime/.rvm/gems/ruby-1.9.3-p448/gems/dotenv-0.8.0/lib/dotenv/environment.rb:34:in `block in load': Line "== project-ps Config Vars" doesn't match format (Dotenv::FormatError)
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/gems/dotenv-0.8.0/lib/dotenv/environment.rb:27:in `each'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/gems/dotenv-0.8.0/lib/dotenv/environment.rb:27:in `load'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/gems/dotenv-0.8.0/lib/dotenv/environment.rb:23:in `initialize'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/gems/foreman-0.63.0/lib/foreman/engine.rb:172:in `new'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/gems/foreman-0.63.0/lib/foreman/engine.rb:172:in `load_env'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/gems/foreman-0.63.0/lib/foreman/cli.rb:136:in `load_environment!'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/gems/foreman-0.63.0/lib/foreman/cli.rb:38:in `start'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/gems/foreman-0.63.0/bin/foreman:7:in `<top (required)>'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/bin/foreman:23:in `load'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/bin/foreman:23:in `<main>'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/Hebime/.rvm/gems/ruby-1.9.3-p448/bin/ruby_noexec_wrapper:14:in `<main>'
The project works perfectly fine on my co-workers machines using the same command.
I'm using OSX 10.8.4.
Any ideas?
Thanks!
Source: (StackOverflow)
I have an node.js application that I can debug with node-inspector running:
node --debug app.js
But I want to use foreman to start my application so it will load environment variables in the .env file. Like so:
foreman start
Is there a way to run the app with foreman and also use node-inspector? I tried:
foreman start --debug
but didn't have any luck with that.
Thanks.
Source: (StackOverflow)
I'm trying to set up a Heroku-ready Flask app, but I can't figure out how to turn on logging.
Without Foreman, I could create a helloworld app as described in the Flask tutorial:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
app.logger.debug('A value for debugging')
app.logger.warning('A value for warning')
return "Hello World!"
if __name__ == "__main__":
app.run(debug=True)
start it like so:
python hello.py
and have logging in stdout.
When I follow the Heroku tutorial, however, there's no app.run
line:
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
app.logger.debug('A value for debugging')
app.logger.warning('A value for warning')
return 'Hello World!'
And so I can't figure out how to run in debug mode and/or get logging output:
foreman start -p 5000
Procfile:
web: gunicorn hello:app
Source: (StackOverflow)
Context:
I am writing a medium sized flask application (10-15 views), and in the process, I am hoping to organize the code in a manner that will make it easily maintainable and extensible (not a monolithic file as most Flask applications are).
The structure of the application mimics the documentation as follows:
/AwesomeHackings
/ENV
/AwesomeHackings
/models
/static
/templates
/__init__.py
/awesome.py
/awesome.cfg
/Procfile
/README.MD
/requirements.txt
/run.py
Problem:
I am unable to get foreman to work with a flask application which is not named 'app'. I would love to have run.py be the entry point to my application.
I am using gunicorn + gevent, and my current Procfile contains:
web: gunicorn -w 2 -b 0.0.0.0:$PORT -k gevent app:run
I have been using run.py
to test the application:
from AwesomeHackings import awesome
awesome.app.run(debug=True)
Thus I assumed I could simply substitute run
for app
in the Procfile, but when executing foreman start
, gunicorn fails with meaningless verbiage about modules.
Source: (StackOverflow)
I am getting following error even after starting forreman and starting sunspot:solr :
RSolr::Error::InvalidRubyResponse - 200 OK
Error: java.lang.NullPointerException
at org.apache.solr.handler.XmlUpdateRequestHandler.doLegacyUpdate(XmlUpdateRequestHandler.java:129)
at org.apache.solr.servlet.SolrUpdateServlet.doPost(SolrUpdateServlet.java:87)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:297)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
Request Data: "User 1UserActiveRecord::BaseUserK12 Administratoradmin1adminK12 Administratoradmin"
Does anyone know why am I getting this this error? Please help me.
Thank you
Source: (StackOverflow)