Foreman terminates immediately
Asked Answered
S

5

12

I recently installed OSX and Ubuntu on different computers. I then attempted to install redis and foreman for both OS's. Both errors threw no flags, and seemed to execute successfully. However, whenever I go to start foreman with foreman start, I run into the below issue on both computers:

23:48:35 web.1    | started with pid 1316
23:48:35 redis.1  | started with pid 1317
23:48:35 worker.1 | started with pid 1318
23:48:35 redis.1  | [1317] 11 Jun 23:48:35.180 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
23:48:35 redis.1  | [1317] 11 Jun 23:48:35.181 * Increased maximum number of open files to 10032 (it was originally set to 256).
23:48:35 redis.1  | [1317] 11 Jun 23:48:35.181 # Creating Server TCP listening socket *:6379: bind: Address already in use
23:48:35 redis.1  | exited with code 1
23:48:35 system   | sending SIGTERM to all processes
23:48:35 worker.1 | terminated by SIGTERM
23:48:35 web.1    | terminated by SIGTERM

For some reason, it seems like a path issue to me because it seems like Redis or Foreman cannot find the files they need to use to successfully execute, but I'm not exactly sure.

On OSX I used gem install foreman and Brew install Redis .

On Ubuntu I used the following:

Redis:

$ cd ~
$ wget http://download.redis.io/redis-stable.tar.gz
$ tar xvzf redis-stable.tar.gz
$ cd redis-stable
$ make
$ make test 

Foreman:

$ gem install foreman

My PATH on OSX is as follows:

/Users/c/.rvm/gems/ruby-2.1.0/bin:/Users/c/.rvm/gems/ruby-2.1.0@global/bin:/Users/c/.rvm/rubies/ruby-2.1.0/bin:/Users/c/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

On Ubuntu, my PATH is:

/usr/local/bin:/usr/lib/postgresql:/usr/lib/postgresql/9.3:/usr/lib/ postgresql/9.3/lib:/usr/lib/postgresql/9.3/bin:/usr/share/doc:/usr/share/doc/postgresql-9.3:/usr/share/postgresql:/usr/share/postgresql/9.3:/usr/share/postgresql/9.3/man:$PATH

Redis-server does seem to execute successfully once, and then it fails with the message:

[1457] 12 Jun 00:02:48.481 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[1457] 12 Jun 00:02:48.482 * Increased maximum number of open files to 10032 (it was originally set to 256).
[1457] 12 Jun 00:02:48.483 # Creating Server TCP listening socket *:6379: bind: Address already in use

Trying $ redis-server stop returns:

[1504] 12 Jun 00:05:56.173 # Fatal error, can't open config file 'stop'

I need help figuring out how to get Foreman and Redis working together so that I can view my local files in the browser at 127.0.0.1

EDIT

Redis does start, but nothing happens when I navigate to localhost:6379. I also tried the suggestion of finding processes. It found

c                751   0.0  0.0  2432768    596 s005  R+    2:03PM   0:00.00 grep redis
c                616   0.0  0.0  2469952   1652 s004  S+    2:01PM   0:00.05 redis-server *:6379

Trying to kill the process results in

kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

Stegodon answered 12/6, 2014 at 6:8 Comment(0)
D
19

Try starting Redis server with the following command :

redis-server <path to your config file>

Also, check if there's an instance of Redis server already running by

ps aux | grep redis 

and then if process is found :

kill <process id>

Restart your redis server.

Deerdre answered 12/6, 2014 at 9:34 Comment(2)
I mentioned above that the server starts once with redis-server. I found a process, but typing kill did not work. See the updated question for more infoStegodon
After a bunch of errors, I simply reverted to "rails s" instead of "foreman start".Stegodon
R
1

This one liner will kill any existing redis-servers and then start a new redis-server. When run in Foreman it doesn't send a SIGTERM which causes Foreman to quit, sending a SIGINT lets Foreman continue.

(ps aux | grep 6379 | grep redis | awk '{ print $2 }' | xargs kill -s SIGINT) && redis-server

In Procfile.dev:

redis: (ps aux | grep 6379 | grep redis | awk '{ print $2 }' | xargs kill -s SIGINT) && redis-server

Rivera answered 21/11, 2016 at 21:9 Comment(0)
O
0
  1. List the redis server running using terminal command : ps aux | grep redis
  2. In list note down 'pid' number of the server which you want to terminate Example pid: 5379
  3. use command : kill 5379
Orthoscope answered 14/2, 2015 at 4:59 Comment(0)
B
0

Try this: $ sudo systemctl stop redis-server

now run: foreman start

Blooper answered 27/8, 2022 at 7:16 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Mandel
B
0

In my case I had duplication in my Procfile.dev:

web: env RUBY_DEBUG_OPEN=true bin/rails server
css: yarn watch:css
vite: bin/vite dev
web: bin/rails s

and I remove the last line, solved it.

Baro answered 11/4 at 6:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.