We are two people working on a Rails app running with foreman.
The app successfully launches on one computer but not the other. The other computer also has another independent project running successfully with foreman (but not running in the same time).
On computer 1:
- foreman start
- launches redis, sidekiq, server is running
On computer 2:
- foreman start
17:20:02 web.1 | started with pid 14758
17:20:02 webpack.1 | started with pid 14759
17:20:02 redis.1 | started with pid 14760
17:20:02 sidekiq.1 | started with pid 14761
17:20:02 redis.1 | 14760:C 27 Jul 2019 17:20:02.339 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
17:20:02 redis.1 | 14760:C 27 Jul 2019 17:20:02.339 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=14760, just started
17:20:02 redis.1 | 14760:C 27 Jul 2019 17:20:02.339 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
17:20:02 redis.1 | 14760:M 27 Jul 2019 17:20:02.340 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
17:20:02 redis.1 | 14760:M 27 Jul 2019 17:20:02.340 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
17:20:02 redis.1 | 14760:M 27 Jul 2019 17:20:02.340 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
17:20:02 redis.1 | 14760:M 27 Jul 2019 17:20:02.341 * Running mode=standalone, port=6379.
17:20:02 redis.1 | 14760:M 27 Jul 2019 17:20:02.341 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
17:20:02 redis.1 | 14760:M 27 Jul 2019 17:20:02.341 # Server initialized
17:20:02 redis.1 | 14760:M 27 Jul 2019 17:20:02.341 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
17:20:02 redis.1 | 14760:M 27 Jul 2019 17:20:02.341 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
17:20:02 redis.1 | 14760:M 27 Jul 2019 17:20:02.341 * DB loaded from disk: 0.000 seconds
17:20:02 redis.1 | 14760:M 27 Jul 2019 17:20:02.341 * Ready to accept connections
17:20:02 webpack.1 | /home/DupuisRodolphe/.rvm/gems/ruby-2.6.3/gems/webpacker-3.6.0/lib/webpacker/dev_server_runner.rb:55:in `exec': No such file or directory - /home/DupuisRodolphe/JavaScript/rails/gestion-locative-saas/node_modules/.bin/webpack-dev-server (Errno::ENOENT)
17:20:02 webpack.1 | from /home/DupuisRodolphe/.rvm/gems/ruby-2.6.3/gems/webpacker-3.6.0/lib/webpacker/dev_server_runner.rb:55:in `block in execute_cmd'
17:20:02 webpack.1 | from /home/DupuisRodolphe/.rvm/gems/ruby-2.6.3/gems/webpacker-3.6.0/lib/webpacker/dev_server_runner.rb:54:in `chdir'
17:20:02 webpack.1 | from /home/DupuisRodolphe/.rvm/gems/ruby-2.6.3/gems/webpacker-3.6.0/lib/webpacker/dev_server_runner.rb:54:in `execute_cmd'
17:20:02 webpack.1 | from /home/DupuisRodolphe/.rvm/gems/ruby-2.6.3/gems/webpacker-3.6.0/lib/webpacker/dev_server_runner.rb:12:in `run'
17:20:02 webpack.1 | from /home/DupuisRodolphe/.rvm/gems/ruby-2.6.3/gems/webpacker-3.6.0/lib/webpacker/runner.rb:6:in `run'
17:20:02 webpack.1 | from ./bin/webpack-dev-server:15:in `<main>'
17:20:03 webpack.1 | exited with code 1
17:20:03 system | sending SIGTERM to all processes
17:20:03 redis.1 | 14760:signal-handler (1564240803) Received SIGTERM scheduling shutdown...
17:20:03 redis.1 | 14760:M 27 Jul 2019 17:20:03.443 # User requested shutdown...
17:20:03 redis.1 | 14760:M 27 Jul 2019 17:20:03.443 * Saving the final RDB snapshot before exiting.
17:20:03 redis.1 | 14760:M 27 Jul 2019 17:20:03.455 * DB saved on disk
17:20:03 redis.1 | 14760:M 27 Jul 2019 17:20:03.455 # Redis is now ready to exit, bye bye...
17:20:03 web.1 | terminated by SIGTERM
17:20:03 redis.1 | exited with code 0
17:20:03 sidekiq.1 | terminated by SIGTERM
Computer 2 tried to connect redis in the background with redis-server and running foreman start -m all=1,redis=0 (otherwise: bind: Address already in use) but it not successful.
Procfile.dev :
web: rails server
webpack: ./bin/webpack-dev-server --watch --colors --progress
redis: redis-server
sidekiq: bundle exec sidekiq -q *something*
We have no clue on what to do now.
Related
why docker redis container auto restart and how to avoid it !
docker version: Docker version 19.03.15, build 99e3ed8919
redis version: 6.0.10
the message redis log
{"log":"242:C 28 Jul 2021 21:31:53.745 * Parent agreed to stop sending diffs. Finalizing AOF...\r\n","stream":"stdout","time":"2021-07-28T21:31:53.74533764Z"}
{"log":"242:C 28 Jul 2021 21:31:53.745 * Concatenating 0.42 MB of AOF diff received from parent.\r\n","stream":"stdout","time":"2021-07-28T21:31:53.745340654Z"}
{"log":"242:C 28 Jul 2021 21:31:53.747 * SYNC append only file rewrite performed\r\n","stream":"stdout","time":"2021-07-28T21:31:53.748060366Z"}
{"log":"242:C 28 Jul 2021 21:31:53.771 * AOF rewrite: 4082 MB of memory used by copy-on-write\r\n","stream":"stdout","time":"2021-07-28T21:31:53.771090503Z"}
{"log":"1:M 28 Jul 2021 21:31:53.864 * Background AOF rewrite terminated with success\r\n","stream":"stdout","time":"2021-07-28T21:31:53.86509657Z"}
{"log":"1:M 28 Jul 2021 21:31:53.865 * Residual parent diff successfully flushed to the rewritten AOF (0.01 MB)\r\n","stream":"stdout","time":"2021-07-28T21:31:53.865110611Z"}
{"log":"1:M 28 Jul 2021 21:31:53.865 * Background AOF rewrite finished successfully\r\n","stream":"stdout","time":"2021-07-28T21:31:53.865186183Z"}
{"log":"1:M 29 Jul 2021 06:26:03.289 * Starting automatic rewriting of AOF on 100% growth\r\n","stream":"stdout","time":"2021-07-29T06:26:03.289352072Z"}
{"log":"1:M 29 Jul 2021 06:26:03.305 * Background append only file rewriting started by pid 243\r\n","stream":"stdout","time":"2021-07-29T06:26:03.305924003Z"}
{"log":"1:C 29 Jul 2021 06:26:45.473 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo\r\n","stream":"stdout","time":"2021-07-29T06:26:45.473187567Z"}
{"log":"1:C 29 Jul 2021 06:26:45.473 # Redis version=6.0.10, bits=64, commit=00000000, modified=0, pid=1, just started\r\n","stream":"stdout","time":"2021-07-29T06:26:45.473464239Z"}
{"log":"1:C 29 Jul 2021 06:26:45.473 # Configuration loaded\r\n","stream":"stdout","time":"2021-07-29T06:26:45.473469256Z"}
{"log":" _._ \r\n","stream":"stdout","time":"2021-07-29T06:26:45.473892404Z"}
{"log":" _.-``__ ''-._ \r\n","stream":"stdout","time":"2021-07-29T06:26:45.473900258Z"}
{"log":" _.-`` `. `_. ''-._ Redis 6.0.10 (00000000/0) 64 bit\r\n","stream":"stdout","time":"2021-07-29T06:26:45.473903008Z"}
{"log":" .-`` .-```. ```\\/ _.,_ ''-._ \r\n","stream":"stdout","time":"2021-07-29T06:26:45.473905368Z"}
{"log":" ( ' , .-` | `, ) Running in standalone mode\r\n","stream":"stdout","time":"2021-07-29T06:26:45.473907848Z"}
{"log":" |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379\r\n","stream":"stdout","time":"2021-07-29T06:26:45.473910903Z"}
{"log":" | `-._ `._ / _.-' | PID: 1\r\n","stream":"stdout","time":"2021-07-29T06:26:45.473913623Z"}
{"log":" `-._ `-._ `-./ _.-' _.-' \r\n","stream":"stdout","time":"2021-07-29T06:26:45.473916704Z"}
{"log":" |`-._`-._ `-.__.-' _.-'_.-'| \r\n","stream":"stdout","time":"2021-07-29T06:26:45.473919668Z"}
{"log":" | `-._`-._ _.-'_.-' | http://redis.io \r\n","stream":"stdout","time":"2021-07-29T06:26:45.473923023Z"}
{"log":" `-._ `-._`-.__.-'_.-' _.-' \r\n","stream":"stdout","time":"2021-07-29T06:26:45.473926135Z"}
{"log":" |`-._`-._ `-.__.-' _.-'_.-'| \r\n","stream":"stdout","time":"2021-07-29T06:26:45.473929275Z"}
{"log":" | `-._`-._ _.-'_.-' | \r\n","stream":"stdout","time":"2021-07-29T06:26:45.473932644Z"}
{"log":" `-._ `-._`-.__.-'_.-' _.-' \r\n","stream":"stdout","time":"2021-07-29T06:26:45.473935824Z"}
{"log":" `-._ `-.__.-' _.-' \r\n","stream":"stdout","time":"2021-07-29T06:26:45.473938926Z"}
{"log":" `-._ _.-' \r\n","stream":"stdout","time":"2021-07-29T06:26:45.47394213Z"}
{"log":" `-.__.-' \r\n","stream":"stdout","time":"2021-07-29T06:26:45.473945854Z"}
{"log":"\r\n","stream":"stdout","time":"2021-07-29T06:26:45.473949032Z"}
the system log
[四 7月 29 14:24:29 2021] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/docker/38e8db6ef19db644454094af6d8c7dc9ddf8f31082c11b03e942a450f955c3f8,task=redis-server,pid=7014,uid=999
[四 7月 29 14:24:29 2021] Out of memory: Killed process 7014 (redis-server) total-vm:9966160kB, anon-rss:9061760kB, file-rss:0kB, shmem-rss:0kB, UID:999
[四 7月 29 14:24:29 2021] oom_reaper: reaped process 7014 (redis-server), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
[四 7月 29 14:24:31 2021] veth0a70248: renamed from eth0
[四 7月 29 14:24:31 2021] docker0: port 1(veth0e9f210) entered disabled state
mem info
total used free shared buff/cache available
Mem: 15Gi 8.8Gi 4.3Gi 2.0Mi 2.1Gi 6.1Gi
Swap: 0B 0B 0B
[webedit#lian-redis data]$
So I am creating a minimal rails app with postgresql database. I want to ensure the rails app works and make sure the docker and your working rails app are as similar as possible.
Here's my Dockerfile content:
FROM ruby:latest
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN mkdir /rails_docker
WORKDIR /rails_docker
COPY Gemfile /rails_docker/Gemfile
COPY Gemfile.lock /rails_docker/Gemfile.lock
RUN bundle install
COPY . /rails_docker
And here's my docker-compose.yml file content:
version: '3'
services:
db:
image: postgres
restart: always
environment:
POSTGRES_USER: 'samnorton'
POSTGRES_PASSWORD: 'grace0512'
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- '9999:5432'
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/rails_docker
ports:
- "3000:3000"
depends_on:
- db
volumes:
postgres-data:
driver: local
I have also set up a minimal Gemfile and Gemfile lock. When I run sudo docker-compose up I run in the ff error:
data-K54C:~/Desktop/rails_docker$ sudo docker-compose up
[sudo] password for sam:
railsdocker_db_1 is up-to-date
Starting railsdocker_web_1 ...
Starting railsdocker_web_1 ... done
Attaching to railsdocker_db_1, railsdocker_web_1
db_1 | 2019-12-12 14:20:38.333 UTC [1] LOG: starting PostgreSQL 12.0 (Debian 12.0-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1 | 2019-12-12 14:20:38.342 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2019-12-12 14:20:38.342 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2019-12-12 14:20:38.411 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2019-12-12 14:20:38.547 UTC [25] LOG: database system was shut down at 2019-12-12 14:20:06 UTC
db_1 | 2019-12-12 14:20:38.609 UTC [1] LOG: database system is ready to accept connections
db_1 | 2019-12-12 14:24:47.800 UTC [1] LOG: received smart shutdown request
db_1 | 2019-12-12 14:24:47.841 UTC [1] LOG: background worker "logical replication launcher" (PID 31) exited with exit code 1
db_1 | 2019-12-12 14:24:47.844 UTC [26] LOG: shutting down
db_1 | 2019-12-12 14:24:48.094 UTC [1] LOG: database system is shut down
db_1 | 2019-12-12 15:54:38.528 UTC [1] LOG: starting PostgreSQL 12.0 (Debian 12.0-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1 | 2019-12-12 15:54:38.543 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2019-12-12 15:54:38.543 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2019-12-12 15:54:38.627 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2019-12-12 15:54:38.806 UTC [23] LOG: database system was shut down at 2019-12-12 14:24:48 UTC
db_1 | 2019-12-12 15:54:39.053 UTC [1] LOG: database system is ready to accept connections
db_1 | 2019-12-12 16:40:42.473 UTC [1] LOG: received smart shutdown request
db_1 | 2019-12-12 16:40:42.590 UTC [1] LOG: background worker "logical replication launcher" (PID 29) exited with exit code 1
db_1 | 2019-12-12 16:40:42.590 UTC [24] LOG: shutting down
db_1 | 2019-12-12 16:40:43.398 UTC [1] LOG: database system is shut down
db_1 | 2019-12-13 00:02:44.643 UTC [1] LOG: starting PostgreSQL 12.0 (Debian 12.0-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1 | 2019-12-13 00:02:44.665 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2019-12-13 00:02:44.665 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2019-12-13 00:02:44.751 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2019-12-13 00:02:44.947 UTC [23] LOG: database system was shut down at 2019-12-12 16:40:43 UTC
db_1 | 2019-12-13 00:02:45.179 UTC [1] LOG: database system is ready to accept connections
db_1 | 2019-12-13 00:32:00.742 UTC [1] LOG: received smart shutdown request
db_1 | 2019-12-13 00:32:01.089 UTC [1] LOG: background worker "logical replication launcher" (PID 29) exited with exit code 1
db_1 | 2019-12-13 00:32:01.089 UTC [24] LOG: shutting down
db_1 | 2019-12-13 00:32:02.353 UTC [1] LOG: database system is shut down
db_1 | 2019-12-13 01:01:34.874 UTC [1] LOG: starting PostgreSQL 12.0 (Debian 12.0-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1 | 2019-12-13 01:01:34.896 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2019-12-13 01:01:34.896 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2019-12-13 01:01:35.035 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2019-12-13 01:01:35.479 UTC [23] LOG: database system was shut down at 2019-12-13 00:32:01 UTC
db_1 | 2019-12-13 01:01:35.873 UTC [1] LOG: database system is ready to accept connections
web_1 | Usage:
web_1 | rails new APP_PATH [options]
web_1 |
web_1 | Options:
web_1 | [--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated applications)
web_1 | -r, [--ruby=PATH] # Path to the Ruby binary of your choice
web_1 | # Default: /usr/local/bin/ruby
web_1 | -m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
web_1 | -d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
web_1 | # Default: sqlite3
web_1 | [--skip-yarn], [--no-skip-yarn] # Don't use Yarn for managing JavaScript dependencies
web_1 | [--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
web_1 | -G, [--skip-git], [--no-skip-git] # Skip .gitignore file
web_1 | [--skip-keeps], [--no-skip-keeps] # Skip source control .keep files
web_1 | -M, [--skip-action-mailer], [--no-skip-action-mailer] # Skip Action Mailer files
web_1 | -O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record files
web_1 | [--skip-active-storage], [--no-skip-active-storage] # Skip Active Storage files
web_1 | -P, [--skip-puma], [--no-skip-puma] # Skip Puma related files
web_1 | -C, [--skip-action-cable], [--no-skip-action-cable] # Skip Action Cable files
web_1 | -S, [--skip-sprockets], [--no-skip-sprockets] # Skip Sprockets files
web_1 | [--skip-spring], [--no-skip-spring] # Don't install Spring application preloader
web_1 | [--skip-listen], [--no-skip-listen] # Don't generate configuration that depends on the listen gem
web_1 | [--skip-coffee], [--no-skip-coffee] # Don't use CoffeeScript
web_1 | -J, [--skip-javascript], [--no-skip-javascript] # Skip JavaScript files
web_1 | [--skip-turbolinks], [--no-skip-turbolinks] # Skip turbolinks gem
web_1 | -T, [--skip-test], [--no-skip-test] # Skip test files
web_1 | [--skip-system-test], [--no-skip-system-test] # Skip system test files
web_1 | [--skip-bootsnap], [--no-skip-bootsnap] # Skip bootsnap gem
web_1 | [--dev], [--no-dev] # Setup the application with Gemfile pointing to your Rails checkout
web_1 | [--edge], [--no-edge] # Setup the application with Gemfile pointing to Rails repository
web_1 | [--rc=RC] # Path to file containing extra configuration options for rails command
web_1 | [--no-rc], [--no-no-rc] # Skip loading of extra configuration options from .railsrc file
web_1 | [--api], [--no-api] # Preconfigure smaller stack for API only apps
web_1 | -B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install
web_1 | [--webpack=WEBPACK] # Preconfigure for app-like JavaScript with Webpack (options: react/vue/angular/elm/stimulus)
web_1 |
web_1 | Runtime options:
web_1 | -f, [--force] # Overwrite files that already exist
web_1 | -p, [--pretend], [--no-pretend] # Run but do not make any changes
web_1 | -q, [--quiet], [--no-quiet] # Suppress status output
web_1 | -s, [--skip], [--no-skip] # Skip files that already exist
web_1 |
web_1 | Rails options:
web_1 | -h, [--help], [--no-help] # Show this help message and quit
web_1 | -v, [--version], [--no-version] # Show Rails version number and quit
web_1 |
web_1 | Description:
web_1 | The 'rails new' command creates a new Rails application with a default
web_1 | directory structure and configuration at the path you specify.
web_1 |
web_1 | You can specify extra command-line arguments to be used every time
web_1 | 'rails new' runs in the .railsrc configuration file in your home directory.
web_1 |
web_1 | Note that the arguments specified in the .railsrc file don't affect the
web_1 | defaults values shown above in this help message.
web_1 |
web_1 | Example:
web_1 | rails new ~/Code/Ruby/weblog
web_1 |
web_1 | This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
railsdocker_web_1 exited with code 0
in the the curent case you are not using the right rails directory i think
I am not sure if I am doing it right, I wonder if its the WORKDIR I have setup or something is running on port 3000. Any idea what is wrong with my setup?
UPDATE:
After running sudo docker-compose build and sudo docker-compose up I got these errors:
data-K54C:~/Desktop/rails_docker$ sudo docker-compose up
railsdocker_db_1 is up-to-date
Recreating railsdocker_web_1 ...
Recreating railsdocker_web_1 ... error
ERROR: for railsdocker_web_1 no such image: sha256:6d066f5f04e34f6f442d4a68fb4124e1093bb6a976593087d5ebc92478abfaae: No such image: sha256:6d066f5f04e34f6f442d4a68fb4124e1093bb6a976593087d5ebc92478abfaae
ERROR: for web no such image: sha256:6d066f5f04e34f6f442d4a68fb4124e1093bb6a976593087d5ebc92478abfaae: No such image: sha256:6d066f5f04e34f6f442d4a68fb4124e1093bb6a976593087d5ebc92478abfaae
ERROR: Encountered errors while bringing up the project.
sam#sam-K54C:~/Desktop/rails_docker$ clear
Try to replace the command as the following:
command: bundle exec bin/rails s -p 3000 -b '0.0.0.0'
That should work.
Some time the server is working, but after a certain number of requests I get php errors for all connection with redis
Predis\Connection\ConnectionException: `SELECT` failed: NOAUTH Authentication required. [tcp://redis:6379]
#66 vendor/predis/predis/src/Connection/AbstractConnection.php(155): onConnectionError
#65 vendor/predis/predis/src/Connection/StreamConnection.php(263): connect
#64 vendor/predis/predis/src/Connection/AbstractConnection.php(180): getResource
#63 vendor/predis/predis/src/Connection/StreamConnection.php(288): write
#62 vendor/predis/predis/src/Connection/StreamConnection.php(394): writeRequest
#61 vendor/predis/predis/src/Connection/AbstractConnection.php(110): executeCommand
#60 vendor/predis/predis/src/Client.php(331): executeCommand
#59 vendor/predis/predis/src/Client.php(314): __call
redis run on my server in docker container
Docker
a45f25ed7ebb laradock_redis "docker-entrypoint.s…" 2 days ago Up 30 minutes 0.0.0.0:6379->6379/tcp laradock_redis_1
docker-compose logs redis
redis_1 | 1:C 08 Jan 08:56:23.036 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1 | 1:C 08 Jan 08:56:23.036 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1 | 1:C 08 Jan 08:56:23.036 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 | 1:M 08 Jan 08:56:23.038 * Running mode=standalone, port=6379.
redis_1 | 1:M 08 Jan 08:56:23.038 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1 | 1:M 08 Jan 08:56:23.038 # Server initialized
redis_1 | 1:M 08 Jan 08:56:23.038 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | 1:M 08 Jan 08:56:23.038 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
docker-compose.yml
version: '2'
services:
redis:
build: ./redis
volumes:
- ${DATA_SAVE_PATH}/redis:/data
ports:
- "${REDIS_PORT}:6379"
networks:
- backend
Dockerfile for redis
FROM redis:latest
LABEL maintainer="Mahmoud Zalt <mahmoud#zalt.me>"
RUN echo 'sysctl -w net.core.somaxconn=65535' >> /etc/rc.local
RUN echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
VOLUME /data
EXPOSE 6379
CMD ["redis-server"]
Tell me how to configure redis to work stably.
Thanks
I have setup of my application on DigitaOcean using dockers. It was working fine but few days back it stopped working. Whenever I want to build application and deploy it doesn't shows any progress.
By using following commands
docker-compose build && docker-compose stop && docker-compose up -d
systems stucks on the following output
db uses an image, skipping
elasticsearch uses an image, skipping
redis uses an image, skipping
Building app
It doesn't shows any furthur progress.
Following are the logs of docker-compose
db_1 | LOG: received smart shutdown request
db_1 | LOG: autovacuum launcher shutting down
db_1 | LOG: shutting down
db_1 | LOG: database system is shut down
db_1 | LOG: database system was shut down at 2018-01-10
02:25:36 UTC
db_1 | LOG: MultiXact member wraparound protections are now enabled
db_1 | LOG: database system is ready to accept connections
db_1 | LOG: autovacuum launcher started
redis_1 | 11264:C 26 Mar 15:20:17.028 # Failed opening the RDB
file root (in server root dir /run) for saving: Permission denied
redis_1 | 1:M 26 Mar 15:20:17.127 # Background saving error
redis_1 | 1:M 26 Mar 15:20:23.038 * 1 changes in 3600 seconds.
Saving...
redis_1 | 1:M 26 Mar 15:20:23.038 * Background saving started by pid 11265
elasticsearch | [2018-03-06T01:18:25,729][WARN ][o.e.b.BootstrapChecks ] [_IRIbyW] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
elasticsearch | [2018-03-06T01:18:28,794][INFO ][o.e.c.s.ClusterService ] [_IRIbyW] new_master {_IRIbyW}{_IRIbyWCSoaUaKOLN93Fzg}{TFK38PIgRT6Kl62mTGBORg}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
elasticsearch | [2018-03-06T01:18:28,835][INFO ][o.e.h.n.Netty4HttpServerTransport] [_IRIbyW] publish_address {172.17.0.4:9200}, bound_addresses {0.0.0.0:9200}
elasticsearch | [2018-03-06T01:18:28,838][INFO ][o.e.n.Node ] [_IRIbyW] started
elasticsearch | [2018-03-06T01:18:29,104][INFO ][o.e.g.GatewayService ] [_IRIbyW] recovered [4] indices into cluster_state
elasticsearch | [2018-03-06T01:18:29,799][INFO ][o.e.c.r.a.AllocationService] [_IRIbyW] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[product_records][2]] ...]).
elasticsearch | [2018-03-07T16:11:18,449][INFO ][o.e.n.Node ] [_IRIbyW] stopping ...
elasticsearch | [2018-03-07T16:11:18,575][INFO ][o.e.n.Node ] [_IRIbyW] stopped
elasticsearch | [2018-03-07T16:11:18,575][INFO ][o.e.n.Node ] [_IRIbyW] closing ...
elasticsearch | [2018-03-07T16:11:18,601][INFO ][o.e.n.Node ] [_IRIbyW] closed
elasticsearch | [2018-03-07T16:11:37,993][INFO ][o.e.n.Node ] [] initializing ...
WARNING: Connection pool is full, discarding connection: 'Ipaddress'
I am using postgres , redis, elasticsearch and sidekiq images in my rails application
But i have no clue where the things are going wrong.
Using Foreman GEM on my local development OSX I have problems making it launch all my services correctly. I have had issues with it so I manually copy and paste the lines from the Procfile on every reboot. Very frustrating
This is my
Procfile.rb:
redis: redis-server
resque: bundle exec rake resque:start &&> log/resque_worker_queue.log
privpub: bundle exec rackup private_pub.ru -s thin -E production & &> log/private_pub.log
sunspot: bundle exec rake sunspot:solr:run
I always have to manually start all of them by copy paste the commands in terminal foreman start does not work, what am i missing?
This is foreman output:
16:13:24 redis.1 | started with pid 11281
16:13:24 resque.1 | started with pid 11282
16:13:24 privpub.1 | started with pid 11283
16:13:24 sunspot.1 | started with pid 11284
16:13:24 redis.1 | [11281] 04 Jun 16:13:24 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'
16:13:24 redis.1 | [11281] 04 Jun 16:13:24 * Server started, Redis version 2.4.13
16:13:24 redis.1 | [11281] 04 Jun 16:13:24 * DB loaded from disk: 0 seconds
16:13:24 redis.1 | [11281] 04 Jun 16:13:24 * The server is now ready to accept connections on port 6379
16:13:25 redis.1 | [11281] 04 Jun 16:13:25 - DB 0: 21 keys (0 volatile) in 48 slots HT.
16:13:25 redis.1 | [11281] 04 Jun 16:13:25 - 0 clients connected (0 slaves), 955424 bytes in use
16:13:26 privpub.1 | /Users/jordan.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:43:in `require': cannot load such file -- /Users/jordan/rails/books/log/private_pub.log (LoadError)
16:13:26 privpub.1 | from /Users/jordan/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:43:in `parse_file'
16:13:26 privpub.1 | from /Users/jordan/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
16:13:26 privpub.1 | from /Users/jordan/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
16:13:26 privpub.1 | from /Users/jordan/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
16:13:26 privpub.1 | from /Users/jordan/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:137:in `start'
16:13:26 privpub.1 | from /Users/jordan/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/bin/rackup:4:in `<top (required)>'
16:13:26 privpub.1 | from /Users/jordan/.rvm/gems/ruby-1.9.3-p194/bin/rackup:19:in `load'
16:13:26 privpub.1 | from /Users/jordan/.rvm/gems/ruby-1.9.3-p194/bin/rackup:19:in `<main>'
16:13:26 privpub.1 | process terminated
16:13:26 system | sending SIGTERM to all processes
16:13:26 system | sending SIGTERM to pid 11281
16:13:26 redis.1 | [11281] 04 Jun 16:13:26 # Received SIGTERM, scheduling shutdown...
16:13:26 redis.1 | [11281] 04 Jun 16:13:26 # User requested shutdown...
16:13:26 redis.1 | [11281] 04 Jun 16:13:26 * Saving the final RDB snapshot before exiting.
16:13:26 redis.1 | [11281] 04 Jun 16:13:26 * DB saved on disk
16:13:26 redis.1 | [11281] 04 Jun 16:13:26 # Redis is now ready to exit, bye bye...
16:13:26 system | sending SIGTERM to pid 11282
16:13:26 resque.1 | rake aborted!
16:13:26 resque.1 | SIGTERM
16:13:26 resque.1 |
16:13:26 resque.1 | (See full trace by running task with --trace)
16:13:26 system | sending SIGTERM to pid 11284
16:13:26 sunspot.1 | rake aborted!
16:13:26 sunspot.1 | SIGTERM
16:13:26 sunspot.1 |
16:13:26 sunspot.1 | (See full trace by running task with --trace)
16:13:26 sunspot.1 | process terminated
16:13:26 resque.1 | process terminated
16:13:26 redis.1 | process terminated
Try removing your output redirects by changing the 2nd and 3rd lines to:
resque: bundle exec rake resque:start
privpub: bundle exec rackup private_pub.ru -s thin -E production
Foreman might have issues w/ redirects in commands: https://github.com/ddollar/foreman/issues/search?q=redirect