Making Fedena a Windows Service Failed - ruby-on-rails

I successfully installed Fedena on Windows using this tutorial:
http://en.wikibooks.org/wiki/Fedena/Installation
The problem is that each time I start windows, I need to run the command ruby script/server so that I can access the project locally. I tried making Fedena a Windows Service that starts automatically by following the steps mentioned in the tutorial, but it seems that it didn't work.
Making a Windows Service
If you want to run Fedena as a Windows Service (which automatically starts), do the following commands:
Open the Ruby Command prompt and go to your Fedena Installation director //do they mean by this C:/Fedena?
Install a Gem:
gem install win32-service
Install a Gem:
gem install mongrel_service
Run the command:
mongrel_rails service::install -N Fedena -c C:\FEDENA -p 3001 -e production
(Replace C:\FEDENA with whatever your Fedena installation Directory is.) You may also wish to change the port from 3001 to 80 so when entering the address from other computers, it is not required that you enter a port.
Go to windows search at the start menu, type:
services.msc
Look for service named 'Fedena' and set it to automatic
Restart your computer and see if the fedena start automatically. Always make sure that your server is running.
Any ideas what could be the problem?

Right after Fedena is configured, the start of the application is via console which should stay open for all the times if we want the application to be up and running. But quite often will get closed (human error, server down etc) and the application will go down.
The same applies if the server is rebooted/bounced and all over again.
So here is the solution if you don't want to go over this hassle:
Download http://nssm.cc/download/?page=download
Unpack it (lets say C:\NSSM)
Create a batch file ( lets say C:\Fedena\StartFedena.bat)
Edit the batch file ( right click on the bat file and click Edit)
Past the following code (change the paths accordingly)
********************************** (without the stars and this comment)
cd \
cd Fedena
mongrel_rails start -e production
Note: If you want to start it as development mode remove -e production from the last line
Open CMD
Type cd\
Type cd NSSM
depending on the system type: "cd win32" ot "cd win64"
9.Type in the cmd : "nssm install"
A modal window will pop-up
Click Browse
Navigate to the location where the batch file is and select it;
Leave options empty
Service name "Fedena"
Install Service
Go to "Services" (usually under Control Panel\System and Security\Administrative Tools)
Start Services
You should find service named "Fedena"
Start Service
Navigate to http://example.com:3000 and Fedena should be up
The service should be already set as automatic so if the server is restarted Fedena will come up automatically.
If you need to bounce the application just restart the Fedena Service.
That is,
Thank you

Related

open rails app from github in c9 IDE

How can I open my rails application using google cloud9 cloud service. https://ide.c9.io IDE? What steps do I need to take? I have already copied and pasted application folder in IDE but when I run "bundle exec rails server -b $IP -p $PORT" it doesn't show anything.
I have been using c9 for quite a long time.
This is how to start(assuming you already checked out the code :))..
1. open new terminal
2. run /bin/bash --login
3. rvm use 2.2.2#myapp ---if using rvm
4. sudo /etc/init.d/postgresql start -- start postgres server if using
if you still dont have rails ,install using Ruby version manager AKA rvm..its very easy.
Now run..rails s -b $IP -p $PORT.
So when you server has started successfully,hit the application on the browser using...https://<your-workspace-name>-<your username for git>.c9users.io/..
for me its like...geophotos-mike1011.c9users.io
you may also click top right button Preview ...to preview your app inside your window.
Moreover,you can customise your app setting to be public/private and many more things to do..if you are a premium user :)
Hope it helps.
When starting a new workspace, you have an option to clone from a github repository, there is a box that states Clone from Git or Mecurial URL. Simply fill in the appropriate url from your git repo, choose ruby on rails for the template, and you should be good to go.
Firstly, one of the things you need to note is to add your shh github fingerprint to c9, which will enable you to push to GitHub from c9 afterwards. c9 should put you through the necessary step.
Secondly, follow RailsCasts Tutorial on how to contribute to open source http://railscasts.com/episodes/300-contributing-to-open-source.
I think that's about all you need to make your problem solved.

Starting Erlang service at boot time (using Relx for creating release)

I have a server written in Erlang, compiled with Rebar, and I make a release with Relx. Starts nicely with
/root/rel/share3/bin/share3 start
The next step is to start when the server boots.
I have tried different approaches, the last one is using the /etc/init.d/skeleton where I changed the following
NAME=share3
DAEMON=/root/rel/share3/bin/share3
DAEMON_ARGS="$1"
After that, I run update-rc.d, but I have not gotten it too work. (Ubuntu 14.04)
The service runs until the machine reboots, and I need to login and start it again.
For Windows, it is really elegant, since it can create the Windows service.
Ubuntu uses upstart as init system, so you could try something like that:
description "Start my awesome service"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /root/rel/share3/bin/share3
You have to place this script in /etc/init/ directory with '.conf' extension like '/etc/init/share3.coinf'. To start it invoke sudo start share3.
At last, I solved it!
I have told to relx to place the result at /home/mattias/rel. The script from relx is /home/mattias/rel/share3/bin/share3
Replace the row
SCRIPT_DIR="$(dirname "$0")"
by (you need to fix the path /home/mattias/rel)
HOME=/home/mattias
export HOME
SCRIPT_DIR="/home/mattias/rel/share3/bin"
Copy the file to /etc/init.d/share3 using
sudo cp ~/rel/share3/bin/share3 /etc/init.d/
Test that it works using
/etc/init.d/share3 start
and
/etc/init.d/share3 stop
In order to make it start at boot, install sysv-rc-conf
sudo apt-get install sysv-rc-conf
Enable boot at start using
sudo sysv-rc-conf share3 on
and disable
sudo sysv-rc-conf share3 off
Alternatives are welcome.

rails s command does not run from ssh

I am using Putty to connect to my localhost, and I don't have any problems apparently, however, when I run command rails s to start my rails 4.0.0 application from Putty, it gives me this message:
jose#jose-laptop:~/rails/dedicated-agenda$ rails s
The program 'rails' can be found in the following packages:
ruby-railties-3.2
ruby-railties-4.0
Try: sudo apt-get install
I don't get that message from the terminal though, the application starts running just fine.
I had to reinstall ubuntu so I upgraded to ubuntu 14.04 just in case you need to know.
I don't know if I am missing something in my ssh settings or how could I use rails s from Putty.
Thanks in advance.
Your PATH environment variable is set differently when you are executing programs in an interactive shell and by ssh(using putty).
Use absolute path of the program to not depend on the PATH variable.
You can also set the right PATH variable at ~/.profile file and load the updated variables using the command source ~/.profile.
Now, you should be able to run the command.
You can use the command
>which rails
to see where rails is installed on your working session.
Then you need to make sure that is in your path when you ssh in.
If you are ssh'ing in as a different use then that user may not have permission to see the rails executable.

How to install mongodb in windows7 64x and how to use with ROR

I want to install mongodb in windows 7(64x) and use with ruby on rails what i do first and how?
download mongodb itself
Extract the archive to C:\ by right clicking on the archive and
selecting Extract All and browsing to C:.
Example: C:\mongodb-win32-x86_64-[version]
Start the Command Prompt by selecting the Start Menu, then
All Programs, then Accessories, then right click Command Prompt, and select Run as Administrator from the popup menu. In
the Command Prompt, issue the following commands:
cd \
move C:\mongodb-win32-* C:\mongodb
MongoDB requires a data folder to store its files. The default
location for the MongoDB data directory is C:\data\db. Create this
folder using the Command Prompt. Issue the following command
sequence:
md data
md data\db
Start MongoDB To start MongoDB, execute from the Command Prompt:
C:\mongodb\bin\mongod.exe
source

Postgres Server error -> PGError: could not connect to server

I get the error below when trying to start my rails app on the localhost:
PGError (could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
From what I have read it sounds like this is most likely a problem in connecting to the Postgres server, and may indicate that it is not started?
It all started when I was attempting my first (yay noobs!) merge using git. There was a conflict (having to do with the Rubymine workspace.xml file), and I started to open up a conflict resolution program. It then seemed that there was really no need to track workspace.xml at all and so I quit from the resolution program, intending to run "git rm --cached" on the file. I think in quitting the program something went foul, and I ended up restarting, before untracking the file, and then completing the merge. Further evidence that something was gummed up is that my terminal shell didn't open up correctly until I restarted the machine.
Now, as far as I can tell, everything in the merge went fine (there were trivial differences in the two branches anyway), but for the life of me I can't seem to get rid of this PGError. If it is as simple as starting the server, then I'd love help on how to do that.
(other context: OSx, rails 3, posgresql83 installed via macports, pg gem).
EDIT - I have been trying to start up the server, but am not succeeding. e.g., I tried:
pg_ctl start -D /opt/local/var/db/postgresql83/defaultdb
This seems to be the right path for the data (it finds the postgresql.conf file) but the response I get is "cannot execute binary file."
Try sudo port load postgresql83-server - this should work with the latest 8.3 port from macports.
If this doesn't work, try sudo port selfupdate; sudo port upgrade outdated and then try again.
Note - this may take absolutely ages.
and may indicate that it is not started?
Yes, sounds like the server is not running on your local machine.
See the description of this error in the PostgreSQL manual:
http://www.postgresql.org/docs/8.3/static/server-start.html#CLIENT-CONNECTION-PROBLEMS
To start the server, try something along the following lines (adjust for pgsql version # and logfile):
sudo su postgres -c '/opt/local/lib/postgresql84/bin/pg_ctl -D /opt/local/var/db/postgresql8/defaultdb -l /opt/local/var/log/postgresql84/postgres.log start'
To stop the server,
sudo su postgres -c '/opt/local/lib/postgresql84/bin/pg_ctl -D /opt/local/var/db/postgresql84/defaultdb stop'

Resources