Unsuccessful command execution on instance id(s) - django

I am trying to deploy my app on AWS but it seems to stuck at this point:
Uploading: [##################################################] 100% Done...
2019-10-22 11:01:57 INFO Environment update is starting.
2019-10-22 11:02:00 INFO Deploying new version to instance(s).
2019-10-22 11:02:09 ERROR Your requirements.txt is invalid. Snapshot your logs for details.
2019-10-22 11:02:10 ERROR [Instance: i-#######] Command failed on instance. Return code: 1 Output: (TRUNCATED)...)
File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2019-10-22 11:02:10 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-10-22 11:02:10 ERROR Unsuccessful command execution on instance id(s) 'i########'. Aborting the operation.
2019-10-22 11:02:11 ERROR Failed to deploy application.
ERROR: ServiceError - Failed to deploy application.
It says that my requirements.txt is invalid, Why ?
Requirement.txt
Django
django-crispy-forms==1.7.0
pytz==2017.3
gunicorn==19.9.0
django-widget-tweaks
psycopg2
Please help me in figuring out what I am doing wrong.

Related

AWS Replication agent problem when launching

I am trying to launch aws replication agent in a CENTOS 8.3 and always returns me an error during the process of replication agent installation ( python3 aws-replication-installer-init.py ......)
The output of the process shows me:
The installation of the AWS Replication Agent has started.
Identifying volumes for replication.
Identified volume for replication: /dev/sdb of size 7 GiB
Identified volume for replication: /dev/sda of size 11 GiB
All volumes for replication were successfully identified.
Downloading the AWS Replication Agent onto the source server... Finished.
Installing the AWS Replication Agent onto the source server...
Error: Failed Installing the AWS Replication Agent
Installation failed.
If i check the aws_replication_agent_installer.log i can see that appears messages like:
make -C /lib/modules/4.18.0-348.2.1.el8_5.x86_64/build M=/tmp/tmp8mdbz3st/AgentDriver modules
.....................
retcode: 0
Build essentials returned with code None
--- Building software
running: 'which zypper'
retcode: 256
running: 'make'
retcode: 0
running: 'chmod 0770 ./aws-replication-driver-commander'
retcode: 0
running: '/sbin/rmmod aws-replication-driver'
retcode: 256
running: '/sbin/insmod ./aws-replication-driver.ko'
retcode: 256
running: '/sbin/rmmod aws-replication-driver'
retcode: 256
Cannot insert module. Try 0.
running: '/sbin/rmmod aws-replication-driver'
retcode: 256
running: '/sbin/insmod ./aws-replication-driver.ko'
retcode: 256
running: '/sbin/rmmod aws-replication-driver'
retcode: 256
Cannot insert module. Try 1.
............
Cannot insert module. Try 9.
Installation returned with code 2
Installation failed due to unspecified error:
stderr: sh: /var/lib/aws-replication-agent/stopAgent.sh: No such file or directory
which: no zypper in (/sbin:/bin:/usr/sbin:/usr/bin:/sbin:/usr/sbin)
which: no apt-get in (/sbin:/bin:/usr/sbin:/usr/bin:/sbin:/usr/sbin)
which: no zypper in (/sbin:/bin:/usr/sbin:/usr/bin:/sbin:/usr/sbin)
rmmod: ERROR: Module aws_replication_driver is not currently loaded
insmod: ERROR: could not insert module ./aws-replication-driver.ko: Required key not available
rmmod: ERROR: Module aws_replication_driver is not currently loaded
Any issue of the error?
Launching with the command:
mokutil --disable-validation
will allow to change kernel modules (next boot will confirm it introducing password that must be entered afet command mokutil)

KeyError: 'torch', memory error ERROR: ServiceError - Failed to deploy application.: AWS elastic beanstalk, django

So I have installed torch in my local machine and it is working correctly, but while deploying it in aws it show the following error.
I am trying to deploy my django app on AWS elastic beanstalk but I am facing the following error.
2021-04-20 18:00:43 INFO Environment update is starting.
2021-04-20 18:00:46 INFO Deploying new version to instance(s).
2021-04-20 18:00:57 ERROR Instance deployment failed to install application dependencies. The deployment failed.
2021-04-20 18:00:57 ERROR Instance deployment failed. For details, see 'eb-engine.log'.
2021-04-20 18:01:01 ERROR [Instance: i-0eee746bc342a71cd] Command failed on instance. Return code: 1 Output: Engine execution has encountered an error..
2021-04-20 18:01:01 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2021-04-20 18:01:01 ERROR Unsuccessful command execution on instance id(s) 'i-0eee746bc342a71cd'. Aborting the operation.
2021-04-20 18:01:01 ERROR Failed to deploy application.
My eb-engine.log
Downloading https://download.pytorch.org/whl/cpu/torchvision-0.6.1%2Bcpu-cp37-cp37m-linux_x86_64.whl (5.7 MB)
Collecting torch==1.8.1+cpu
2021/04/20 18:00:57.931655 [ERROR] An error occurred during execution of command [app-deploy] - [InstallDependency]. Stop running the command. Error: fail to install dependencies with requirements.txt file with error Command /bin/sh -c /var/app/venv/staging-LQM1lest/bin/pip install -r requirements.txt failed with error exit status 2. Stderr:ERROR: Exception:
Traceback (most recent call last):
File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 171, in _merge_into_criterion
crit = self.state.criteria[name]
KeyError: 'torch'
.
.
.
.
File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/pip/_vendor/msgpack/fallback.py", line 671, in _unpack
ret[key] = self._unpack(EX_CONSTRUCT)
File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/pip/_vendor/msgpack/fallback.py", line 684, in _unpack
return bytes(obj)
MemoryError
My requirements.txt
-f https://download.pytorch.org/whl/torch_stable.html
torchvision==0.6.1+cpu
torch==1.8.1+cpu
Can someone explain me what I am doing wrong?
Thank you so much

AWS: cloud-init failed

I have a custom centos AMI on which i installed aws-cfn-bootstrap from https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.amzn1.noarch.rpm.
After running cloudformation script,cloud-init is stuck for that instance.
I tried to look into cloud-init.log. I couldn't able to debug the issue.
and I have no idea how to debug this. Help needed, I am currently stuck here. Below are some errors from log. Help me in solving this.
Do I need to change cloud-init.cfg ??
2017-10-10 13:12:26,172 - util.py[DEBUG]: Running command ['mount', '-o', 'ro,sync', '-t', 'iso9660', '/dev/xvda', '/tmp/tmptIJHi2'] with allowed return codes [0] (shell=False, capture=True)
2017-10-10 13:12:26,188 - util.py[DEBUG]: Failed mount of '/dev/xvda' as 'iso9660': Unexpected error while running command.
Command: ['mount', '-o', 'ro,sync', '-t', 'iso9660', '/dev/xvda', '/tmp/tmptIJHi2']
Exit code: 32
Reason: -
Stdout: -
2017-10-10 13:12:27,908 - util.py[DEBUG]: Failed mount of '/dev/xvda' as 'iso9660': Unexpected error while running command.
Command: ['mount', '-o', 'ro,sync', '-t', 'iso9660', '/dev/xvda', '/tmp/tmpJcAGOG']
Exit code: 32
Reason: -
Stdout: -
2017-10-11 04:05:42,847 - util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [1]
2017-10-11 04:05:42,847 - util.py[DEBUG]: Failed running /var/lib/cloud/instance/scripts/part-001 [1]
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 802, in runparts
subp(prefix + [exe_path], capture=False)
File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 1858, in subp
cmd=args)
ProcessExecutionError: Unexpected error while running command.
Command: ['/var/lib/cloud/instance/scripts/part-001']
Exit code: 1
Reason: -
Stdout: -
Stderr: -
BRs,
Kiran
The problem of yours is the mount command.
Are you launch the instance using from existing server (using it's AMI)?
You can check by running the command on that server, and see if it is working or not.
I believe that your command is something like this.
mount -o ro,sync -t iso9660 /dev/xvda /tmp/tmptIJHi2

Error Deploying Docker Container to Elastic Beanstalk

I'm using Elastic Beanstalk to deploy a Docker Image I've created. I created a .zip file with a Dockerfile and Dockerrun.aws.json file.
When I deploy, I get the following error:
[2015-11-02T18:08:30.366Z] ERROR [4515] : Command execution failed: Activity failed. (ElasticBeanstalk::ActivityFatalError) caused by: jq: error: Cannot iterate over null ab6ac43aeaf75fb000d02a1fee73e829a92cef629bad46e6b727dc967f837b54
Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Mon Nov 2 18:08:30 UTC 2015:. Check snapshot logs for details. (ElasticBeanstalk::ExternalInvocationError) caused by: jq: error: Cannot iterate over null ab6ac43aeaf75fb000d02a1fee73e829a92cef629bad46e6b727dc967f837b54
Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Mon Nov 2 18:08:30 UTC 2015:. Check snapshot logs for details. (Executor::NonZeroExitStatus)
[2015-11-02T18:08:30.366Z] ERROR [4515] : Command CMD-Startup(stage 1) failed!
What's odd is that when I use elastic beanstalk CLI to deploy locally, it works fine. Any ideas on what could be happening here?
You'll want to add the following bit to your Dockerrun.aws.json file to get past this issue.
"Volumes": []

Why am I getting a permission denied error on docker/aws eb?

I don't know why but I cannot seem to figure out why this is happening. I can build and run the docker image locally.
Recent Events:
2015-05-25 12:57:07 UTC+1000 ERROR Update environment operation is complete, but with errors. For more information, see troubleshooting documentation.
2015-05-25 12:57:07 UTC+1000 INFO New application version was deployed to running EC2 instances.
2015-05-25 12:57:04 UTC+1000 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2015-05-25 12:57:04 UTC+1000 ERROR [Instance: i-4775ec9b] Command failed on instance. Return code: 1 Output: (TRUNCATED)... run Docker container: vel="fatal" msg="Error response from daemon: Cannot start container 02c057b331bf3a3d912bf064f1dca3e00c95746b5748c3c4a28a5c6b452ff335: [8] System error: exec: \"bin/app\": permission denied" . Check snapshot logs for details. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/04run.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2015-05-25 12:57:03 UTC+1000 ERROR Failed to run Docker container: vel="fatal" msg="Error response from daemon: Cannot start container 02c057b331bf3a3d912bf064f1dca3e00c95746b5748c3c4a28a5c6b452ff335: [8] System error: exec: \"bin/app\": permission denied" . Check snapshot logs for details.
Dockerfile:
FROM java:8u45-jre
MAINTAINER Terence Munro <terry#zenkey.com.au>
ADD ["opt", "/opt"]
WORKDIR /opt/docker
RUN ["chown", "-R", "daemon:daemon", "."]
USER daemon
ENTRYPOINT ["bin/app"]
EXPOSE 9000
Dockerrun.aws.json:
{
"AWSEBDockerrunVersion": "1",
"Ports": [
{
"ContainerPort": "9000"
}
],
"Volumes": []
}
Additional logs as attachment at: https://forums.aws.amazon.com/thread.jspa?threadID=181270
Any help is extremely appreciated.
#nick-humrich suggestion of trying eb local run worked. So using eb deploy ended up working.
I had previously been uploading through the web interface.
Initially using eb deploy was giving me a ERROR: TypeError :: data must be a byte string but I found this issue which was resolved by uninstalling pyopenssl.
So I don't know why the web interface was giving me permission denied perhaps something to do with the zip file?
But anyway I'm able to deploy now thank you.
I had a similar problem running Docker on Elastic Beanstalk. When I pointed CMD in the Dockerfile to a shell script (/path/to/my_script.sh), the EB deployment would fail with
/path/to/my_script.sh: Permission denied.
Apparently, even though I had run RUN chmod +x /path/to/my_script.sh during the Docker build, by the time the image was run, the permissions had been changed. Eventually, to make it work I settled on:
CMD ["/bin/bash","-c","chmod +x /path/to/my_script.sh && /path/to/my_script.sh"]