-
-
Save makkaba/3b1c3fbaf4eaa6a742f08c2fecc6ffa8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Resources: | |
AWSEBAutoScalingGroup: | |
Type: AWS::AutoScaling::AutoScalingGroup | |
Properties: | |
HealthCheckType: ELB | |
HealthCheckGracePeriod: 600 | |
option_settings: | |
- namespace: aws:autoscaling:launchconfiguration | |
option_name: IamInstanceProfile | |
value: my-ebs-ec2-role | |
- namespace: aws:elasticbeanstalk:container:php:phpini | |
option_name: document_root | |
value: /public | |
- namespace: aws:elasticbeanstalk:application | |
option_name: Application Healthcheck URL | |
value: /live.html | |
- namespace: aws:autoscaling:asg | |
option_name: MinSize | |
value: 1 | |
- namespace: aws:autoscaling:asg | |
option_name: MaxSize | |
value: 5 | |
- namespace: aws:autoscaling:asg | |
option_name: Availability Zones | |
value: Any 2 | |
- namespace: aws:elb:loadbalancer | |
option_name: CrossZone | |
value: true | |
- namespace: aws:autoscaling:launchconfiguration | |
option_name: InstanceType | |
value: m3.medium | |
- namespace: aws:autoscaling:launchconfiguration | |
option_name: RootVolumeType | |
value: gp2 | |
- namespace: aws:autoscaling:trigger | |
option_name: BreachDuration | |
value: 5 | |
- namespace: aws:autoscaling:trigger | |
option_name: MeasureName | |
value: CPUUtilization | |
- namespace: aws:autoscaling:trigger | |
option_name: Period | |
value: 5 | |
- namespace: aws:autoscaling:trigger | |
option_name: Unit | |
value: Percent | |
- namespace: aws:autoscaling:trigger | |
option_name: LowerThreshold | |
value: 40 | |
- namespace: aws:autoscaling:trigger | |
option_name: UpperThreshold | |
value: 70 | |
- namespace: aws:elasticbeanstalk:application:environment | |
option_name: APP_CONFIG_FILE | |
value: my-app-config.json | |
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/01_link_public_content.sh": | |
mode: "000755" | |
owner: webapp | |
group: webapp | |
content: | | |
ln -s /var/www/html/content /var/www/html/public/content | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/02_link_includes_assets.sh": | |
mode: "000755" | |
owner: webapp | |
group: webapp | |
content: | | |
ln -s /var/www/html/includes/assets /var/www/html/public/includes/assets | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/03_move_config.sh": | |
mode: "000755" | |
owner: webapp | |
group: webapp | |
content: | | |
mv /var/app/config.json /var/www/html/includes/config.json | |
"/etc/httpd/conf.modules.d/01-your-app-prefork.conf": | |
mode: "000644" | |
content: | | |
StartServers 50 | |
MinSpareServers 40 | |
MaxSpareServers 50 | |
ServerLimit 50 | |
MaxClients 50 | |
MaxRequestsPerChild 4000 | |
"/etc/init.d/supervisord": | |
mode: "000755" | |
content: | | |
SUPERVISORD=/usr/bin/supervisord | |
SUPERVISORCTL=/usr/bin/supervisorctl | |
case $1 in | |
start) | |
echo -n "Starting supervisord: " | |
$SUPERVISORD | |
echo | |
;; | |
stop) | |
echo -n "Stopping supervisord: " | |
if [ -S /tmp/supervisor.sock ]; | |
then | |
$SUPERVISORCTL shutdown | |
else | |
echo "alredy stopped" | |
fi | |
echo | |
;; | |
restart) | |
echo -n "Stopping supervisord: " | |
$SUPERVISORCTL shutdown | |
echo | |
echo -n "Starting supervisord: " | |
$SUPERVISORD | |
echo | |
;; | |
esac | |
"/etc/supervisord.conf": | |
mode: "000644" | |
content: | | |
[unix_http_server] | |
file=/tmp/supervisor.sock | |
[inet_http_server] | |
port=*:9001 | |
[supervisord] | |
logfile=/tmp/supervisord.log | |
logfile_maxbytes=50MB | |
logfile_backups=10 | |
loglevel=info | |
pidfile=/tmp/supervisord.pid | |
nodaemon=false | |
minfds=1024 | |
minprocs=200 | |
[rpcinterface:supervisor] | |
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface | |
[supervisorctl] | |
serverurl=unix:///tmp/supervisor.sock | |
[program:your-app] | |
command=/usr/bin/php /var/app/current/daemon.php | |
user=webapp | |
process_name = %(program_name)s_%(process_num)02d | |
numprocs=4 | |
directory=/var/app/current/ | |
autostart=false | |
autorestart=true | |
log_stderr=true | |
stdout_logfile=/var/log/your-app-daemon-out.log | |
stdout_logfile_maxbytes=1MB | |
stderr_logfile=/var/log/your-app-daemon.log | |
stderr_logfile_maxbytes=1MB | |
commands: | |
01-install-apcu: | |
command: yum install -y php71-pecl-apcu | |
02-install-supervisor: | |
command: easy_install supervisor | |
03-supervisor-set-access: | |
command: chmod +x /etc/init.d/supervisord | |
container_commands: | |
01-supervisor-stop: | |
command: service supervisord stop | |
02-supervisor-start: | |
command: service supervisord start | |
03-supervisorctl-reread: | |
command: supervisorctl reread | |
04-supervisorctl-update: | |
command: supervisorctl update | |
05-supervisorctl-restart-all: | |
command: supervisorctl restart all | |
06-get-app-config: | |
command: aws s3api get-object --bucket my-app-config-bucket --key $APP_CONFIG_FILE /var/app/config.json | |
07-restart-httpd: | |
command: /sbin/service httpd restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment