Giter Club home page Giter Club logo

Comments (9)

PiTrem avatar PiTrem commented on September 27, 2024

Hi @roma28

you may have some packages that are missing (minimal ubuntu version) or just needing an update.
RVM will try to run update but the 'production ' user from which this particular command is run is not in the sudo group. You can try to update your system first (sudo apt update && sudo apt upgrade), then rerun the script or check if any package are missing and add them to the list of dependencies in the part 1 of the script.

Was there any hint logged in /home/production/.rvm/log/1573551803_ruby-2.5.6/update_system.log ?

from chemotion_eln.

roma28 avatar roma28 commented on September 27, 2024

I've set the password for "production" user by myself and added it to sudoers, now another error appears:

Error: EACCES: permission denied, scandir '/root'
(node:12777) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
at errorHandler (/home/production/.nvm/versions/node/v10.15.3/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
at /home/production/.nvm/versions/node/v10.15.3/lib/node_modules/npm/bin/npm-cli.js:78:20
at cb (/home/production/.nvm/versions/node/v10.15.3/lib/node_modules/npm/lib/npm.js:228:22)
at /home/production/.nvm/versions/node/v10.15.3/lib/node_modules/npm/lib/npm.js:266:24
at /home/production/.nvm/versions/node/v10.15.3/lib/node_modules/npm/lib/config/core.js:83:7
at Array.forEach ()
at /home/production/.nvm/versions/node/v10.15.3/lib/node_modules/npm/lib/config/core.js:82:13
at f (/home/production/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/once/once.js:25:25)
at /home/production/.nvm/versions/node/v10.15.3/lib/node_modules/npm/lib/config/core.js:112:20
(node:12777) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:12777) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
TypeError: Cannot read property 'loaded' of undefined
at process. (/home/production/.nvm/versions/node/v10.15.3/lib/node_modules/npm/lib/utils/error-handler.js:40:18)
at process.emit (events.js:189:13)
/home/production/.nvm/versions/node/v10.15.3/lib/node_modules/npm/lib/utils/error-handler.js:205
if (npm.config.get('json')) {
^

TypeError: Cannot read property 'get' of undefined
at process.errorHandler (/home/production/.nvm/versions/node/v10.15.3/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
at process.emit (events.js:189:13)
at process._fatalException (internal/bootstrap/node.js:496:27)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run nvm use --delete-prefix v10.15.3 to unset it.
removing tmp files..
An error has occured

Looks like it has some conflict of access rights

from chemotion_eln.

PiTrem avatar PiTrem commented on September 27, 2024

I cannot solve this issue, but you may avoid it by running the script from a user in the sudo group instead of running it as root.

from chemotion_eln.

roma28 avatar roma28 commented on September 27, 2024

So, I've tried to run it from a regular user and the error is the same. As far as I can tell the problem is in that lines:

echo $PROD:$(openssl rand -base64 8) | sudo chpasswd — Here you set a random password for production user

And

sudo -H -u $PROD bash -c "curl -sSL https://get.rvm.io | bash -s stable --ruby=$RUBY_VERSION --auto-dotfiles"
sudo -H -u $PROD bash -c "source ~/.rvm/scripts/rvm && rvm use $RUBY_VERSION && gem install bundler -v $BUNDLER_VERSION " — Here RVM is installed and it runs 'apt-get --quiet --yes update' from production user and it requires the password.

I've tried to set the password manually but it doesn't work anyway.
echo $PROD:here is production password | sudo chpasswd

from chemotion_eln.

PiTrem avatar PiTrem commented on September 27, 2024

RVM will check the ruby requirements for the OS, then it will try to run apt update if some packages are missing. I think this is the issue.

From your sudo user could you run the RVM+Ruby installation:

curl -sSL https://get.rvm.io | bash -s stable --ruby=2.5.6 --auto-dotfiles

then see what ubuntu package are installed.

If it has installed anything then try running the script again. You can also modified the scrip to add the missing packages to the ubuntu requirement package list and add rvm autolibs flag. If your are sure all necessary packages for ruby are present, you can then safely skip the apt update triggered by RVM with the autolibs flag.

sudo -H -u $PROD bash -c "curl -sSL https://get.rvm.io | bash -s stable --ruby=$RUBY_VERSION --auto-dotfiles --autolibs=1"

from chemotion_eln.

roma28 avatar roma28 commented on September 27, 2024

--autolibs=1 works just fine, but then I get another access issue:

##########################################
starting capistrano deploy task
##########################################
Using /home/production/.rvm/gems/ruby-2.5.6
publickey
#<Thread:0x0000557a9764b740@/home/production/.rvm/gems/ruby-2.5.6/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /home/production/.rvm/gems/ruby-2.5.6/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:11:in block (2 levels) in execute' /home/production/.rvm/gems/ruby-2.5.6/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:15:in rescue in block (2 levels) in execute': Exception while executing as production@localhost: Authentication failed for user production@localhost (SSHKit::Runner::ExecuteError)
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as production@localhost: Authentication failed for user production@localhost

Caused by:
Net::SSH::AuthenticationFailed: Authentication failed for user production@localhost

Tasks: TOP => rvm:hook
(See full trace by running task with --trace)
removing tmp files..
An error has occured

Also there is a problem with running the script again after it has completed the postgres configuration: it gives error saying:
##########################################
PART 6
##########################################
##########################################
Prepare postgresql DB
##########################################
ERROR: role "chemotion_prod" already exists
ROLE chemotion_prod already exists and will be used!
ERROR: database "chemotion_prod" already exists
DATABASE chemotion_prod already exists! Skip this part if you want to use this DB

I think. it would be a good idea to completely reset database in that part of the script.

from chemotion_eln.

PiTrem avatar PiTrem commented on September 27, 2024

Capistrano will deploy through running commands from the deploy-er machine to the target server over ssh. In the current scenario, there is only one user and one machine, so that the production user is just ssh-ing itself.
It seems the production user cannot ssh to itself on localhost. Check why this is the case. The script should setup ssh keys before this. Maybe the authorized_keys is not where the script expect it.

About the existing DB, I would not reset it automatically but we could pause the script to ask for user input.

from chemotion_eln.

withpeople avatar withpeople commented on September 27, 2024

I would like leave some comment on this for the users who don't have knowledge on computer.

I had the similar problem as roma28 had.

The error message was

##########################################
prepare config
##########################################
user = 'production'
set :repo_url, 'https://git.scc.kit.edu/complat/chemotion_ELN_server'
set :branch, 'development'
#before 'deploy:migrate', 'deploy:backup'
server 'localhost', user: user, roles: %w{app web db}
puts %w(publickey)
set :ssh_options, { forward_agent: true, auth_methods: %w(publickey) }
#set :pty, false
set :linked_files, fetch(:linked_files, []).push(
'.ruby-version' #, '.ruby-gemset'
)
set :deploy_to, '/var/www/chemotion_ELN'
set :user, user
set :bundle_path, nil
#set :bundle_without, %w{}.join(' ')
set :bundle_flags, '--frozen --deployment ' #--quiet
set :log_file, 'log/cap-server_local.log'
##########################################
starting capistrano deploy task
##########################################
Using /home/production/.rvm/gems/ruby-2.5.6
publickey
#<Thread:0x0000558fad20cde8@/home/production/.rvm/gems/ruby-2.5.6/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /home/production/.rvm/gems/ruby-2.5.6/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:11:in block (2 levels) in execute' /home/production/.rvm/gems/ruby-2.5.6/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:15:in rescue in block (2 levels) in execute': Exception while executing as production@localhost: Connection refused - connect(2) for 127.0.0.1:22 (SSHKit::Runner::ExecuteError)
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as production@localhost: Connection refused - connect(2) for 127.0.0.1:22

Caused by:
Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:22

Tasks: TOP => rvm:hook
(See full trace by running task with --trace)

.

It had a problem on "capistrano deploy task". As PiTrem said it was caused by the problem on self connection via ssh.

After I re-install SSH, it resolved.
(I used two commands.
The first for removing ssh software.
sudo apt-get remove openssh-client openssh-server
The second one is for installing ssh software.
sudo apt-get install openssh-client openssh-server)

Then, I re-used the installation script, then, I encountered the same error message again as roma28 had.

It made a problem on part 6 process.

##########################################
PART 6
##########################################
##########################################
Prepare postgresql DB
##########################################
ERROR: role "chemotion_prod" already exists
ROLE chemotion_prod already exists and will be used!
ERROR: database "chemotion_prod" already exists
DATABASE chemotion_prod already exists! Skip this part if you want to use this DB

I removed the chemotion_prod database using the commands below.

sudo su postgres
psql
drop database chemotion_prod;

Then, I am running the installation script again. Until now, it doesn't show the same error message.
(I am running Ubuntu 18.04.3 LTS)

from chemotion_eln.

PiTrem avatar PiTrem commented on September 27, 2024

Thx for your input, @roma28 @withpeople.
Also running the script a second time helped because some tmp files were not removed.

The install and update scripts have now been reworked (bb3a891, 71929e4).
Some of the discussed issues should have been resolved (as for resetting the DB).
Note that one has to execute the script as a non-root user but with sudo.

from chemotion_eln.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.