Heroku: Run another web server process on an intermediate site?

I want to run another web server on one of my intermediate sites, which provides more convenient error handling in debug mode. I am wondering if it is possible, as possible, without modifying the Procfile between my intermediate and production deployments.

I tried this:

web: newrelic-admin run-program python manage.py run_gunicorn -b 0.0.0.0:$PORT -w 4 -k gevent debug: newrelic-admin run-program python manage.py runserver_plus 0.0.0.0:$PORT --threaded 

And then scaling the web to 0 and debugging to 1, but now it is clear from this article that the web is a special reserved keyword and that the only process that receives HTTP requests. So is there a way to handle this without having to maintain a separate branch or the like?

+4
source share
2 answers

Of course you can.

As you noticed, you need to use the "web" process type.

Remember that process types are actually simply named commands: "Each process type is a declaration of the command that runs when dyno starts this process type"

You manage a team.

In a small test application, I just created the bin directory, added the file and gave it permission to execute - like this:

 mkdir bin vi bin/go.sh chmod a+x bin/go.sh 

The content looked like this:

 echo $* echo $FOOBAR thin --rackup config.ru start $* 

Then I modified my Procfile to look like this:

 web: ~/bin/go.sh --port $PORT 

I also added the var configuration to my application:

heroku config: add FOOBAR = 123

Then I looked at the logs after starting

2013-03-14T11:49:42+00:00 heroku[web.1]: Starting process with command `~/bin/go.sh --port 47302` 2013-03-14T11:49:43+00:00 app[web.1]: --port 47302 2013-03-14T11:49:43+00:00 app[web.1]: 123 2013-03-14T11:49:44+00:00 heroku[web.1]: State changed from starting to up

Excellent. Do you see what happened?

  • When I started web dino, Heroku looked at the type of web process and ran the command
  • The command started my server, but before that it printed both the parameters passed to it (--port XXX) and the FOOBAR environment variable (which will be set in config var)

So, I think that's all you need. Just write a bash script that, depending on the var configuration, runs another command for production and production. In the configuration step, configure var. Not at the factory.

+5
source

You can create a separate Heroku application to work as an intermediate environment and use the same code base (local git repo). See Managing Multiple Environments for an Application

Note that the job you are asking for is related to changing the Procfile , so you can use the branch. In this case, you click on such branches (provided that several env according to the manual above):

 $ git push heroku-staging <branch_name>:master --app staging_app_name 
+1
source

Source: https://habr.com/ru/post/1468820/


All Articles