1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
0
OK. You want to start gunicorn with environment variable SECRET_KEY stored in AWS Parameter Store. If you can customize service file, write service shell file and change service file.
Service shell file(For example, locate at /opt/bin/django.sh. Do not forget to set execute permission.)
#!/bin/bash
export SECRET_KEY=`aws ssm get-parameter --name [parameter name] | jq -r '.Parameter.Value'`
/path/to/project/bin/gunicorn --access-logfile - --workers 3 --bind unix:/var/run/gunicorn.sock site_mod.wsgi
Service file(For example, locate at /etc/systemd/system/django.service)
[Unit]
Description=gunicorn daemon
Requires=gunicorn.sock
After=network.target
[Service]
User=service-user
Group=service-group
WorkingDirectory=/path/to/project
ExecStart=/opt/bin/django.sh
[Install]
WantedBy=multi-user.target
I run this service, and it can run. I do not test on CodeDeploy, but this solution would help you.
répondu il y a 10 mois
Contenus pertinents
- demandé il y a un an
- demandé il y a 13 jours
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 2 ans