Puppet-Docker Service Error undefined method '[]' for nil:NilClass - puppet

I have a fresh install of the garethr-docker repo using command
puppet module install garethr/docker.
My puppet nodes.pp that I am running is very very simple:
include 'docker'
The logs look like they initialize the conf correctly; however, it's unable to reschedule the service. Please see the logs below
debug: /Stage[main]/Docker::Service/File[/etc/init/docker.conf]/content: Executing 'diff -u /etc/init/docker.conf /tmp/puppet-file20140305-9166-j634yb-0'
notice: /Stage[main]/Docker::Service/File[/etc/init/docker.conf]/content:
--- /etc/init/docker.conf 2014-03-05 18:00:12.141549000 +0000
+++ /tmp/puppet-file20140305-9166-j634yb-0 2014-03-05 18:08:46.997549000 +0000
## -6,6 +6,6 ##
respawn
script
- /usr/bin/docker -d -g /dap-home/docker -H unix:///var/run/docker.sock
+ /usr/bin/docker -d -H unix:///var/run/docker.sock
end script
debug: Finishing transaction 70136334948320
info: FileBucket got a duplicate file {md5}35cd6455aae3a3bc020b4db1e9839271
info: /Stage[main]/Docker::Service/File[/etc/init/docker.conf]: Filebucketed /etc/init/docker.conf to puppet with sum 35cd6455aae3a3bc020b4db1e9839271
notice: /Stage[main]/Docker::Service/File[/etc/init/docker.conf]/content: content changed '{md5}35cd6455aae3a3bc020b4db1e9839271' to '{md5}e6ce3c01ccf99456fc57176f1895f808'
info: /Stage[main]/Docker::Service/File[/etc/init/docker.conf]: Scheduling refresh of Service[docker]
debug: /Stage[main]/Docker::Service/File[/etc/init/docker.conf]: The container Class[Docker::Service] will propagate my refresh event
debug: Puppet::Type::Service::ProviderUpstart: Executing '/sbin/status docker'
debug: Puppet::Type::Service::ProviderUpstart: Executing '/sbin/initctl --version'
err: /Stage[main]/Docker::Service/Service[docker]: Could not evaluate: undefined method `[]' for nil:NilClass
It should be noted (not that it really matters), that he machine that docker is being installed on is in fact a Docker container. The container that is the puppet agent is being run with the -privileged.

Related

Failed to start Postgres on Debian

Postgres (13.5) cannot start after restarting server (Debian 4.19.208-1)
UPDATE 1
I changed user permissions and now I have another error on starting postgres:
systemctl status postgresql
FATAL: lock file "postmaster.pid" already exists
But I checked pg clusters and there exists only one:
Also I deleted postmaster.pid and there is no file any more:
So I have no errors details but postrges is shutting down.
Any ideas?
==============================================================
I'm trying to start manually sudo service postgresql start but got error:
Job for postgresql.service failed because the control process exited with error code. See "systemctl status postgresql.service" and "journalctl -xe" for details.
So then I ran systemctl status postgresql
Results:
FATAL: data directory "/var/lib/postgresql/13/main" has invalid permissions
DETAIL: Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).
I modified permissions:
chmod u=rwx /var/lib/postgresql/13/main
chmod g=rx /var/lib/postgresql/13/main
But I still see the same error about permissions.
You can see whole results on screenshot
Sorry, I'm not so familiar with Linux
I fixed this problem. I ran postgres not as a service but with logs:
postgresql -D /var/lib/postgresql/13/main
And I saw in the log that problem was with pg_hba.conf. I opened this file - it was empty!
So I restored pg_hba.conf from backup and started postgres as service

lubuntu / centos container CrashLoopBackOff error

when ever i run # kubectl run ubuntu --image=ubuntu or centos
i gt containercrashoff , when checked in kubectl describe pod below error is observed
Warning Failed 4s (x3 over 22s) kubelet Error: failed to create containerd task: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "ping": executable file not found in $PATH: unknown
pl suggest to solve this issue

AWS elastic beanstalk deploy always fails (uploading a zipfile)

I upload a new version of my app as a zipfile and click deploy. Then the status changes to severe.
This is the error trace:
WARN
Environment health has transitioned from Info to Degraded. Command failed on all instances. Incorrect application version found on all instances. Expected version "Sample" (deployment 2). Application update failed 10 seconds ago and took 4 minutes.
ERROR
During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version.
ERROR
Failed to deploy application.
ERROR
Unsuccessful command execution on instance id(s) 'i------'. Aborting the operation.
ERROR
[Instance: i-002326d7ceeba0ea9] Command failed on instance. Return code:
1 Output: nginx: [emerg] no host in upstream ":80" in /etc/nginx/conf.d/elasticbeanstalk-nginx-docker-upstream.conf:
2 nginx: configuration file /etc/nginx/nginx.conf test failed Failed to start nginx, abort deployment.
Hook /opt/elasticbeanstalk/hooks/appdeploy/enact/01flip.sh failed.
For more detail, check /var/log/eb-activity.log using console or EB CLI.
ERROR
Failed to start nginx, abort deployment
/var/log/eb-activity.log
here are errors in this log:
[0mInstalling dependencies from Pipfile.lock (5e00f3)…
Failed to load paths: /bin/sh: 1: /root/.local/share/virtualenvs/app-lp47FrbD/bin/python: not found
...
[2020-05-29T01:51:24.746Z] INFO [11395] - [Application update v1.3.3-1#3/AppDeployStage1/AppDeployEnactHook/00run.sh] : Completed activity. Result:
jq: error (at <stdin>:1): Cannot iterate over null (null)
a2f568b1c255eb9e0fdc6ceebdd29b9ec64b9ab4481a3e1c5bcb11828b0ac526
[2020-05-29T01:51:24.747Z] INFO [11395] - [Application update v1.3.3-1#3/AppDeployStage1/AppDeployEnactHook/01flip.sh] : Starting activity...
[2020-05-29T01:51:26.099Z] INFO [11395] - [Application update v1.3.3-1#3/AppDeployStage1/AppDeployEnactHook/01flip.sh] : Activity execution failed, because: nginx: [emerg] no host in upstream ":80" in /etc/nginx/conf.d/elasticbeanstalk-nginx-docker-upstream.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failed
Failed to start nginx, abort deployment (ElasticBeanstalk::ExternalInvocationError)
caused by: nginx: [emerg] no host in upstream ":80" in /etc/nginx/conf.d/elasticbeanstalk-nginx-docker-upstream.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failed
Failed to start nginx, abort deployment (Executor::NonZeroExitStatus)
...
[2020-05-29T01:51:26.099Z] INFO [11395] - [Application update v1.3.3-1#3/AppDeployStage1/AppDeployEnactHook/01flip.sh] : Activity failed.
[2020-05-29T01:51:26.099Z] INFO [11395] - [Application update v1.3.3-1#3/AppDeployStage1/AppDeployEnactHook] : Activity failed.
[2020-05-29T01:51:26.099Z] INFO [11395] - [Application update v1.3.3-1#3/AppDeployStage1] : Activity failed.
[2020-05-29T01:51:26.100Z] INFO [11395] - [Application update v1.3.3-1#3] : Completed activity. Result:
Application update - Command CMD-AppDeploy failed
The inability to deploy has been consistent for this environment, after several attempts, even reverting to an older version.
Afterwards, I resolved this by isolating the code and error messages using a local docker image with the zipfile. Running the code on my machine outside of docker did NOT reveal any problems, because the pip / pipenv part was missing some depdendency.
Steps for local docker testing:
WITHIN a docker container:
docker system prune
Go to the folder with Dockerfile
docker image build -t <app_name>:<version_number> .
TO run locally:
(docker rm <app_name> first, if you've already got a stopped container with the same name from prior testing)
docker container run --publish 80:80 --name <app_name> myapp:1.0
NOTE:
this won't let you test AWS functions that require environment variables, such as ~.aws credentials because they're not inside the image.
(but you could add them with your Dockerfile)
Once the docker container is running, you'll see (I saw) error messages that were not there when testing locally, because they were caused by a missing package dependency and a pipenv error.

Unable to run nvidia-docker. docker: Error response from daemon: OCI runtime create failed:

I was trying to re-implement this code from Github and it requires me to install nvidia-docker and run it. The installation of nvidia-docker seemed successful. However, when I run the command nvidia-docker run -it --ipc=host deep-colorization, it throws the following error::
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"process_linux.go:432: running prestart hook 1 caused \\\"error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: driver error: failed to process request\\\\n\\\"\"": unknown.
ERRO[0002] error waiting for container: context canceled
I am not sure what the error means as I don't have any previous experience with the docker ecosystem. Any kind of assistance is appreciated. I am running Ubuntu 18 by the way.
Thanking you in advance.

Error while bootstrapping ec2 instance on hosted chef server on azure

I am trying to bootstrap ec2 instance using knife on chef server hosted on azure marketplace. the chef client run fails throwing the following error.
PS C:\Users\xyz\chef-repo> knife ec2 server create -I ami-25c00c46 -f t2.micro
--region ap-southeast-1 -N ec2module
-x ubuntu -i abc.pem -r "role[ec2], role[jenkinserver]" -g sg-9f1b31fa sudo
.ap-southeast-1.compute.amazonaws.com Chef encountered an error attempting to create the client "ec2module"
.ap-southeast-1.compute.amazonaws.com Running handlers:
.ap-southeast-1.compute.amazonaws.com [2016-01-20T11:39:26+00:00] ERROR: Running exception handlers
.ap-southeast-1.compute.amazonaws.com Running handlers complete
.ap-southeast-1.compute.amazonaws.com [2016-01-20T11:39:26+00:00] ERROR: Exception handlers complete
.ap-southeast-1.compute.amazonaws.com Chef Client failed. 0 resources updated in 03 seconds
.ap-southeast-1.compute.amazonaws.com [2016-01-20T11:39:26+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
.ap-southeast-1.compute.amazonaws.com [2016-01-20T11:39:26+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
.ap-southeast-1.compute.amazonaws.com [2016-01-20T11:39:26+00:00] ERROR: undefined method `length' for nil:NilClass
.ap-southeast-1.compute.amazonaws.com [2016-01-20T11:39:26+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
There seems to be a problem with the server SSL certificate and perhaps it is related to Chef issue #4301 (read it).
Try downloading the SSL certificate from the Chef Server:
> knife ssl fetch
Then, you can check it with:
> knife ssl check
I hope this helps.

Resources