Giter VIP home page Giter VIP logo

terraform-laravel-ecs's Introduction

https://github.com/hansungingang/capstone/tree/main/terraformcode you can see here.

This is the terraform laravel redis elasticache ecs ec2 autoscaling rds and blue green codepipeline (codecommit, codebuild, codedeploy)

First, you should have a bash aws installed if you are on windows 10 to execute local-exec.

You make new laravel app with any name in the terraform folder.
You copy app/config/appspec.yml , app/config/buildspec.yml, app/scripts/create-new-task-def.sh into the laravel root folder.

Make new laravel (if you have a composer installed)
docker run --rm -v ${PWD}:/app composer create-project --prefer-dist laravel/laravel blog

For local file(in the laravel root folder)
docker run --rm -v ${PWD}:/app composer require laravel/ui
docker run --rm -v ${PWD}:/app -w /app npmjs/npm-docker-baseline:12-alpine /bin/bash -c "npm install; npm run dev"
docker run --rm -v ${PWD}:/app -w /app npmjs/npm-docker-baseline:8-alpine /bin/bash -c "npm install; npm run dev"
docker-compose exec app php artisan migrate
docker run --rm -v ${PWD}:/app composer install
docker run --rm -v ${PWD}:/app composer dump-autoload

docker system prune ( to clear all dockers,  if you already have a same volume, you might get an error)
docker build -t docker/nginx -f .\docker\nginx\Dockerfile .
docker build -t docker/laravel -f .\docker\php-fpm\Dockerfile . --progress=plain (to see ls -al)
docker-compose up

You also have to change fargate-service "APP_KEY" value with your app_key on .env
and set your own rds password and username

and .env you change AWS Confidentails with yours.

For terraform (in the terraform folder) 
terraform init
terraform plan
terraform apply

Delete terraform
terraform delete --auto-approve
(if you have an error to delete , you should manually delete everything else on aws.)

After codepipeline is installed
1. cd laravelfolder
2. git remote add origin ssh://git-codecommit.ap-northeast-2.amazonaws.com/v1/repos/laravel
3. git remote -v (to check the url)
4. git add .
5. git commit -m 'first commit'
6. git push -u origin master


Then the server is all set!

You can access to the web server with the load balancer DNS name after code deploy is finished.

I used 
https://www.udemy.com/course/aws-ecs-devops-masterclass/
https://www.udemy.com/course/learn-devops-infrastructure-automation-with-terraform/
https://github.com/imunew/laravel-ecs-demo/blob/master/docker-compose.yml
https://www.youtube.com/watch?v=_EG6ytpIbAI&list=PLqbAIRubjG2VwWVPX4lobDQZGLDCZZ0z1&index=13
https://www.youtube.com/watch?v=7-9tvgkm_9k&list=PLqbAIRubjG2VwWVPX4lobDQZGLDCZZ0z1&index=15
https://www.youtube.com/watch?v=nuZp8qYti2M&list=PLqbAIRubjG2VwWVPX4lobDQZGLDCZZ0z1&index=11

terraform-laravel-ecs's People

Contributors

sunggun1 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.