1 Resposta
- Mais recentes
- Mais votos
- Mais comentários
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.
respondido há um ano
Conteúdo relevante
- AWS OFICIALAtualizada há um ano
- AWS OFICIALAtualizada há 2 anos
- AWS OFICIALAtualizada há 2 meses