Comments (15)
I'm still not sure what's going on here. Can you let me know if you're on Linux or Mac, and what user you're running commands as? When running as that user, can you echo $UID
and get a returned value?
from vessel.
Sure:
I'm using the latest Fedora Linux as the standard user.
My $UID
is 1000
.
I've tried to change the Dockerfile
a but don't have any idea either...
from vessel.
Hi!
This project was tagged 2.0.0 today if you want to try again. You'll need to rebuild the images.
Does building the node image specifically cause any issues over generically calling ./vessel build
?
In any case, let me know if you get the same error again. Perhaps there's an issue with user id 1000 (which means others would be hitting this as well).
Let me know!
from vessel.
I've updated to 2.0.0. I'm running this on OSX
./vessel build
Building node
Step 1/4 : FROM node:latest
---> 0d9089853221
Step 2/4 : ARG uid=999
---> Using cache
---> e31021c92c23
Step 3/4 : RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && apt-get update && apt-get install -y git yarn && apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
---> Using cache
---> e616ab2088ff
Step 4/4 : RUN usermod -u $uid node
---> Running in 680eec56bbd1
usermod: user 'node' does not exist
ERROR: Service 'node' failed to build: The command '/bin/sh -c usermod -u $uid node' returned a non-zero code: 6
from vessel.
Okay, I've done the following for testing vessel 2.0:
all commands under the default user with id 1000
composer create-project laravel/laravel testing-vessel
cd testing-vessel
composer require shipping-docker/vessel
php artisan vendor:publish --provider="Vessel\VesselServiceProvider"
Everything is fine until this point.
bash vessel init
First error messages:
~/Code/testing-vessel
▶ bash vessel init
The WWWUSER variable is not set. Defaulting to a blank string.
The XDEBUG_HOST variable is not set. Defaulting to a blank string.
The APP_PORT variable is not set. Defaulting to a blank string.
The MYSQL_PORT variable is not set. Defaulting to a blank string.
The Compose file './docker-compose.yml' is invalid because:
services.mysql.ports is invalid: Invalid port ":3306", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.app.ports is invalid: Invalid port ":80", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
VESSEL: Initializing Vessel...
VESSEL: Installing Predis
Using version ^1.1 for predis/predis
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing predis/predis (v1.1.1): Loading from cache
predis/predis suggests installing ext-phpiredis (Allows faster serialization and deserialization of the Redis protocol)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: shipping-docker/vessel
Package manifest generated successfully.
VESSEL: Setting .env Variables
VESSEL: Making vessel command available
VESSEL: Complete!
VESSEL: You can now use Vessel
VESSEL: Try starting it:
./vessel start
The .env.vessel
file looks so:
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:MnsQKVw2ndSad+1Dbghv5w+MVImkRlYZfpxkHIYF+UQ=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
It's evident that the APP_PORT
and MYSQL_PORT
are required.
After setting them manually to the default values in the .env.vessel
file and rerunning bash vessel init
again I've got the same error because the init script overwrites the .env.vessel
file. Maybe this is the expected behavior, but perhaps you can implement a check if the file already exists?
Okay, after knowing this, I've added the *_PORT
variables again and tried ./vessel build
:
~/Code/testing-vessel ⍉
▶ ./vessel build
The WWWUSER variable is not set. Defaulting to a blank string.
The XDEBUG_HOST variable is not set. Defaulting to a blank string.
The APP_PORT variable is not set. Defaulting to a blank string.
The MYSQL_PORT variable is not set. Defaulting to a blank string.
The Compose file './docker-compose.yml' is invalid because:
services.mysql.ports is invalid: Invalid port ":3306", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.app.ports is invalid: Invalid port ":80", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
WARNING: The WWWUSER variable is not set. Defaulting to a blank string.
WARNING: The XDEBUG_HOST variable is not set. Defaulting to a blank string.
WARNING: The APP_PORT variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_PORT variable is not set. Defaulting to a blank string.
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.mysql.ports is invalid: Invalid port ":3306", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.app.ports is invalid: Invalid port ":80", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
It seems, that the .env.vessel
file is not used either.
Therefore I copied the variables to the main .env
file and started the command again:
~/Code/testing-vessel ⍉
▶ ./vessel build
The WWWUSER variable is not set. Defaulting to a blank string.
The XDEBUG_HOST variable is not set. Defaulting to a blank string.
WARNING: The WWWUSER variable is not set. Defaulting to a blank string.
WARNING: The XDEBUG_HOST variable is not set. Defaulting to a blank string.
Building node
Step 1/6 : FROM node:latest
---> f93ba6280cbd
Step 2/6 : LABEL maintainer "Chris Fidao"
---> Using cache
---> 3975d09df1d4
Step 3/6 : WORKDIR /var/www/html
---> Using cache
---> 26bad384ffe9
Step 4/6 : ARG uid=999
---> Using cache
---> 92ba35a5bd8f
Step 5/6 : RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && apt-get update && apt-get install -y git yarn && apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
---> Using cache
---> 880a1b6765af
Step 6/6 : RUN usermod -u $uid node
---> Running in 020eca4ca4ed
usermod: invalid user ID 'node'
ERROR: Service 'node' failed to build: The command '/bin/sh -c usermod -u $uid node' returned a non-zero code: 3
I've got the same issue as in the previous vessel version.
After changing the docker/node/Dockerfile
in L18 from
RUN usermod -u $uid node
to
RUN usermod -u $UID node
The ./vessel build
works without any problems.
With this change, the ARG uid=999
is not used any longer, but the actual user's system UID.
I think this is what you wanted to reach with the ARG uid
?
The next problem occurs by running the node container:
~/Code/testing-vessel
▶ ./vessel yarn install
The WWWUSER variable is not set. Defaulting to a blank string.
The XDEBUG_HOST variable is not set. Defaulting to a blank string.
WARNING: The WWWUSER variable is not set. Defaulting to a blank string.
WARNING: The XDEBUG_HOST variable is not set. Defaulting to a blank string.
yarn install v0.24.6
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
error Could not write file "/var/www/html/yarn-error.log": "EACCES: permission denied, open '/var/www/html/yarn-error.log'"
error An unexpected error occurred: "EACCES: permission denied, mkdir '/var/www/html/node_modules'".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
So there is a permission denied error and the node_modules
folder isn't created.
Now I've tried to change the Dockerfile
again:
RUN usermod -u 999 node
This works for building (instead of the ARG uid=999
), but creates the same permission denied error.
Finally I found the solution:
Changed the docker/node/Dockerfile
again:
RUN usermod -u 1000 node
Now the ID is the same as my actual user ones.
./vessel yarn install
works fine and the node_modules
folder has the correct permissions on my project folder!
Summary
I think the main problem is the uid
in the Dockerfile
, but there is also a problem with the .env.vessel
file.
Best regards ;-)
from vessel.
@parsingeye can you please check if my Solution step works for you?
Just update L18 in docker/node/Dockerfile
the $uid
with your actual UID-value.
You should get this by running echo $UID
in the terminal.
from vessel.
Thanks for the extra explanation @Lednerb!
Just a note: .env.vessel
is just a copy of .env
made as backup, as .env
is changed by the ./vessel bash init
command. So, the .env
file is still the one to pay attention to. However, I don't think that's our issue here.
The core issue we need to solve are why all the environmental variables are not set. Specifically, the following (and perhaps some more, but fixing the following will likely fix everything):
The WWWUSER variable is not set. Defaulting to a blank string.
The XDEBUG_HOST variable is not set. Defaulting to a blank string.
The APP_PORT variable is not set. Defaulting to a blank string.
The MYSQL_PORT variable is not set. Defaulting to a blank string.
The Compose file './docker-compose.yml' is invalid because:
services.mysql.ports is invalid: Invalid port ":3306", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.app.ports is invalid: Invalid port ":80", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
Fixing/getting correct values for these environmental variables will help resolve the issue in the Node container.
So, for some reason, running bash vessel init
is not running the bash
shell, or is running a version that doesn't like the syntax that Vessel sets for environment variables. There's something in your OS that's messing that up.
The beginning of the vessel
file has a bunch of variables it sets up, but they seem to not be getting values for you: https://github.com/shipping-docker/vessel/blob/master/docker-files/vessel#L3-L46
Figuring that out will be important. Since I can't replicate it (I don't have Fedora to test out on), I'll need your help there.
The other possibility is that you're .env
file has empty or invalid values for those environment variables. (Also be sure your .env
file exists).
from vessel.
I'm using the Z-Shell with the OhMyZ.sh extension.
I will do a quick check, if everything works fine with the standard bash shell...
(Until now this was never a problem before...)
from vessel.
Okay @fideloper
Using the original bash does not work:
[lednerb@linux bash-testing-vessel]$ php artisan vendor:publish --provider="Vessel\VesselServiceProvider"
Copied Directory [/vendor/shipping-docker/vessel/docker-files/docker] To [/docker]
Copied File [/vendor/shipping-docker/vessel/docker-files/docker-compose.yml] To [/docker-compose.yml]
Copied File [/vendor/shipping-docker/vessel/docker-files/vessel] To [/vessel]
Publishing complete.
[lednerb@linux bash-testing-vessel]$ bash vessel init
The WWWUSER variable is not set. Defaulting to a blank string.
The XDEBUG_HOST variable is not set. Defaulting to a blank string.
The APP_PORT variable is not set. Defaulting to a blank string.
The MYSQL_PORT variable is not set. Defaulting to a blank string.
The Compose file './docker-compose.yml' is invalid because:
services.mysql.ports is invalid: Invalid port ":3306", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.app.ports is invalid: Invalid port ":80", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
VESSEL: Initializing Vessel...
VESSEL: Installing Predis
Using version ^1.1 for predis/predis
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing predis/predis (v1.1.1): Loading from cache
predis/predis suggests installing ext-phpiredis (Allows faster serialization and deserialization of the Redis protocol)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: shipping-docker/vessel
Package manifest generated successfully.
VESSEL: Setting .env Variables
VESSEL: Making vessel command available
VESSEL: Complete!
VESSEL: You can now use Vessel
VESSEL: Try starting it:
./vessel start
Which Linux distributions have you tested?
Ubuntu? Suse?
Here are my software versions:
- OS: Fedora Linux 26
- Bash:
GNU bash, Version 4.4.12(1)-release (x86_64-redhat-linux-gnu)
- Zsh:
zsh 5.3.1 (x86_64-redhat-linux-gnu)
- Docker:
Docker version 17.09.0-ce, build afdb6d4
- docker-compose:
docker-compose version 1.13.0, build 1719ceb
from vessel.
Definitely seems weird. Use zsh (oh-my-zsh) on Mac without issue. Bash should work fine, but I don't know what's preventing it from catching those variables.
Can you:
- Output the complete contents of our
.env
file (minus any sensitive info, replace that with<redacted>
) - Make a new bash file and see if the environment variables work outside of Vessel (run it with
bash your-new-file.sh
):
#!/usr/bin/env bash
UNAMEOUT="$(uname -s)"
case "${UNAMEOUT}" in
Linux*) MACHINE=linux;;
Darwin*) MACHINE=mac;;
*) MACHINE="UNKNOWN"
esac
# Set environment variables for dev
if [ "$MACHINE" == "linux" ]; then
export XDEBUG_HOST=$(/sbin/ifconfig docker0 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1)
SEDCMD="sed -i"
elif [ "$MACHINE" == "mac" ]; then
export XDEBUG_HOST=$(ipconfig getifaddr en0) # Ethernet
if [ -z "$XDEBUG_HOST" ]; then
export XDEBUG_HOST=$(ipconfig getifaddr en1) # Wifi
fi
fi
export APP_PORT=${APP_PORT:-80}
export MYSQL_PORT=${MYSQL_PORT:-3306}
export WWWUSER=${WWWUSER:-$UID}
echo "Machine: $MACHINE"
echo "xDebug Host: $XDEBUG_HOST"
echo "app port: $APP_PORT"
echo "mysql port: $MYSQL_PORT"
echo "user UID: $WWWUSER"
from vessel.
That's the complete .env
file after creating a fresh laravel project and including vessel (including bash vessel init
):
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:uKcFSC7gq5rGHIaQIAY7ILIAWVmqOqYmnvpl1rLCeZY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=redis
SESSION_DRIVER=redis
QUEUE_DRIVER=sync
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
The DB_HOST=mysql
is set correctly, but the other variables are not set.
The test-script has the following output:
~/Code/testing-vessel
▶ bash ./test-env.sh
Machine: linux
xDebug Host:
app port: 80
mysql port: 3306
user UID: 1000
Seems working ...
from vessel.
Weird! The only other thing the vessel
file does is to source .env
, in order to set the variables in the .env
file as env vars the bash script can use. Perhaps that's doing something?
Here's a updated test bash file, with source .env
added (this assumes it's in the same directory as the laraval app and the .env
file exists):
#!/usr/bin/env bash
UNAMEOUT="$(uname -s)"
case "${UNAMEOUT}" in
Linux*) MACHINE=linux;;
Darwin*) MACHINE=mac;;
*) MACHINE="UNKNOWN"
esac
# Set environment variables for dev
if [ "$MACHINE" == "linux" ]; then
export XDEBUG_HOST=$(/sbin/ifconfig docker0 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1)
SEDCMD="sed -i"
elif [ "$MACHINE" == "mac" ]; then
export XDEBUG_HOST=$(ipconfig getifaddr en0) # Ethernet
if [ -z "$XDEBUG_HOST" ]; then
export XDEBUG_HOST=$(ipconfig getifaddr en1) # Wifi
fi
fi
export APP_PORT=${APP_PORT:-80}
export MYSQL_PORT=${MYSQL_PORT:-3306}
export WWWUSER=${WWWUSER:-$UID}
# NEW LINE HERE
source .env
echo "Machine: $MACHINE"
echo "xDebug Host: $XDEBUG_HOST"
echo "app port: $APP_PORT"
echo "mysql port: $MYSQL_PORT"
echo "user UID: $WWWUSER"
from vessel.
xdebug host being empty is also weird, but not the worst thing. Does the ifconfig
command exist on your machine? Is it located at /sbin/ifconfig
if so?
from vessel.
~/Code/testing-vessel
▶ bash ./test-env-source.sh
Machine: linux
xDebug Host:
app port: 80
mysql port: 3306
user UID: 1000
That works too... but the .env
file is not updated.
Regarding xdebug: ifconfig
is located in another place.
~/Code/testing-vessel
▶ which ifconfig
/usr/sbin/ifconfig
from vessel.
Hi! The .env
file would not get updated in this case. source .env
just reads it in.
Unfortunately I don't really have a way to re-create this, I'm afraid you may need to do some more experimenting in the vessel
file on your machine to see why those environment variables are getting unset.
I would probably add the following into various parts of the file to see where they get unset and see if we can find a place where they either unset (or perhaps see if they never get set in the first place)
echo "Machine: $MACHINE"
echo "xDebug Host: $XDEBUG_HOST"
echo "app port: $APP_PORT"
echo "mysql port: $MYSQL_PORT"
echo "user UID: $WWWUSER"
from vessel.
Related Issues (20)
- 403 Forbidden after installing vessel HOT 3
- US Locales are not supported HOT 1
- Change node version ? HOT 2
- Sqlite support? HOT 3
- Publish application logs to docker HOT 3
- Feature Request: Integrate Mutagen for better I/O on MacOs HOT 1
- Ability to disable installing predis HOT 1
- How to make subdomains work HOT 1
- Moving to production images HOT 2
- Slow development cycle HOT 1
- Vue Hot Reload HOT 1
- Clockwork debugger blank because of expires.conf HOT 4
- vessel art make:something always hangs for a while before returning HOT 1
- How to set MySQL root password HOT 3
- PHP 8 Support HOT 6
- failed to build HOT 2
- Laravel 7 error "Please make sure the PHP Redis extension is installed and enabled." HOT 2
- You need to install the imagick extension to use this back end HOT 1
- chown: invalid user: ‘user:user’ HOT 1
- Ambiguous ERROR: Unable to find 'docker' HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vessel.