I am making a API project on OpenShift, which has a Node.js server and Ruby backend. I have set up a deployment for Node.js to handle API requests and a MongoDB deployment to store the data, but I'm having trouble with the Ruby backend.
The Ruby backend is responsible for updating the database every so often and thus must run at a regular interval or constantly. That's find, the issue is that OpenShift seems to want me to use Rack to start a web server, but that's not what I want. I just want the Ruby to run as a daemon and scrape the web to update the API every, say, 15 minutes.
How can I use Ruby without making a webserver- that is, get around the errors about not having Rack gem installed?
Related
I have a NS app that talks to a web api backend. I do not want to hardcode the api base url in the app itself because I need to be able to use different urls for development, testing, and production for different versions of the app.
E.g. Version 1.0 is in production and is pointing to https://someapi.com. I am currently working on version 1.1 and I want to point that to https://dev.someapi.com during development and testing because I have API changes as well. Once this version is QA'd and passes app store validation agains the test API. I will push it to production, deploy the API, and point the version 1.1 from https://dev.someapi.com to https://someapi.com.
Currently, I have a database table that has the api endpoint for each version and environment, so if I needed to QA the app for version 1.1, I query the database when I load the app and get the api endpoint for this version and environment.
Is there a better way for doing this?
Thanks.
Use environment variable with Nativescript CLI & Webpack. You may configure the URLs based on what environment you are building the app for.
There are lot of similar other ways around if you go through Webpack docs.
I'm in the process of deploying my Rails app (it also uses redux, react, as well as some Ruby and Javascript). And I'm on the step in the official Heroku guide where it specifies to add a Procfile.
I assume that these are the commands that will run once the apps starts up; what exactly do I need to put in here for a Rails app that uses a database?
Locally, I know that to start my app I run rails s, as well as setting up the database beforehand; do I need to do something like that in the Procfile?
Heroku is fantastic for prototyping ideas and running simple web services, I often use it to run Python web services like Flask and Django and try out ideas. However I've always struggled to understand how you can use the infrastricture to run those amazingly powerful support or utility services every startup needs in its stack. 4 exmaples of services I can't live without and would recommend to any startup.
Jenkins
Statsd
Graphite
Graylog
How would you run these on Heroku? Would it be best just getting dedicated boxes (Rackspace, e.t.c) with these support services installed.
Has anyone one run utility deamons (services) on Heroku?
There are two basic options. The first is to find or create a Heroku addon to accomplish the task. For example, there are many hosted logging solutions you can use instead of Graylog; Rails on Fire or Travis can be used instead of Jenkins. If an appropriate addon doesn't exist, you can effectively make your own by just running the service on an AWS EC2 instance.
The other alternative is to push the service into being a 12factor application so that it can run on Heroku as well. For example, you could stub out whisper's filesystem calls so that they store in a backing service instead. This is often pretty painful and brittle, though, unless you can get your changes accepted by the upstream maintainers.
you could also use another free service in conjunction with it. OpenShift has a lot of Java related build services and tools that can be added.
I am using a mix of heroku, openshift, mongolab and my own web hosting. Throw in dropbox and box for some space...
I have been learning Ruby and Sinatra over the past couple months and I would like to get my app out in the wild. I am looking for suggestions for web hosts that support Sinatra apps and any details as to the actual process would be great as well.
I currently use hostmonster for a couple other sites. Hostmonster does support Rails applications. I would assume since Rails runs on Rack, hostmonster will also run Sinatra apps but I am not certain.
I haven't had much luck finding documentation on running Sinatra apps on hostmonster or any other web host outside of Heroku. Also, I haven't been able to figure out how to get my Sinatra app running by following through the Rails installation documentation provided by hostmonster.
You should be able to run on any app that works for Rack. The convention is to use the config.ru file. In there, instead of specifying how to load Rails, just specify how to load Sinatra.
Example config.ru
require File.dirname(__FILE__) + "/main"
run Sinatra::Application
Where "main" is the file that loads all the Sinatra stuff.
I have a Ruby script that I want to run every few minutes using Google App Engine. I don't want to run a web service, just that script. Any ideas how to do that with JRuby?
Checkout cron support on GAE:
http://code.google.com/appengine/docs/java/config/cron.html
Not sure what you mean by "don't want to run a web service," but this is the way to do it on GAE.