I’ve been working on a Sinatra app to serve as a web development portfolio. I decided it is time to put it online using my shared host, Webfaction. Here in this post, I’m not going to go over all the steps to set up a Sinatra app. You can find my tutorial on that here: [...]
I’ve been working on a Sinatra app to serve as a web development portfolio. I decided it is time to put it online using my shared host, Webfaction. Here in this post, I’m not going to go over all the steps to set up a Sinatra app. You can find my tutorial on that here: Sinatra on Webfaction.
However, here I just wanted to discuss how I added a second Sinatra app on Webfaction. As a sys admin noob, it was not immediately obvious to me. After some thinking, I realized I could use my existing Nginx custom app. As I said… admittedly a noob.
And so the steps became:
Open a port for running Thin by creating a custom app in the webfaction control panel.
Make a custom app (“Custom app listening on port”) in the webfaction control panel. Name this app whatever your Sinatra app will be called. This app will show up in ~/webapps/APP_NAME.
Choose a domain/URL and add it to your existing Site being served by the Nginx App.
In the webfaction control panel, under Sites, if you are adding a second Sinatra app, then you already have a site being served by Nginx. You just need to add the domain/url for your app to the existing Site that is running your first Sinatra app.
Modify your ~/webapps/nginx/conf/nginx.conf
Add a new upstream app_name { } block and another server { } block.
Restart Nginx
[ ~/webapps/nginx]$ ps -u zhannes 20052 ? 00:00:00 nginx [ ~/webapps/nginx]$ kill 20052 [ ~/webapps/nginx]$ ./sbin/nginx
Make Sinatra app, rackup file, and create a yml file for Thin to read
Start Thin
Be done and happy.
Content © professional dilettante
Proudly powered by WordPress
Theme designed by Artisan Themes
25 queries.
0.927 seconds.
Great posts (both of them).
They helped me a lot.
Just out of curiosity: how do you deploy your code to webfaction?