I'm trying to deploy an app from a node monorepo on Elastic Beanstalk and seem to be stuck.
I've installed yarn in my environment and trying to run a build command (custom command using a task monorepo task runner):
Procfile
web: yarn turbo run start:server
In my server logs I'm seeing a lot of permission denied errors:
May 2 20:25:42 ip-172-31-32-247 web: yarn run v1.22.18
May 2 20:25:42 ip-172-31-32-247 web: $ /var/app/current/node_modules/.bin/turbo run start:server
May 2 20:25:42 ip-172-31-32-247 web: mkdir /var/app/current/node_modules/.cache: permission denied
May 2 20:25:42 ip-172-31-32-247 web: ERROR yarn.lock: mkdir /var/app/current/node_modules/.cache: permission denied
May 2 20:25:42 ip-172-31-32-247 web: error Command failed with exit code 1.
May 2 20:25:42 ip-172-31-32-247 web: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I think these errors are due to my enviroment trying to install the packages as a non-root user. With npm you seem to be able to add a .npmrc file with unsafe-perm=true to your root folder and get it to work. With yarn however, this does not seem to work.
I don't seem to fully understand what is happening and why I'm seeing these errors and am very thankful for any help?
Related
I've been trying to make scheduled reports with zabbix 5.4 but i keen getting the following error when i try to test:
Cannot fetch data: chrome failed to start:
Sorry, home directories outside of /home are not currently supported.
See https://forum.snapcraft.io/t/11209 for details.
.
I don't know where my errors lay. i installed google chrome and i followed all the instruction and created /var/lib/zabbix/ also chown zabbix:zabbix /var/lib/zabbix/ chmod 755 /var/lib/zabbix
but nothing .please help me i you know my error
I forgot to create a Zabbix user with a directory, that's why I got this kind of error.
addgroup --system --quiet zabbix
adduser --quiet --system --disabled-login --ingroup zabbix --home /var/lib/zabbix --no-create-home zabbix
Context
I am using Elastic Beanstalk to deploy a very simple test application. I have several packages I want to install using apt. I have included a 01_installations.sh script with the installations in the .platform/hooks/prebuild directory. When I zip my application and deploy to Elastic Beanstalk, the logs confirm that the prebuild script runs, but it does not have permissions.
2020/08/12 21:03:46.674234 [INFO] Executing instruction: RunAppDeployPreBuildHooks
2020/08/12 21:03:46.674256 [INFO] Executing platform hooks in .platform/hooks/prebuild/
2020/08/12 21:03:46.674296 [INFO] Following platform hooks will be executed in order: [01_installations.sh]
2020/08/12 21:03:46.674302 [INFO] Running platform hook: .platform/hooks/prebuild/01_installations.sh
2020/08/12 21:03:46.674482 [ERROR] An error occurred during execution of command [app-deploy] - [RunAppDeployPreBuildHooks]. Stop running the command. Error: Command .platform/hooks/prebuild/01_installations.sh failed with error fork/exec .platform/hooks/prebuild/01_installations.sh: permission denied
Question
My understanding is that permissions were denied because I did not add chmod +x to make the .sh file executable. As the AWS documentation on platform hooks states: "Use chmod +x to set execute permission on your hook files." (https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html). My question is: how do I do this?
I simply have the .sh file in a directory. I do not call it from anywhere else. Is there a simple step I'm missing? The AWS documentation makes it seem like it should be straightforward.
Previous Attempts
Things I have tried:
Adding .ebextensions
Attempt: Create a .config file in the .ebextensions directory with the below command which should execute the .sh file with chmod +x permissions.
Result: The same error occurs. The Elastic Beanstalk logs do not indicate that the .config was processed at all.
container_commands:
01_chmod1:
command: "chmod +x .platform/hooks/prebuild/01_installations.sh"
Changing the name of the .sh file
Attempt: Change the .sh file to be named "chmod +x 01_installations.sh" as suggested by an AWS user (forums link below). Remove the .ebextensions
Result: The same error occurs.
[RunAppDeployPreBuildHooks]. Stop running the command. Error: Command .platform/hooks/prebuild/chmod +x 01_installations.sh failed with error fork/exec .platform/hooks/prebuild/chmod +x 01_installations.sh: permission denied
I have reviewed the ideas here, but none of them actually include complete enough examples to follow:
https://forums.aws.amazon.com/thread.jspa?messageID=942515
https://github.com/aws/elastic-beanstalk-roadmap/issues/15
Make sure to make your file executable in git
chmod +x path/to/file
git update-index --chmod=+x path/to/file
reference from
How to add chmod permissions to file in GIT?
Normally you set the permissions on your local workstation, when before you zip your deployment package.
However, if you want to do this on EB instance, then you can't use container_commands for that. The reason is that container_commands execute after prebuild. Instead you should try using commands:
The prebuild files run after running commands found in the commands section of any configuration file and before running Buildfile commands.
This worked for me after updating the permission commit the changes.
Also the commands in .config file will not work as those commands will run pre-deployment and hence will not be able to find the path to .sh file.
Trying to use kompose to deploy a docker-compose file below into OpenShift.
At the last line I just get Unauthorized error which doesnt point where is the root cause.
Please note before this I have successfully authenticated using oc login and docker login as below
[centos#master user_interface]$ docker login -u `oc whoami` -p `oc whoami -t` docker-registry.default.svc:5000
Login Succeeded
[centos#master user_interface]$ kompose up -v --provider=openshift -f rak-docker-compose.yml --build build-config --namespace=rak
DEBU Docker Compose version: 3
DEBU Compose file dir: /home/centos/user_interface
INFO Buildconfig using http://abc/prj.git::master as source.
DEBU Compose file dir: /home/centos/user_interface
INFO Buildconfig using http://abc/prj.git::master as source.
INFO We are going to create OpenShift DeploymentConfigs, Services and PersistentVolumeClaims for your Dockerized application.
If you need different kind of resources, use the 'kompose convert' and 'oc create -f' commands instead.
FATA Error while deploying application: Unauthorized
Currently I am trying to install Pumba (https://github.com/gaia-adm/pumba) into my Minishift 1.7.0 cluster. After enabling developer user as cluster-admin and allowing volumes to use hostPath with /var/run/docker.sock I was able to deploy the pumba pod. The problem is that when pumba tries to connect to current docker socket there is an exception:
time="2017-10-19T13:42:30Z" level=debug msg="Retrieving running containers"
time="2017-10-19T13:42:30Z" level=error msg="Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/containers/json?limit=0: dial unix /var/run/docker.sock: connect: permission denied"
It seems there is some permissions problem that I have tried to fix without much success.
I have created a gist so you can see how Docker image of Pumba is created as well as the kubernetes file: https://gist.github.com/lordofthejars/14b6999395fb3986694c05bf48453d08
Probably it is something really simple to fix, but I cannot find a way.
Thank you very much for your help
The solution was to run oc adm policy add-scc-to-user privileged system:serviceaccount:fasttest:default with privileged instead of anyuid
I am trying to deploy my functions on the cloud functions emulator but my terminal throws me this error:
$ functions deploy sendNotifications --trigger-http
{ Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/#google-cloud/functions-emulator/logs'
at Error (native)
at Object.fs.mkdirSync (fs.js:922:18)
at Object.assertLogsPath (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/emulator/logs.js:31:10)
at new Controller (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/cli/controller.js:84:32)
at Object.exports.handler (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/cli/commands/deploy.js:124:22)
at Object.self.runCommand (/usr/local/lib/node_modules/#google-cloud/functions-emulator/node_modules/yargs/lib/command.js:231:22)
at Object.Yargs.self._parseArgs (/usr/local/lib/node_modules/#google-cloud/functions-emulator/node_modules/yargs/yargs.js:989:30)
at Object.Yargs.self.parse (/usr/local/lib/node_modules/#google-cloud/functions-emulator/node_modules/yargs/yargs.js:533:23)
at Object.main (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/cli/main.js:69:6)
at getProjectId.then (/usr/local/lib/node_modules/#google-cloud/functions-emulator/bin/functions:100:27)
errno: -13, code: 'EACCES', syscall: 'mkdir', path:
'/usr/local/lib/node_modules/#google-cloud/functions-emulator/logs' }
I have cd-ed to the functions directory and checked that I am logged in to firebase and selected the right project Id. Am i doing something wrongly?
Overview
The proper way to fix this is by changing the npm global directory to one that does not require root permission to install and run.
You really should not be requiring sudo to npm install -g.
Likewise to functions start.
Cleansing
Given that you have installed functions, presumably using sudo npm install -g #google-cloud/functions-emulator, you now need to first uninstall it equally with sudo: sudo npm uninstall -g #google-cloud/functions-emulator.
Why uninstall it? You currently have functions installed into a directory where root permissions are required to write. It does require write permission to log file as you can see from the error.
I would suggest uninstalling the other npm packages which you may have installed using sudo, except npm. You can find out what you have using sudo npm list -g --depth=0.
Changing npm global directory
I would suggest going with Option 2 described on https://docs.npmjs.com/getting-started/fixing-npm-permissions
Copy pasting solution from link above:
Make a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
Open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables:
source ~/.profile
Install global without sudo
Now that your machine has been cleansed and npm global has been configured to a directory that does not require root permissions, you should be able to install and run without sudo.
Had the same issue. For me it did not showed the permission log also..The issues is with the permissions. Try to the command with super user.
Step 1.
Start the gcloud functions
sudo functions start
Step 2.
Deploy the helloworld function which was exported.
sudo functions deploy helloworld --trigger-http
This is obviously very late for the original post. Hope this helps other who has the same error in the future.
I had the same issue turn out I hadn't installed that the requirements properly. Any one who steps in here can look at Error: EACCES: permission denied #195.
Main note of this error install all requirements properly.