Skip to content

Commit

Permalink
Temporarily comment out some steps
Browse files Browse the repository at this point in the history
  • Loading branch information
pinkeen authored and krisdante committed Mar 12, 2021
1 parent 459cfe0 commit 3f3a11c
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 59 deletions.
23 changes: 23 additions & 0 deletions LIFECYCLE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Delivery Lifecycle

## Build Release Source Artifact

0. Checkout Project Root
- `git clone m2c/m2c`
> Must contain:
> * `composer.json`
> * `auth.json.encrypted`
1. Build Backend Dist
- `ansible-vault --output=auth.json decrypt auth.json.encrypted`
- `composer update`
2. Build Frontend Dist
- `yarn --frozen-lockfile`
- `yarn build`
3. Run Tests
-

## Build Release Instance Image

## Update Live Instances with New Image

## Execute Post Deploy Actions on [single] New Instance
1 change: 1 addition & 0 deletions roles/cs.magento-configure/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@
when: magento_consumer_workers_enable and magento_version is version('2.3', '>=')



Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ echo 'Waiting for php-fpm to come up...'
until pgrep php-fpm > /dev/null; do sleep 0.5s ; done

echo 'Waiting for nginx to come up...'
until curl http://localhost:{{ nginx_app_port }}/static/deployed_version.txt -s -o /dev/null; do sleep 0.5s ; done
until curl "http://localhost:{{ nginx_app_port }}/static/deployed_version.txt" -s -o /dev/null; do sleep 0.5s ; done

DELAY=1
until su - {{ magento_user }} -c 'php {{ magento_live_release_dir }}/bin/magento -vvv cs:warm-node --local-url=http://localhost:{{ nginx_app_port }}';do
until php "{{ magento_live_release_dir }}/bin/magento" -vvv cs:warm-node --local-url="http://localhost:{{ nginx_app_port }}" ; do
sleep "$DELAY"
DELAY=$((DELAY * 2))
done

4 changes: 3 additions & 1 deletion roles/cs.supervisor/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
# name: "worker_name"
#
##
supervisor_programs: []
supervisor_programs: []
supervisor_service_autostart: yes
supervisor_service_initial_state: started
3 changes: 2 additions & 1 deletion roles/cs.supervisor/files/supervisord.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[Unit]
Description=Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
After=network.target var-www-magento-shared-var-global.mount
ConditionPathExists=!{{ magento_live_release_dir }}/var/global/.maintenance.flag

[Service]
ExecStart=/usr/bin/supervisord -n -c /etc/supervisord.conf
Expand Down
4 changes: 2 additions & 2 deletions roles/cs.supervisor/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@
- name: Enable and start supervisord
service:
name: supervisord
enabled: yes
state: started
enabled: "{{ supervisor_service_autostart }}"
state: "{{ supervisor_service_initial_state }}"
98 changes: 52 additions & 46 deletions site.step-10-infrastructure-aws.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,54 @@
- hosts: localhost
connection: local
gather_facts: false
pre_tasks:
- name: Collect minimum facts (we need date time stuff)
setup:
gather_subset: min
roles:
- role: cs.aws-vpc
- role: cs.aws-security-group
aws_security_group_rds_create: "{{ aws_rds_create }}"
aws_security_group_redis_create: "{{ mageops_redis_create or mageops_redis_sessions_create }}"
aws_security_group_rabbitmq_create: "{{ mageops_rabbitmq_create and magento_rabbitmq_queue }}"
aws_security_group_elasticsearch_create: "{{ mageops_elasticsearch_create }}"
- role: cs.aws-s3
- role: cs.aws-cloudfront
aws_cloudfront_use_lambda: "{{ aws_cloudfront_optimizing_edge_lambda_enable }}"
aws_cloudfront_lambda_arn: "{{ aws_cloudfront_lambda_latest_arn | default(omit, true) }}"
when: aws_cloudfront_distribution_create | bool
- role: cs.aws-rds
when: aws_rds_create
- role: cs.aws-loadbalancer
lb_ssl_cert: "{{ aws_elb_https_certificate_arn }}"
lb_s3_logs_bucket: "{{ aws_s3_secret_bucket }}"
lb_http_port: "{{ mageops_varnish_port }}"
when: aws_elb_create
- role: cs.aws-ami-facts
- role: cs.aws-node-facts
- role: cs.aws-node-varnish
aws_varnish_node_root_device: "{{ aws_ami_root_device }}"
aws_varnish_node_vpc_subnet_id: "{{ aws_vpc_subnet_id }}"
aws_varnish_instance_id: "{{ aws_varnish_node_instance.instance_id | default(false) }}"
when: varnish_standalone
- role: cs.aws-node-persistent
aws_persistent_node_root_device: "{{ aws_ami_root_device }}"
aws_persistent_node_vpc_subnet_id: "{{ aws_vpc_subnet_id }}"
aws_persistent_instance_id: "{{ aws_persistent_node_instance.instance_id | default(false) }}"
- role: cs.mysql-configure
mysql_user_localhost_access: "{{ not aws_rds_create }}"
- role: cs.aws-lambda-varnish
when: varnish_standalone
- role: cs.aws-lambda-node-coordinator
when: aws_magento_cron_enabled
- role: cs.aws-lambda-import
- role: cs.finalize
gather_facts: no
tasks:
- name: Refresh inventory to get info about newly created nodes
meta: refresh_inventory
- debug:
msg: I do nothing!

# - hosts: localhost
# connection: local
# gather_facts: false
# pre_tasks:
# - name: Collect minimum facts (we need date time stuff)
# setup:
# gather_subset: min
# roles:
# - role: cs.aws-vpc
# - role: cs.aws-security-group
# aws_security_group_rds_create: "{{ aws_rds_create }}"
# aws_security_group_redis_create: "{{ mageops_redis_create or mageops_redis_sessions_create }}"
# aws_security_group_rabbitmq_create: "{{ mageops_rabbitmq_create and magento_rabbitmq_queue }}"
# aws_security_group_elasticsearch_create: "{{ mageops_elasticsearch_create }}"
# - role: cs.aws-s3
# - role: cs.aws-cloudfront
# aws_cloudfront_use_lambda: "{{ aws_cloudfront_optimizing_edge_lambda_enable }}"
# aws_cloudfront_lambda_arn: "{{ aws_cloudfront_lambda_latest_arn | default(omit, true) }}"
# when: aws_cloudfront_distribution_create | bool
# - role: cs.aws-rds
# when: aws_rds_create
# - role: cs.aws-loadbalancer
# lb_ssl_cert: "{{ aws_elb_https_certificate_arn }}"
# lb_s3_logs_bucket: "{{ aws_s3_secret_bucket }}"
# lb_http_port: "{{ mageops_varnish_port }}"
# when: aws_elb_create
# - role: cs.aws-ami-facts
# - role: cs.aws-node-facts
# - role: cs.aws-node-varnish
# aws_varnish_node_root_device: "{{ aws_ami_root_device }}"
# aws_varnish_node_vpc_subnet_id: "{{ aws_vpc_subnet_id }}"
# aws_varnish_instance_id: "{{ aws_varnish_node_instance.instance_id | default(false) }}"
# when: varnish_standalone
# - role: cs.aws-node-persistent
# aws_persistent_node_root_device: "{{ aws_ami_root_device }}"
# aws_persistent_node_vpc_subnet_id: "{{ aws_vpc_subnet_id }}"
# aws_persistent_instance_id: "{{ aws_persistent_node_instance.instance_id | default(false) }}"
# - role: cs.mysql-configure
# mysql_user_localhost_access: "{{ not aws_rds_create }}"
# - role: cs.aws-lambda-varnish
# when: varnish_standalone
# - role: cs.aws-lambda-node-coordinator
# when: aws_magento_cron_enabled
# - role: cs.aws-lambda-import
# - role: cs.finalize
# tasks:
# - name: Refresh inventory to get info about newly created nodes
# meta: refresh_inventory
2 changes: 2 additions & 0 deletions site.step-40-app-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@

- role: cs.supervisor
supervisor_programs: "{{ mageops_supervisor_programs_app_node }}"
supervisor_service_autostart: no
supervisor_service_initial_state: stopped

- role: cs.nginx-url-blacklist

Expand Down
13 changes: 6 additions & 7 deletions site.step-60-autoscaling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,8 @@
{{ aws_app_node_launch_script_extra }}
{% if not magento_aws_ondemand_import_instance_enable and magento_import_dispatcher_enable %}{{ magento_import_dispatcher_switch_script_path }} on{% endif %}
# TODO-DEPLOY-NEXT: Add this check to supervisord unit file - auto stop/start
# when this file is created / removed. Make sure the service starts after
# NFS mount is ready. Also add this to extra-instances.
if [ ! -f "{{ magento_live_release_dir }}/var/global/.maintenance.flag" ] ; then
/usr/bin/systemctl start supervisord
fi
/usr/bin/systemctl enable supervisord
/usr/bin/systemctl start supervisord
- role: cs.aws-autoscaling
when: aws_extra_app_asg_enable or magento_aws_ondemand_import_instance_enable
Expand Down Expand Up @@ -119,4 +115,7 @@
}}
autoscaling_instance_start_script: |
{{ aws_app_node_launch_script_extra }}
{% if magento_import_dispatcher_enable %}{{ magento_import_dispatcher_switch_script_path }} on{% endif %}
{% if magento_import_dispatcher_enable %}{{ magento_import_dispatcher_switch_script_path }} on{% endif %}
/usr/bin/systemctl enable supervisord
/usr/bin/systemctl start supervisord
5 changes: 5 additions & 0 deletions site.step-65-post-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
become: yes
become_user: "{{ magento_user }}"
loop:
- "bin/magento app:config:import --no-interaction"
- "bin/magento setup:upgrade --keep-generated"
- "bin/magento maintenance:disable"
# - "bin/magento cache:flush full_page"
Expand Down Expand Up @@ -66,3 +67,7 @@
label: "{{ result.cmd | default([]) | join(' ') }}"


- hosts: app:&current
tasks:
- name: Start supervisord Magento workers
command: /usr/bin/systemctl start supervisord

0 comments on commit 3f3a11c

Please sign in to comment.