├── README.md ├── appspec.yml ├── buildspec.yml ├── index.html └── scripts ├── after_install.sh ├── install_dependencies.sh ├── start_server.sh ├── stop_server.sh └── validate_service.sh /README.md: -------------------------------------------------------------------------------- 1 | # awscodedeploy 2 | 3 | sudo yum update -y 4 | 5 | sudo yum install -y ruby wget 6 | 7 | wget https://aws-codedeploy-eu-west-1.s3.eu-west-1.amazonaws.com/latest/install 8 | 9 | chmod +x ./install 10 | 11 | sudo ./install auto 12 | 13 | sudo service codedeploy-agent status 14 | 15 | -------------------------------------------------------------------------------- /appspec.yml: -------------------------------------------------------------------------------- 1 | version: 0.0 2 | os: linux 3 | files: 4 | - source: /index.html 5 | destination: /var/www/html/ 6 | hooks: 7 | ApplicationStop: 8 | - location: scripts/stop_server.sh 9 | timeout: 300 10 | runas: root 11 | 12 | AfterInstall: 13 | - location: scripts/after_install.sh 14 | timeout: 300 15 | runas: root 16 | 17 | BeforeInstall: 18 | - location: scripts/install_dependencies.sh 19 | timeout: 300 20 | runas: root 21 | 22 | ApplicationStart: 23 | - location: scripts/start_server.sh 24 | timeout: 300 25 | runas: root 26 | 27 | ValidateService: 28 | - location: scripts/validate_service.sh 29 | timeout: 300 30 | 31 | -------------------------------------------------------------------------------- /buildspec.yml: -------------------------------------------------------------------------------- 1 | version: 0.2 2 | 3 | phases: 4 | install: 5 | runtime-versions: 6 | nodejs: 10 7 | commands: 8 | - echo "installing something" 9 | pre_build: 10 | commands: 11 | - echo "pre build phase" 12 | build: 13 | commands: 14 | - echo "we will run some tests and build" 15 | - grep -i LW index.html 16 | post_build: 17 | commands: 18 | - echo "post build phase" 19 | 20 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | Welcome to LW !! 2 | -------------------------------------------------------------------------------- /scripts/after_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | chmod 664 /var/www/html/index.html 4 | -------------------------------------------------------------------------------- /scripts/install_dependencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | yum install -y httpd 3 | 4 | -------------------------------------------------------------------------------- /scripts/start_server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | service httpd start 3 | 4 | -------------------------------------------------------------------------------- /scripts/stop_server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | isExistApp = `pgrep httpd` 3 | if [[ -n $isExistApp ]]; then 4 | service httpd stop 5 | fi 6 | 7 | -------------------------------------------------------------------------------- /scripts/validate_service.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # verify we can access our webpage successfully 4 | curl -v --silent localhost:80 2>&1 | grep -i LW 5 | --------------------------------------------------------------------------------