Sunday, March 10, 2019

git error

error: src refspec master does not match any.

This can happen when the files are not committed.

Set the PATH for Ruby in Ubuntu

 cat ~/.bash_profile
export PATH=$PATH:/usr/local/bin

Upgrading Git to Latest Version on Ubuntu

sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git -y
git --version

Tuesday, February 26, 2019

exec: \"/bin/bash\": stat /bin/bash: no such file or directory

docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown.
ERRO[0000] error waiting for container: context canceled 

Resolution:

bash must be installed on the Docker image.

Friday, February 22, 2019

ArgumentError: Missing `secret_key_base` for 'production' environment

set this string with `rails credentials:edit`command, 

Install Ruby 2.6.1 using RVM

rvm get stable
rvm pkg install openssl
rvm install ruby-2.6.1 --with-openssl-dir=$HOME/.rvm/usr

cannot create directory ‘/var/www’

Resolution: create the directory on the server and provide permission to deploy user:
sudo chown deploy:deploy /var/www/

Don't know how to build task 'deploy:updated'

Resolution

In Capfile the require statement sequence matters:

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/rails'

Saturday, February 16, 2019

sqlite3 error in rails 5.2

Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? can't activate sqlite3 (~> 1.3.6), already activated sqlite3-1.4.0. Make sure all dependencies are added to Gemfile. (LoadError)

uninstall sqlite3 and

Add:

gem 'sqlite3', '~> 1.3.6'

Monday, January 28, 2019

Forking Example

puts "Parent process id : #{Process.pid}"

TEST = 10
fork do
  puts TEST
  puts "---- Child process id : #{Process.pid}"  
  puts "---- Parent process id : #{Process.ppid}"
end

fork do
  puts TEST
  puts "**** Child process id : #{Process.pid}"  
  puts "**** Parent process id : #{Process.ppid}"
end


puts TEST
puts "Waiting for child to exit"
Process.wait
puts "Done"


at_exit do
  puts "About to exit the program"  
end