version: 0.0
os: linux
files:
  - source: /
    destination: /var/www/mwop.net
  - source: .aws/crontab
    destination: /var/spool/cron/crontabs/www-data
permissions:
    - object: /var/www/mwop.net
      pattern: "**"
      owner: www-data
      group: www-data
      type:
        - directory
    - object: /var/spool/cron/crontabs/www-data
      owner: www-data
      group: crontab
      mode: 600
hooks:
  ApplicationStop:
    - location: service nginx stop
      timeout: 300
      runas: root
    - location: service php7.0-fpm stop
      timeout: 300
      runas: root
  ApplicationStart:
    - location: service php7.0-fpm start
      timeout: 300
      runas: root
    - location: service nginx start
      timeout: 300
      runas: root
    - location: service cron restart
      timeout: 300
      runas: root
  BeforeInstall:
    - location: .aws/install_dependencies.sh
      timeout: 600
      runas: root
  AfterInstall:
    - location: .aws/stage.sh
      timeout: 600
      runas: www-data

version: 0.0
os: linux
files:
  - source: /
    destination: /var/www/mwop.net
  - source: .aws/crontab
    destination: /var/spool/cron/crontabs/www-data
permissions:
    - object: /var/www/mwop.net
      pattern: "**"
      owner: www-data
      group: www-data
      type:
        - directory
    - object: /var/spool/cron/crontabs/www-data
      owner: www-data
      group: crontab
      mode: 600
hooks:
  ApplicationStop:
    - location: /usr/sbin/service nginx stop
      timeout: 300
      runas: root
    - location: /usr/sbin/service php7.0-fpm stop
      timeout: 300
      runas: root
  ApplicationStart:
    - location: /usr/sbin/service php7.0-fpm start
      timeout: 300
      runas: root
    - location: /usr/sbin/service nginx start
      timeout: 300
      runas: root
    - location: /usr/sbin/service cron restart
      timeout: 300
      runas: root
  BeforeInstall:
    - location: .aws/install_dependencies.sh
      timeout: 600
      runas: root
  AfterInstall:
    - location: .aws/stage.sh
      timeout: 600
      runas: www-data

Use full path to service exectutable
Use full path to service exectutable

- Otherwise, CodeDeploy triesto execute it relative to the install directory.
