I am running docker on my MBP (Yosemite 10.10.3) with boot2docker (v1.6.2). When I try to run docker run --rm -v "$PWD:/src" grahamc/jekyll build (without sudo) I got the following error:
twer$ $(boot2docker shellinit 2> /dev/null)
twer$ docker run --rm -v "$PWD:/src" grahamc/jekyll build
/usr/local/bundle/gems/bundler-1.9.9/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find coffee-script-source-1.9.1 in any of the sources (Bundler::GemNotFound)
from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/spec_set.rb:85:in `map!'
from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/spec_set.rb:85:in `materialize'
from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/definition.rb:132:in `specs'
from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/definition.rb:177:in `specs_for'
from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/definition.rb:166:in `requested_specs'
from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/environment.rb:18:in `requested_specs'
from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/runtime.rb:13:in `setup'
from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler.rb:122:in `setup'
from /usr/local/bundle/gems/jekyll-2.5.3/lib/jekyll/plugin_manager.rb:37:in `require_from_bundler'
from /usr/local/bundle/gems/jekyll-2.5.3/bin/jekyll:16:in `<top (required)>'
from /usr/local/bundle/bin/jekyll:23:in `load'
Please help.
It's working fine on my machine:
$ docker run --rm -v "$PWD:/src" -p 4000:4000 grahamc/jekyll serve -H 0.0.0.0
Configuration file: /src/_config.yml
Source: /src
Destination: /src/_site
Generating...
Build Warning: Layout 'nil' requested in atom.xml does not exist.
Build Warning: Layout 'none' requested in feed.xml does not exist.
done.
Auto-regeneration: enabled for '/src'
Configuration file: /src/_config.yml
Server address: http://0.0.0.0:4000/
Server running... press ctrl-c to stop.
My best guess is that you have a Gemfile in your source code.
Related
I'm trying to run a repetitive task using the Whenever gem for my rails app. It is running in a Docker container created using Docker Compose and hosted on an Ubuntu server.
I can successfully create and update the crontab file using the Whenever gem but it doesn't seem to be executing the task.
The task I want to execute repetitively in the background while the app is running is:
rake searchkick:reindex CLASS=Property
I usually execute this command successfully from the terminal after creating a web run container using 'docker-compose run web bash'. This reindexes my ElasticSearch server using the searchkick gem.
The relevant versions are below:
- ruby 2.7.2p137
- rails (6.0.3.6)
- elasticsearch (6.8.3)
- elasticsearch-api (= 6.8.3)
- elasticsearch-transport (= 6.8.3)
- searchkick (4.4.4)
- activemodel (>= 5)
- elasticsearch (>= 6)
- hashie
- whenever (1.0.0)
- chronic (>= 0.6.3)
Cron is installed using the Dockerfile:
RUN apt-get update -qq && \
apt-get install -y curl \
build-essential \
libpq-dev \
cron \
vim \
nano \
postgresql \
postgresql-contrib \
postgresql-client
The Dockerfile runs a script when the container is created:
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000
The script (entrypoint.sh) creates a crontab file.
#!/bin/bash
set -e
# For development check if the gems as installed, if not, then uninstall them.
if ! [ bundle check ]; then
bundle install
fi
# Remove a potentially pre-existing server.pid for Rails.
rm -f /myapp/tmp/pids/server.pid
# Yarn - Check Files.
yarn install --check-files
# Create empty crontab file.
crontab -l | { cat; echo ""; } | crontab -
# Update crontab file using whenever command.
bundle exec whenever --set 'environment=production' --update-crontab
# Run the command - runs any arguments passed into this entrypoint file.
exec "$#"
The 'bundle exec whenever --set 'environment=production' --update-crontab' command above updates the crontab file as per the schedule.rb file below:
set :output, "log/cron_log.log"
env :PATH, ENV['PATH']
# Reindex Property records every 3 mins.
every 3.minutes do
rake "searchkick:reindex CLASS=Property"
end
I've also tried using this:
every 3.minutes do
command "cd /myapp && rake searchkick:reindex CLASS=Property"
end
When I execute 'docker-compose run web bash' to use the rails terminal, I see this response at the end:
no crontab for root
[write] crontab file updated
To check that it was created correctly, I view the crontab file in the rails app with 'crontab -l' and it shows:
# Begin Whenever generated tasks for: /myapp/config/schedule.rb at: 2021-04-24 13:07:12 +0000
PATH=/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /bin/bash -l -c 'cd /myapp && RAILS_ENV=production bundle exec rake searchkick:reindex CLASS=Property --silent >> log/cron_log.log 2>&1'
# End Whenever generated tasks for: /myapp/config/schedule.rb at: 2021-04-24 13:07:12 +0000
Update: After using cron service status and cron service start, the logs in myApp/log/cron_log.log show the following:
bundler: failed to load command: rake (/usr/local/bin/rake)
Bundler::GemNotFound: Could not find rake-13.0.3 in any of the sources
/usr/local/lib/ruby/2.7.0/bundler/spec_set.rb:86:in `block in materialize'
/usr/local/lib/ruby/2.7.0/bundler/spec_set.rb:80:in `map!'
/usr/local/lib/ruby/2.7.0/bundler/spec_set.rb:80:in `materialize'
/usr/local/lib/ruby/2.7.0/bundler/definition.rb:170:in `specs'
/usr/local/lib/ruby/2.7.0/bundler/definition.rb:237:in `specs_for'
/usr/local/lib/ruby/2.7.0/bundler/definition.rb:226:in `requested_specs'
/usr/local/lib/ruby/2.7.0/bundler/runtime.rb:101:in `block in definition_method'
/usr/local/lib/ruby/2.7.0/bundler/runtime.rb:20:in `setup'
/usr/local/lib/ruby/2.7.0/bundler.rb:149:in `setup'
/usr/local/lib/ruby/2.7.0/bundler/setup.rb:20:in `block in <top (required)>'
/usr/local/lib/ruby/2.7.0/bundler/ui/shell.rb:136:in `with_level'
/usr/local/lib/ruby/2.7.0/bundler/ui/shell.rb:88:in `silence'
/usr/local/lib/ruby/2.7.0/bundler/setup.rb:20:in `<top (required)>'
bundler: failed to load command: rake (/usr/local/bin/rake)
Bundler::GemNotFound: Could not find rake-13.0.3 in any of the sources
/usr/local/lib/ruby/2.7.0/bundler/spec_set.rb:86:in `block in materialize'
/usr/local/lib/ruby/2.7.0/bundler/spec_set.rb:80:in `map!'
/usr/local/lib/ruby/2.7.0/bundler/spec_set.rb:80:in `materialize'
/usr/local/lib/ruby/2.7.0/bundler/definition.rb:170:in `specs'
/usr/local/lib/ruby/2.7.0/bundler/definition.rb:237:in `specs_for'
/usr/local/lib/ruby/2.7.0/bundler/definition.rb:226:in `requested_specs'
/usr/local/lib/ruby/2.7.0/bundler/runtime.rb:101:in `block in definition_method'
/usr/local/lib/ruby/2.7.0/bundler/runtime.rb:20:in `setup'
/usr/local/lib/ruby/2.7.0/bundler.rb:149:in `setup'
/usr/local/lib/ruby/2.7.0/bundler/setup.rb:20:in `block in <top (required)>'
/usr/local/lib/ruby/2.7.0/bundler/ui/shell.rb:136:in `with_level'
/usr/local/lib/ruby/2.7.0/bundler/ui/shell.rb:88:in `silence'
/usr/local/lib/ruby/2.7.0/bundler/setup.rb:20:in `<top (required)>'
So it seems to have set up the crontab file and the cronjob is trying to run but it is not finding rake-13.0.3. I'm going to check if this is an issue with the bundler gem version versus what is in the gemfile.
Appreciate any help.
you can run cron to start cron service (linux) in your entrypoint.sh
# Update crontab file using whenever command.
cron && bundle exec whenever --set 'environment=production' --update-crontab
schedule don't know the gems path so the Bundler::GemNotFound error be throw, to solve this, you can avoid missing paths by setting all ENV in schedule.rb
set :output, "log/cron_log.log"
ENV.each { |k, v| env(k, v) }
# ...
I need a help from you. my task is dockerized my current redmine.
almost 2 week I am working on this task.
I copied public folder from host redmine to docker container redmine/public
I copied all plugins and installed successfully
but problem is image,my theme background image, wiki image is not disply.
I think my docker redmine is not find path to image.
any one know how to display image?
I will explain what step i do so far.
docker network create --driver bridge redmine_network
docker volume create postgres-data
docker volume create redmine-data
docker container run -d \
--name postgres \
--network redmine_network \
-v postgres-data:/var/lib/postgresql/data \
--restart always \
-e POSTGRES_PASSWORD='password' \
-e POSTGRES_DB='redmine' \
postgres:latest
docker container run -d \
--name redmine \
--network redmine_network \
-p 80:3000 \
--restart always \
-v redmine-data:/usr/src/redmine/files \
-e REDMINE_DB_POSTGRES='postgres' \
-e REDMINE_DB_DATABASE='redmine' \
-e REDMINE_DB_PASSWORD='password' \
redmine:latest
inside the container i install some package and gem for my plugins
docker exec -it redmine bash
apt update
apt install build-essential libpq-dev pkg-config libmagickwand-dev ruby ruby-dev
bundle install --no-deployment
gem install will_paginate
gem install jenkins_api_client
gem install activesupport -v 4.2.8
gem install haml-rails -v 1.0
gem install deface -v 1.0.2
gem install brakeman -v 4.8.0
bundle updates
docker redmine log file
Resolving dependencies...
The Gemfile's dependencies are satisfied
[2020-03-17 16:31:41] INFO WEBrick 1.3.1
[2020-03-17 16:31:41] INFO ruby 2.4.4 (2018-03-28) [x86_64-linux]
[2020-03-17 16:31:41] INFO WEBrick::HTTPServer#start: pid=1 port=3000
[2020-03-17 16:32:03] ERROR Errno::ECONNRESET: Connection reset by peer # io_fillbuf - fd:16
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `eof?'
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `run'
/usr/local/lib/ruby/2.4.0/webrick/server.rb:308:in `block in start_thread'
[2020-03-17 16:32:03] ERROR Errno::ECONNRESET: Connection reset by peer # io_fillbuf - fd:14
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `eof?'
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `run'
/usr/local/lib/ruby/2.4.0/webrick/server.rb:308:in `block in start_thread'
[2020-03-17 16:32:08] ERROR Errno::ECONNRESET: Connection reset by peer # io_fillbuf - fd:19
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `eof?'
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `run'
/usr/local/lib/ruby/2.4.0/webrick/server.rb:308:in `block in start_thread'
[2020-03-17 16:32:08] ERROR Errno::ECONNRESET: Connection reset by peer # io_fillbuf - fd:13
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `eof?'
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `run'
/usr/local/lib/ruby/2.4.0/webrick/server.rb:308:in `block in start_thread'
[2020-03-17 16:32:08] ERROR Errno::ECONNRESET: Connection reset by peer # io_fillbuf - fd:18
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `eof?'
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `run'
/usr/local/lib/ruby/2.4.0/webrick/server.rb:308:in `block in start_thread'
[2020-03-17 16:32:09] ERROR Errno::ECONNRESET: Connection reset by peer # io_fillbuf - fd:16
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `eof?'
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `run'
/usr/local/lib/ruby/2.4.0/webrick/server.rb:308:in `block in start_thread'
[2020-03-17 16:32:09] ERROR Errno::ECONNRESET: Connection reset by peer # io_fillbuf - fd:14
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `eof?'
/usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:82:in `run'
/usr/local/lib/ruby/2.4.0/webrick/server.rb:308:in `block in start_thread'
anyone could explain how to clear this error.. please
I want to make docker redmine same like my host redmine.
i can explain what i did so far.
create docker containers for redmine 3.4.4 and postgresql:latest with network and volume for each container
https://medium.com/#gurayy/setting-up-redmine-with-docker-be110387ba1c
install package and gem in redmine container
copy /public folder to docker redmine:/usr/src/redmine
copy all plugins to docker redmine:/usr/src/redmine/plugins
install plugins
bundle exec rake redmine:plugins NAME=readme_at_repositories RAILS_ENV=production
docker container restart redmine
check everything work fine
make a pg_dump from my host machine
/usr/bin/pg_dump -U postgres -h localhost -W -F -T --file=/tmp/redminedata.sqlc projectportal
enter to my postgresql container and restore my database
pg_restore -c -U postgres -h postgres -d projectportal /tmp/redminedata.sqlc
restart redmine container and I check again redmine in browser
when I check my redmine .png and .jpg files not working (not showing)
all data are migrated but image are missing and my theme background image .
enter image description here
Im new to using docker and I cant seem to get the app to build and make correctly. I'm sure its some easy DB setup or PG gem config.
Here's the output after trying to
=> Booting Puma
=> Rails 4.2.10 application starting in development on http://0.0.0.0:3000
=> Run rails server -h for more startup options
=> Ctrl-C to shutdown server
Exiting
/usr/local/bundle/gems/activerecord-4.2.10/lib/active_record/connection_adapters/connection
_specification.rb:177:in `rescue in spec': Specified 'postgresql' for database adapter, but
the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the mi
nimum required by ActiveRecord). (Gem::LoadError)
from /usr/local/bundle/gems/activerecord-4.2.10/lib/active_record/connection_adapte
rs/connection_specification.
rb:174:in `spec'
from /usr/local/bundle/gems/activerecord-4.2.10/lib/active_record/connection_handli
ng.
rb:50:in `establish_connection'
from /usr/local/bundle/gems/activerecord-4.2.10/lib/active_record/railtie.rb:122:in
`block (2 levels) in <class:Railtie>'
from /usr/local/bundle/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks
.rb:38:in `instance_eval'
from /usr/local/bundle/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks
.rb:38:in `execute_hook'
from /usr/local/bundle/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks
.rb:28:in `block in on_load'
from /usr/local/bundle/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks
.rb:27:in `each'
from /usr/local/bundle/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks
.rb:27:in `on_load'
from /usr/local/bundle/gems/activerecord-4.2.10/lib/active_record/railtie.
rb:118:in
`block in <class:Railtie>'
from /usr/local/bundle/gems/railties-4.2.10/lib/rails/initializable.rb:30:in `insta
nce_exec'
from /usr/local/bundle/gems/railties-4.2.10/lib/rails/initializable.rb:30:in `run'
from /usr/local/bundle/gems/railties-4.2.10/lib/rails/initializable.rb:55:in `block
in run_initializers'
from /usr/local/lib/ruby/2.4.0/tsort.
rb:228:in `block in tsort_each'
from /usr/local/lib/ruby/2.4.0/tsort.
rb:350:in `block (2 levels) in each_strongly_connected_component'
from /usr/local/lib/ruby/2.4.0/tsort.
rb:431:in `each_strongly_connected_component_from'
from /usr/local/lib/ruby/2.4.0/tsort.
rb:349:in `block in each_strongly_connected_component'
from /usr/local/lib/ruby/2.4.0/tsort.
rb:347:in `each'
from /usr/local/lib/ruby/2.4.0/tsort.
rb:347:in `call'
from /usr/local/lib/ruby/2.4.0/tsort.
rb:347:in `each_strongly_connected_component'
from /usr/local/lib/ruby/2.4.0/tsort.
rb:226:in `tsort_each'
from /usr/local/lib/ruby/2.4.0/tsort.
rb:205:in `tsort_each'
from /usr/local/bundle/gems/railties-4.2.10/lib/rails/initializable.
rb:54:in `run_initializers'
from /usr/local/bundle/gems/railties-4.2.10/lib/rails/application.
rb:352:in `initia
lize!'
from /app/config/environment.rb:7:in `<top (required)>'
from /usr/local/bundle/gems/activesupport-4.2.10/lib/active_support/dependencies.
rb:274:in `require'
from /usr/local/bundle/gems/activesupport-4.2.10/lib/active_support/dependencies.
rb:274:in `block in require'
from /usr/local/bundle/gems/activesupport-4.2.10/lib/active_support/dependencies.
rb:240:in `load_dependency'
from /usr/local/bundle/gems/activesupport-4.2.10/lib/active_support/dependencies.rb
:274:in `require'
from /app/config.ru:3:in `block in <main>'
from /usr/local/bundle/gems/rack-1.6.12/lib/rack/builder.rb:55:in `instance_eval'
from /usr/local/bundle/gems/rack-1.6.12/lib/rack/builder.rb:55:in `initialize'
from /app/config.ru:in `new'
from /app/config.ru:in `<main>'
from /usr/local/bundle/gems/rack-1.6.12/lib/rack/builder.
rb:49:in `eval'
from /usr/local/bundle/gems/rack-1.6.12/lib/rack/builder.
rb:49:in `new_from_string'
from /usr/local/bundle/gems/rack-1.6.12/lib/rack/builder.
rb:40:in `parse_file'
from /usr/local/bundle/gems/rack-1.6.12/lib/rack/server.
rb:300:in `build_app_and_op
tions_from_config'
from /usr/local/bundle/gems/rack-1.6.12/lib/rack/server.
rb:209:in `app'
from /usr/local/bundle/gems/railties-4.2.10/lib/rails/commands/server.
rb:61:in `app
'
from /usr/local/bundle/gems/rack-1.6.12/lib/rack/server.rb:337:in `wrapped_app'
from /usr/local/bundle/gems/railties-4.2.10/lib/rails/commands/server.
rb:139:in `lo
g_to_stdout'
from /usr/local/bundle/gems/railties-4.2.10/lib/rails/commands/server.
rb:78:in `start'
from /usr/local/bundle/gems/railties-4.2.10/lib/rails/commands/commands_tasks.
rb:80
:in `block in server'
from /usr/local/bundle/gems/railties-4.2.10/lib/rails/commands/commands_tasks.
rb:75:in `tap'
from /usr/local/bundle/gems/railties-4.2.10/lib/rails/commands/commands_tasks.
rb:75
:in `server'
from /usr/local/bundle/gems/railties-4.2.10/lib/rails/commands/commands_tasks.
rb:39
:in `run_command!'
from /usr/local/bundle/gems/railties-4.2.10/lib/rails/commands.
rb:17:in `<top (requ
ired)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Dockerfile
FROM ruby:2.4.2-alpine
# Open port 3000 to access the Rails applications
# This does not belong in production as a reverse proxy should route to the application internally
EXPOSE 3000
# Starting command line arguments wrapped in `bundle exec`
ENTRYPOINT ["bundle", "exec"]
# Required pager to using irb or rails console within container
ENV PAGER="busybox less"
# Start Rails server by default bound to 0.0.0.0:3000 of the container
CMD ["rails", "server", "-p", "3000", "-b", "0.0.0.0"]
# Create main application directory
RUN mkdir /app
# Copy all contents of the current directory to the main application directory
COPY . /app
# Set the working directory to the main application directory
WORKDIR /app
# Install required system libraries, latest version of bundle and fetch all dependencies
RUN rm -f /app/tmp/pids/server.pid \
&& apk add --no-cache --verbose \
bash \
build-base \
ca-certificates \
gcc \
git \
libffi-dev \
libxml2 \
libxml2-dev \
libxslt \
libxslt-dev \
nodejs \
patch \
postgresql-dev \
ruby \
ruby-dev \
tzdata \
&& gem install bundler --pre \
&& gem install tzinfo:1.2.2 tzinfo-data \
&& gem install nokogiri --version 1.8.1 -- --use-system-libraries --with-xml2-config=/usr/local/bin/xml2-config --with-xslt-config=/usr/local/bin/xslt-config \
&& bundle install
# Once the container is built, run it using the following:
# > docker run --detach <image-name-or-hash>
# This will run the container and start Rails as follows from the application directory:
# > bundle exec rails server -p 3000 -b 0.0.0.0
# If you want to run something different like the Rails console:
# > docker run --interactive -tty <image-name-or-hash> rails console
# This will run the conatiner and start the Rails console as follows from the application directory:
# > bundle exec rails console
The error says you're missing the pg gem while you've defined the database adapter to postgresql in the config/database.yml file.
The question title says "already been developed" so I guess your Gemfile has the gem 'pg' line, and your Gemfile.lock has also a line referring to the version to install ... but can you check? :)
Then you're not sharing your Dockerfile so it's harder to guess what's your issue, but I would bet on a missing bundle install command in the Dockerfile.
Be sure to have a line like that in your Dockerfile:
RUN bundle install
In the case this doesn't help, please update your question with your Dockerfile.
I think is easy to use docker to avoid to install anything in your development environment.
Usually, I use docker to do that, I use a container exposing the ports of the service like I have the service installed in my machine. Doing that, I am avoiding to install any additional services.
If you want to use a few services in your environment, you can find containers for anything, but if you need to build your own image you need to learn more about docker.
And for example, to use postgres I use a docker-compose.yml like that:
version: '3'
services:
postgres:
image: postgres:alpine
ports:
- "5432:5432"
volumes:
- pg-data:/var/lib/postgresql/data
volumes:
pg-data: {}
I'm trying to deploy a Rails 5 app to Elastic Beanstalk but I am getting the following error in my log file that appears to indicate that my home directory is not properly set.
I tried setting the HOME environment variable by setting HOME to ~/my-app-name but I have had no luck and it doesn't appear to be using the variable anyway. I set the variable under the software section in the environment configurations.
/var/log/eb-activity.log:
+ cd /var/app/ondeck
+ su -s /bin/bash -c 'bundle exec
/opt/elasticbeanstalk/support/scripts/check-for-rake-task.rb assets:precompile' webapp
`/home/webapp` is not a directory.
Bundler will use `/tmp/bundler/home/webapp' as your home directory temporarily.
+ '[' false == true ']'
+ su -s /bin/bash -c 'bundle exec rake assets:precompile' webapp
`/home/webapp` is not a directory.
Bundler will use `/tmp/bundler/home/webapp' as your home directory temporarily.
rake aborted!
Psych::SyntaxError: (<unknown>): did not find expected alphabetic or numeric
character while scanning an alias at line 83 column 22
/var/app/ondeck/config/environments/production.rb:96:in `block in <top (required)>'
/var/app/ondeck/config/environments/production.rb:1:in `<top (required)>'
/var/app/ondeck/config/environment.rb:5:in `<top (required)>'
/opt/rubies/ruby-2.5.3/bin/bundle:23:in `load'
/opt/rubies/ruby-2.5.3/bin/bundle:23:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace) (Executor::NonZeroExitStatus)
I found a a similar issue here: issue deploying rails 5 application to AWS using Elastic Beanstalk due to rb-readline
I also asked another question yesterday about the psych error (posted link below) but I am beginning to think that this error may be caused due to the invalid reference to HOME. I'm rather lost at this point and have been working on this for several hours with absolutely no luck.
Another question I posted yesterday about the psych error:
Error Deploying on Elastic Beanstalk - Rails
Ruby: 2.7.0
Rails: 6.0.2.1
Solidus: v2.10.0
Just add the "commands" section below to your .ebextensions/packages.config
Add required commands:
# Setup linux packages
option_settings:
- option_name: BUNDLE_DISABLE_SHARED_GEMS
value: "1"
- option_name: BUNDLE_PATH
value: "vendor/bundle"
packages:
yum:
git: []
ImageMagick: []
ImageMagick-devel: []
openssl-devel: []
postgresql93-devel: []
commands:
01_node_get:
# run this command from /tmp directory
cwd: /tmp
# flag -y for no-interaction installation
command: 'curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -'
02_node_install:
# run this command from /tmp directory
cwd: /tmp
command: 'sudo yum -y install nodejs'
03_yarn_get:
# run this command from /tmp directory
cwd: /tmp
# don't run the command if yarn is already installed (file /usr/bin/yarn exists)
test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"'
command: 'sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo'
04_yarn_install:
# run this command from /tmp directory
cwd: /tmp
test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"'
command: 'sudo yum -y install yarn'
05_home_dir:
test: '[ ! -p /home/webapp ] && echo "webapp not exited"'
command: 'sudo mkdir -p /home/webapp'
06_grant_home_dir:
test: '[ ! -p /home/webapp ] && echo "webapp not exited"'
command: 'sudo chmod 777 /home/webapp'
source: https://medium.com/#tranduchanh.ms/deploy-and-manage-production-rails-5-app-with-aws-elastic-beanstalk-3efb0dfe021a
cap production unicorn:start fails with the following error, trying to start my rails app on port 80.
F, [2013-06-14T04:33:51.420113 #13986] FATAL -- : error adding listener addr=0.0.0.0:80
/home/ec2-user/apps/bdr_prod/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.2/lib/unicorn/socket_helper.rb:147:in `initialize': Permission denied - bind(2) (Errno::EACCES)
from /home/ec2-user/apps/bdr_prod/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.2/lib/unicorn/socket_helper.rb:147:in `new'
from /home/ec2-user/apps/bdr_prod/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.2/lib/unicorn/socket_helper.rb:147:in `bind_listen'
from /home/ec2-user/apps/bdr_prod/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:229:in `listen'
from /home/ec2-user/apps/bdr_prod/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:773:in `block in bind_new_listeners!'
from /home/ec2-user/apps/bdr_prod/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:773:in `each'
from /home/ec2-user/apps/bdr_prod/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:773:in `bind_new_listeners!'
from /home/ec2-user/apps/bdr_prod/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:141:in `start'
from /home/ec2-user/apps/bdr_prod/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
from /home/ec2-user/apps/bdr_prod/shared/bundle/ruby/2.0.0/bin/unicorn:23:in `load'
from /home/ec2-user/apps/bdr_prod/shared/bundle/ruby/2.0.0/bin/unicorn:23:in `<main>'
set use_sudo true returns the following error
* executing "sudo -p 'sudo password: ' rm -rf /home/ec2-user/apps/bdr_prod/releases/20130517085418"
servers: ["64.433.69.129"]
[ec2-user#64.433.69.129] executing command
*** [err :: ec2-user#64.433.69.129] sudo
*** [err :: ec2-user#64.433.69.129] :
*** [err :: ec2-user#64.433.69.129] sorry, you must have a tty to run sudo
*** [err :: ec2-user#64.433.69.129]
command finished in 1542ms
I've had issues with this before, and had to add this to my deploy.rb:
default_run_options[:pty] = true
To run ssh sudo command in remote server, disable 'require tty' in remote server
Run:
~$ sudo visudo
Edit: /etc/sudoers
# Disable "ssh hostname sudo ", because it will show the
password in clear.
# You have to run "ssh -t hostname sudo ".
# comment require tty
# Defaults requiretty
Reference: http://www.lansweeper.com/kb/39/TTY-Required-error-during-linux-scanning.html