Code Monkey home page Code Monkey logo

garden-of-intelligence's Introduction

garden-of-intelligence

Personal project

Requirements

To access the AWS from your local machine you have to configure the AWS CLI [documentation] https://doc.babbel.com/lessonnine/guides.doc/tooling/aws.html#access-from-local-machine

Install Docker, open it and navigate to Settings --> Resources and increase the memory value to 4 GB, if the default value is higher than 4GB, you can leave as is.

Install terraform version manager

Docker

To spin up the Docker containers run:

docker-compose up -d

To stop containers

docker-compose down

To rebuild containers

docker-compose build --no-cache

The app will start on port 3000

Running commands

If you run the commands from the local machine terminal prefix them with docker-compose exec app.

Run the tests as follows:

bundle exec rspec

Run the linters

bundle exec rubocop
bundle exec rubocop -A

Run rails console:

bundle exec rails console

Terraform CLI

terraform validate Check whether the configuration is valid // also done by plan & apply

terraform fmt Reformat your configuration in the standard style => pre-commit hook

terraform show Show the current state or a saved plan

terraform plan creates an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructure. By default, when Terraform creates a plan it:

  • Check whether the configuration is valid
  • Reads the current state of any already-existing remote objects to make sure that the Terraform state is up-to-date.
  • Compares the current configuration to the prior state and noting any differences.
  • Proposes a set of change actions that should, if applied, make the remote objects match the configuration.

terraform apply performs a plan just like terraform plan does, but then actually carries out the planned changes to each resource using the relevant infrastructure provider's API. It asks for confirmation from the user before making any changes, unless it was explicitly told to skip approval.

  • Check whether the configuration is valid

Deploy code via CI

Whenever there's a push on the production-branch it will automatically build a docker image, push it to ECR and auto-deploy on the AWS Apprunner. If you want to test your changes on production just merge them to the deployment-branch. Whenever you merge your PR to main you can also merge your changes into the production-branch.

For deployment logs check the AWS Apprunner in the sandbox account.

Deploy code from local machine

You can get the ecr_repository_url with

terraform output

Then you have to run the following commands. Don't forget to replace ecr_repository_url by the value you received before

aws ecr get-login-password --region eu-west-1 --profile sandbox | docker login --username AWS --password-stdin <ecr_repository_url>

docker buildx build --platform=linux/amd64 -t garden-of-intelligence-app .

docker tag garden-of-intelligence-app:latest <ecr_repository_url>:latest

docker push <ecr_repository_url>:latest

By pushing a new image the Apprunner will automatically deploy the new image. You can get the service_url with:

terraform output

garden-of-intelligence's People

Contributors

drewmoore avatar vjmueller 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.