How would you deploy a Kelp app?

59 views
Skip to first unread message

Brad

unread,
Sep 26, 2014, 6:36:00 AM9/26/14
to perl...@googlegroups.com
I've created a nifty little API on my dev machine (which did not take long thanks to Kelp). I now need to deploy it to a staging VM for proper testing, and to allow the customer to try it out. I'm just wondering how you guys deploy your Kelp apps?

Cheers,
Brad

Stefan Geneshky

unread,
Sep 26, 2014, 10:43:34 AM9/26/14
to perl...@googlegroups.com
You would deploy a Kelp app the same way you would deploy a Plack app, so feel free to reach out to the Plack community as well.

This is how I usually deploy my projects:

start_server --port=8080 -- plackup -s Starman -E deployment app.psgi

start_server is provided by Server::Starter - http://search.cpan.org/~kazuho/Server-Starter-0.17/lib/Server/Starter.pm
It allows you to gracefully restart your application by sending the process a HUP signal.

I use Starman, but you can just as successfully use Starlet, depending on your needs.
It is important that you specify -E deployment, because this instructs Kelp to you your deployment.pl config file.

Alternatively,
​ instead of plackup,​
you can use uWSGI, which is written in C and it's very fast.
uwsgi --plugins psgi --init app.ini

Your app.ini could look something like:
[uwsgi]
http-socket = :8080
psgi = app.psgi
disable-logging = True

​You will have to install uwsgi yourself. I actually had to download its source and compile it.​

The above both methods start the application at port 8080. I use nginx, so I add to its configuration something in the lines of:

upstream ifnx {
        server 127.0.0.1:8080;
}

server {
        listen 80;
        server_name ifnx.com www.ifnx.com;
        client_max_body_size 100M;

        root /usr/share/nginx/html;
        access_log /var/log/nginx/ifnx_access.log;
        error_log /var/log/nginx/ifnx_error.log;

        location / {
                proxy_read_timeout 300;
                proxy_pass http://ifnx;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-HTTPS 0;
                proxy_set_header X-Real-IP $remote_addr;
        }
}

Maurice Aubrey

unread,
Sep 26, 2014, 12:13:12 PM9/26/14
to perl-kelp
On Fri, Sep 26, 2014 at 3:36 AM, Brad <br...@perlpowered.com> wrote:
I've created a nifty little API on my dev machine (which did not take long thanks to Kelp). I now need to deploy it to a staging VM for proper testing, and to allow the customer to try it out. I'm just wondering how you guys deploy your Kelp apps?

For Starman, I use this init script in production:

Brad

unread,
Sep 27, 2014, 8:41:09 AM9/27/14
to perl...@googlegroups.com
Ah nice, I have never heard of uwsgi.. will have to try it out! Yes, I generally use the Starman/nginx method, then supervise daemon tools to start and stop the service. It also monitors the process and restarts it if it gets unexpectedly killed, or machine rebooted - http://cr.yp.to/daemontools.html
Reply all
Reply to author
Forward
0 new messages