Can't configure thin to start at system boot on CentOs - ruby-on-rails

I can't configure thin to start at system boot, I am new to Linux
I have CentOS 5.7
Thin gem was installed and thin was installed too.
sudo gem install thin
sudo thin install
and when I try to configure thin to start at system boot I get an error
sudo /sbin/chkconfig --level 345 thin on
error reading information on service thin: No such file or directory
Anybody have an idea why I get this error?
Thanks,

sudo mv /etc/rc.d/thin /etc/rc.d/init.d/thin, and retry.

Related

Windows WLS, Postgresql on Windows and Rails, cannot build a db

I'm trying to work with Windows WLS.
I have installed ruby and rails and they work (apart the annoying warning).
I've installed postgresql client on Ubuntu/WLS, and postgresql server on windows.
When i try to connect via:
psql -p 5432 -h localhost -U postgres
all run correctly.
When i try to launch:
rails db:create
i have this error:
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"
The error can means that the Postgresql server is not running. Try starting it
sudo systemctl start postgresql
and Make sure that the server starts on boot:
sudo systemctl enable postgresql
or
This issue can comes from installing the postgres package without a version number.
sudo apt-get remove --purge postgresql
and reinstall
sudo apt-get install postgresql-(what is the current version)
Resolved. If someone needs, in the configuration file we need to add host: localhost

Redis Server Failure when server starts

When I start redis on OSX, it exits because it says it can't handle RDB format version 7. Here's the output:
Server started, Redis version 3.0.7
Can't handle RDB format version 7
Fatal error loading the DB: Invalid argument. Exiting.
The redis gem version in the gemfile was 3.2.2, but I changed it to 3.0.7 to see if that would make it work. It didn't.
How do I fix this? I don't have anything important in there so I'm fine with resetting it to another version or uninstall and reinstall redis.
I SOLVED the problem by deleting the /home/marco/dump.rdb file from redis folder.
Thanks Itamar. I ended up uninstalling and reinstalling via Homebrew. That was easiest solution for me since I didn't have any important info in the db.
brew uninstall redis
brew install redis
3.0.x is incompatible with 3.2.x so upgrading to 3.2.4 fixed it for me.
The same issue happened to me on 6.2.4 & I solved using this process
Search the Dump.rdb file
sudo find / -name *.rdb
For Ubuntu20 You'll find it under /var/lib/redis/dump.rdb
Delete the file dump.rdb
sudo rm /var/lib/redis/dump.rdb
Restart Redis & Check the Status
sudo systemctl restart redis-server
systemctl status redis-server.service
I had this in docker upon changing redis versions. Had to completely stop the container and remove volumes and restart it.
docker-compose.yml
services:
redis:
image: redis:6.2.6-alpine
docker-compose down -v redis
docker-compose up redis

Nginx Install doesn't create /etc/rc.d/init.d/nginx

I'm installing Nginx using Passenger on an ubuntu server. I install Nginx using rvmsudo passenger-install-nginx-module but when I try to create a Nginx script using nano /etc/rc.d/init.d/nginx the directory rc.d does not exist. Any idea why?
I have the directories rc0.d through rc6.d but none of them have the init.d file in them. I'm following the Digital Ocean Tutorial
This is explained in detail in the Passenger documentation here: https://www.phusionpassenger.com/library/install/nginx/install/oss/rubygems_rvm/#note_about_nginx
The solution is to install Nginx from the Phusion Passenger APT repository, or to create an Nginx init script yourself.

Unicorn init script - not starting at boot

I'm very new to system administration and have no idea how init.d works. So maybe I'm doing something wrong here.
I'm trying to start unicorn on boot, but somehow it just fails to start everytime. I'm able to manually do a start/stop/restart by simply service app_name start. Can't seem to understand why unicorn doesn't start at boot if manual starting stopping of service works. Some user permission issue maybe ??
My unicorn init script and the unicorn config files are available here https://gist.github.com/1956543
I'm setting up a development environment on Ubuntu 11.1 running inside a VM.
UPDATE - Could it be possible because of the VM ? I'm currently sharing the entire codebase (folder) with the VM, which also happens to contain the unicorn config needed to start unicorn.
Any help would be greatly appreciated !
Thanks
To get Unicorn to run when your system boots, you need to associate the init.d script with the default set of "runlevels", which are the modes that Ubuntu enters as it boots.
There are several different runlevels, but you probably just want the default set. To install Unicorn here, run:
sudo update-rc.d <your service name> defaults
For more information, check out the update-rc.d man page.
You can configure a cron job to start the unicorn server on reboot
crontab -e
and add
#reboot /bin/bash -l -c 'service unicorn_<your service name> start >> /<path to log file>/cron.log 2>&1'

Nginx configuration

When I run
sudo mate /opt/nginx/conf/nginx.conf
my nginx.conf file opens but is blank, what did i do wrong?
trying to deploy my rails app to a ubuntu 10.04 lucid with passenger, nginx, and REE
On which machine are you running "sudo mate ..."? If you're trying to deploy, you should be on the Ubuntu server. I suspect you're using a Mac for development and the command you've issued is to edit the local nginx installation on your Mac, not on the deployment server.
You can check where you are with command:
$ uname -a
Are you sure you're not looking for:
sudo nano /etc/nginx/nginx.conf
on your server?

Resources