Hi Bahman,
Bahman Movaqar <
b.mo...@gmail.com> writes:
> I need to run *multiple* instances of *one* Noir app on *one* server.
> What is the recommended way to do so? How do you people deal with this
> in real world?
This is actually a great use case for Immutant! :)
By default on Immutant, applications are mounted at a context path
corresponding to the name from project.clj. But you can override this
with the --name option:
$ cd /where/your/app/is
$ lein immutant deploy --name example1
$ lein immutant deploy --name example2
$ lein immutant deploy --name example3
So your single app would be available at the following URL's:
http://localhost:8080/example1
http://localhost:8080/example2
http://localhost:8080/example3
The --name option is what allows you to deploy the same app multiple
times, but the --context-path and --virtual-host options give you even
more control.
For example, you can mount all three apps at the root context as long as
you bind them to different virtual hosts, e.g.
$ lein immutant deploy --context-path / --virtual-host
example1.com
This would have your app available at the following URL's:
http://example1.com:8080
http://example2.com:8080
http://example3.com:8080
There are no uber(j|w)ars to create. Immutant deploys your app from
where it sits on disk. This is handy for development, but not in
production. So there you can pass the --archive option to create an
archive, or use the plugin's archive task.
Once deployed, you now have only a single process to manage (and
hopefully better memory utilization): when you start up Immutant, it'll
mount all your apps at whatever virtual hosts and/or context paths you
specified when you deployed them. If you change your mind, just
redeploy.
Drop in #immutant on freenode if you have any questions.
Good luck!
Jim