I'm trying to install a fresh Laravel 9 on Windows 10/WSL 2 with Docker. I followed the documentation and once I run the first command it gets stuck during building when it gets to the 4/11 stage, running endlessly until I have to cancel.
Here is what it looks like in the Terminal:
=> [ 4/11] RUN apt-get update && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervis 167.8s
=> => # Processing triggers for ca-certificates (20211016ubuntu0.22.04.1) ...
=> => # Updating certificates in /etc/ssl/certs...
=> => # 0 added, 0 removed; done.
=> => # Running hooks in /etc/ca-certificates/update.d...
=> => # done.
=> => # gpg: keybox '/root/.gnupg/pubring.kbx' created
I used Unbuntu and Docker is fresh install. I don't understand what seems to be the problem here.
Honestly I didn't try much, I have no idea what the issue is...
Related
Installed docker desktop for windows in a Hyper-V VM running Windows 10 21H2. Have cloned a repository from GitHub using the GitHub desktop. Started a PowerShell as administrator, navigated to the cloned repository location. When I run docker-compose up I get the following error:
[+] Building 3.7s (5/9)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/circleci/ruby:2.7.5-node 3.3s
=> CACHED [1/6] FROM docker.io/circleci/ruby:2.7.5-node#sha256:23d760208eed58ff57f8721d20dcd8c9bc5f9ee8a5293fa14 0.0s
=> ERROR [2/6] RUN sudo gem update --system 0.2s
[2/6] RUN sudo gem update --system:
#0 0.197 sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
failed to solve: executor failed running [/bin/sh -c sudo gem update --system]: exit code: 1
docker itself installed ok and is running. I've checked all the pre-reqs and can see no reason why this is happening. Has anyone else experienced this?
I'm building my first project in Laravel and trying to use Elixir, using homestead on Windows 8.1. I've hit the known npm/vagrant issue of too-long-path-names:
https://harvsworld.com/2015/how-to-fix-npm-install-errors-on-vagrant-on-windows-because-the-paths-are-too-long/
So I made the one line edit recommended in that article (thank god for that guy), and then ran (with and without sudo):
npm install --no-bin-links
It's moved me ahead so now I get two different kinds of errors: some 'Missing write access' errors, and a bunch of "EACCES" errors:
The error output gives me my next clue in the scavenger hunt (I think):
Please try running this command again as root/Administrator
That brings me to this post, but the difference for me is there's no change even after I use sudo (or update my user permissions like so):
sudo chown -R $USER /usr/local
sudo chown -R $(whoami) ~/.npm
Update: then after the suggestion below I get EPROTO and EXTXTBSY errors (even after following the prompted suggestion to rename the npm-debug.log back:
So I tried running gulp to see if it would give me clues, and error output had me do:
sudo npm rebuild node-sass
Running that gives me the same EPROTO and ETXTBSY errors, and the npm-debug.log file shows:
error EPROTO: protocol error, symlink '../node-sass/bin/node-sass' -> '/home/vagrant/Code/Family-laravel/node_modules/laravel-elixir/node_modules/gulp-sass/node_modules/.bin/node-sass'
Then after working on some other stuff for an hour I came back fresh and redid these steps, this time getting way fewer errors:
sudo npm -g install npm#latest (fine)
sudo npm install --no-bin-links (just the ETXTBSY error and an error in plugin 'run sequence', in task 'sass')
sudo npm rebuild node-sass --no-bin-links (no errors!)
gulp (just one error: not found: notify-send)
Getting closer!
I have been trying to figure out this problem for weeks. Here is what I did to make it work without using my host environment:
I updated node to the latest version in homestead according to nodesource.com:
sudo apt-get install --yes nodejs
curl --silent --location https://deb.nodesource.com/setup_4.x | sudo bash -
I updated npm to the latest version in homestead. This should be done after updating node:
sudo npm -g install npm#latest
I ran npm install in the laravel project directory. I also had to use force to get all of the dependencies to install:
sudo npm install --no-bin-links
sudo npm cache clear
sudo npm install --force --no-bin-links
I rebuilt node-sass according to a gulp error:
sudo npm rebuild node-sass --no-bin-links
During this whole process if something fails or after each install, i used:
sudo npm cache clear
My host is windows 10, with latest virtualbox, latest vagrant, latest homestead. I used git bash as administrator and ssh into vagrant using git bash.
So far I have only tested and confirmed that my gulp works. It is possible that other dependencies need to be rebuilt.
Hope this helps!
As many of you that are also setting up Homestead with Virtual Box...
After googling for a solution I decided to refer back to the Laravel Homestead documentation. Fortunately the solution was posted there:
https://laravel.com/docs/5.8/homestead#provider-specific-settings
You just need to add the following to your homestead Vagrantfile.
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
(...)
config.vm.provider "virtualbox" do |v|
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
end
(...)
end
IMPORTANT
Don't forget to provision as an administrator.
homestead up --provision
I had same problem. I did below. It works fine.
npm install --no-bin-links
The cause of your initial EACCES error was that you used sudo without using the -H option. NEVER use sudo npm. ALWAYS use sudo -H npm.
The instructions on the Internet everywhere (including NPM docs) are simply wrong.
I solved my issue with the solution described here: https://www.prolificinteractive.com/2015/01/21/getting-vagrant-nodejs-windows-play-well-together/
The main trick was in:
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/path/to/guest/shared/directory", "1"]
Hope it helps someone
Here is how I solved the similar problem on VirtualBox:
# My Virtualbox image name "centos"
# My shared folder name: localdev
# My mounted directory name on virtualbox: /data
VBoxManage setextradata "centos" VBoxInternal2/SharedFoldersEnableSymlinksCreate/data 1
VBoxManage setextradata "centos" VBoxInternal2/SharedFoldersEnableSymlinksCreate/localdev 1
## see above how i added image name with quotes + my folder names before 1
# I made sure I am running VirtualBox in Administrator Mode
# Boot up the VM and install this:
yum install yarn
# navigate to your code folder and run:
yarn install
I'm trying to create a small buildpack for a Heroku app that uses a MQTT broker. To establish a communication channel with the broker I use the mosquitto gem, which itself require me to install a package on the system and build it.
The gem has pretty simple instructions:
sudo apt-get update
sudo apt-get install pkg-config cmake openssl libc-ares-dev
wget http://mosquitto.org/files/source/mosquitto-1.3.1.tar.gz
tar xzf mosquitto-1.3.1.tar.gz
cd mosquitto-1.3.1
cmake .
sudo make install
I need a buildpack that would do just that on a Heroku cedar app. I gave it a shot heroku-buildpack-mosquitto, but I failed and I get an error. I'm not a shell expert and I have no clue what I'm doing.
I use the following .buildpack, together with heroku-buildpack-multi:
https://github.com/ddollar/heroku-buildpack-apt.git
https://github.com/rolandjitsu/heroku-buildpack-mosquitto.git
https://github.com/heroku/heroku-buildpack-ruby.git
And the Aptfile for heroku-buildpack-apt:
pkg-config
cmake
openssl
libc-ares-dev
I get the following error:
/tmp/buildpack_23cdb652-73cc-461b-b70f-ec3f386ebee1/bin/compile: line 44: /tmp/buildpack5JP7B/bin/detect: No such file or directory
I would appreciate any help since I am not capable of figuring this out myself :)
You are missing bin/detect script in your buildpack.
This is the script that confirms whether the code you pushed is, in our case, a Ruby project. So you probably want to try this:
#!/usr/bin/env bash
# bin/detect <build-dir>
if [ -f $1/Gemfile ]; then
echo "Ruby" && exit 0
else
echo "no" && exit 1
fi
I'm looking for a way to install rvm, install a specific ruby version (using rvm) and set this installed ruby version as default. Before I can install rvm I have to install gcc and some other very basic software packages. What I've tried so far:
1) Using net/ssh
I have to simulate a pseudo tty to be able to sudo some commands and up to now,
I could not figure out, how to tell a success full command completion from a not success full one.
after installing rvm, I've stumbled over problems using rvm ("rvm is not a function", error messages, leading to not being able to set a default ruby version).
2) Using capistrano
In the ssh output are newlines inserted so that a progress bar for example is been printed in a new line every time, some progress is made. That's something I can live with.
Same Problems with rmv, I'm able to install rvm, but I'm unable to set a default: rvm --default use 1.9.2 for example. No error message, but when I've log in later, no default is set and ruby -vshows the old system ruby.
3) Using capistrano and rvm-capistrano
Now I ran into the problem, that very task that I try to execute prior to installing rvm fails, because there seems to be some magic that fiddles with the shell default:
* executing "sudo -p 'sudo password: ' yum install --assumeyes git gcc-c++ autoconf automake make patch zlib-devel libtool bzip2-devel"
servers: ["ec2-54-247-142-214.eu-west-1.compute.amazonaws.com"]
[ec2-54-247-142-214.eu-west-1.compute.amazonaws.com] executing command
** [out :: ec2-54-247-142-214.eu-west-1.compute.amazonaws.com] bash: /home/ec2-user/.rvm/bin/rvm-shell: No such file or directory
command finished in 2094ms
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'default' -c 'sudo -p '\\''sudo password: '\\'' yum install --assumeyes git gcc-c++ autoconf automake make patch zlib-devel libtool bzip2-devel'" on ec2-54-247-142-214.eu-west-1.compute.amazonaws.com
rake aborted!
Here the commands I issue to install rvm/ruby:
run 'curl -L https://get.rvm.io | bash -s stable'
run 'rvm install ruby-1.9.2-p320'
run 'echo "[[ -s \"\$HOME/.rvm/scripts/rvm\" ]] && source \"\$HOME/.rvm/scripts/rvm\"" >> .bashrc'
run 'rvm --default use ruby-1.9.2-p320'
run 'which ruby && ruby -v'
and here the error messages that is issued as response to rvm --default use 1.9.2
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal settings to allow shell login.
Please visit https://rvm.io/workflow/screen/ for example.
4.1) Using capistrano and rvm-capistrano and hacking a little bit
Update: With the help from mpapis at the RVM chat, I was able to come up with this working solution now:
require "rvm/capistrano"
role :server, ENV[ 'base_image_setup_server' ] if ENV[ 'base_image_setup_server' ]
default_run_options[:pty] = true
default_run_options[:shell] = :bash
set :rvm_ruby_string, 'ruby-1.9.2-p320'
set :rvm_type, :user
def rvm_bin
'$HOME/.rvm/bin/rvm'
end
namespace :images do
task :install_basics do
run "#{sudo} yum install --assumeyes git gcc-c++ autoconf automake make patch zlib-devel libtool bzip2-devel"
run "#{sudo} yum update --assumeyes"
end
task :install_ruby do
rvm.install_rvm
rvm.install_ruby
run "#{rvm_bin} alias create default #{rvm_ruby_string}"
run 'echo "source ~/.rvm/environments/default" >> $HOME/.bashrc'
run 'which ruby && ruby -v'
end
...
desc 'build the base-image'
task :base_image do
install_basics
install_ruby
install_boost
install_rake_and_rack
install_sioux
test_sioux
end
The main different is, that RVM is not used as a function, but the program direct.
kind regards,
Torsten
Check RVM site for Capistrano integration https://rvm.io/integration/capistrano
There are tasks to install RVM and Ruby:
after 'deploy:setup', 'ubuntu:install'
after 'deploy:setup', 'rvm:install_rvm' # do it only with deploy setup
before 'deploy', 'rvm:install_ruby' # do it on every deploy
namespace :ubuntu do
desc "setup ubuntu system"
task :install do
run "apt-get install -y make ...", :shell => "sh"
...
end
end
And you run the standard:
cap deploy:setup
cap deploy:cold
Also you might want to have a look on my example rails app for simple and working deployment script: https://github.com/mpapis/ad and my blog post about it: http://niczsoft.com/2012/03/fast-deployment-using-capistrano-rvm-and-more/
I'm struggling here with no success in order to install capistrano on my Ubuntu dev machine.
Here is the list of commands issued:
1) sudo apt-get update
2) sudo apt-get install build-essential git-core curl
3) bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
4) echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
5) (close and reopen terminal window)
6) rvm notes
(looked for: "For Ruby (MRI & ree) you should install the following OS dependencies:"
and did:
7) sudo aptitude install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
Now we can install ruby by doing:
8) rvm install 1.9.2
Then we tell rvm to use it:
9) rvm 1.9.2
And to do it always:
10) rvm --default use 1.9.2
With ruby properly instaled we can now:
11) gem install capistrano
And then:
12) gem install railsless-deploy
Despite all those steps being successful steps, when I do: cap -T
I'm unable to see the deploy tasks listed as expected.
I only getting: cap invoke cap shell
listed.
Why?
Do I need a Capfile ? With some require settings? If so, then, does that mean that we need to issue or capistrano command line commands only after we move the project directory? Please advice, I'm absolutely newbie on Capistrano here.
Thanks a lot,
MEM
Yes you still need a Capfile.
STEP 1. Create a Capfile with the following command, running it from within the project directory:
capify .
(This will also create config/deploy.rb)
STEP 2. Edit this new Capfile as per the railsless-deploy readme, so that it has the following content:
require 'rubygems'
require 'railsless-deploy'
load 'config/deploy'
At this point you can run
cap -T
and you should see tasks such as "cap deploy" listed. However, capistrano knows nothing about your target server(s), etc, yet.
STEP 3. Edit config/deploy.rb to provide the details of your SCM, server name(s), etc.
For help on this, see the section "Configuration" in the Capistrano "From The Beginning" wiki.
You may also override the deploy task here if the default provided by railsless-deploy is unsuitable.
A minimal config/deploy.rb might look as follows:
set :user, "myuser"
set :application, "myapp"
set :repository, "https://github.com/me/myapprepo"
set :scm, :git
default_run_options[:pty] = true
role :web, "myhost.example.com"
role :app, "myhost.example.com"
Of course you must correct the above with your app, host and login details.
You can then follow the typical path of
cap deploy:setup
cap deploy:check
cap deploy
# ... etc
However, after cap deploy:setup has created the deploy directory tree (by default something like /u/apps/myapp/) on the remote server(s), you may have to alter ownership (or permissions) in order for cap deploy to run. The following will recursively change the owner and group of /u/apps/myapp/ to user "myuser".
sudo chown -R myuser. /u/apps/myapp
On our servers, I actually create this /u/apps/ directory and change its ownership on server preparation (say, with puppet), long before capistrano sees them. That way, developers can use cap deploy:setup and cap deploy, etc, without hitting these issues.
"does that mean that we need to issue or capistrano command line commands only after we move the project directory?"
I'm not sure I understand this part of your question. If you move your project directory, you'll still be able to execute capistrano commands, but you must always execute them from within the project directory.