Skip to content

JoshRagem/el_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EL Demo

A simple Phoenix API that does a list and show of World Heritage Centre sites, sites stored in postgres, and the whole thing running on docker containers and AWS ECS.

Reasoning

I'm very familiar with postgres and terraform and I'm new to Phoenix. I elected to put minimal features into the API so that I could show off more of my experience in pg, docker, and terraform. Each of the directories in this repo has a more detailed README about the relevant topics.

Overview

                     ┌───────────────────────────┐                       
                     │      Github container     │                       
   push release img  │      registry             │                       
────────────────────►│                           │                       
                     │                           │                       
                     └────────────────┬──────────┘                       
            │                         │                                  
            │                         │                                  
         ALB│                         │                                  
            │                         │                                  
            │        ┌────────────────▼───────────┐                      
            │        │   ECS                      │                      
            │        │  ┌──────────────────────┐  │                      
            │        │  │  Target Group        │  │                      
            │        │  │                      │  │                      
            │        │  │   ┌──────────────┐   │  │     ┌───────────────┐
            │        │  │   │  Phoenix API │   │  │     │  Postgres RDS │
            │        │  │   │  (container) │   │  │     │               │
    GET     │        │  │   │              │   │  │     │               │
  ──────────┼────────│──┼───► /api         ◄───┼──│─────►               │
            │        │  │   │  /whcsites   │   │  │     │               │
            │        │  │   │   /:id       │   │  │     │               │
            │        │  │   │              │   │  │     │               │
            │        │  │   │ /healthz     │   │  │     │               │
            │        │  │   │              │   │  │     │               │
            │        │  │   └───────────▲──┘   │  │     └─────▲─────────┘
            │        │  │               │      │  │           │          
            │        │  └───────────────┼──────┘  │           │          
            │        │                  │         │           │          
            │        │                  │         │           │          
            │        └──────────────────┼─────────┘           │          
            │                           ▲                     │          
            │                           │                     │          
            │                 ┌─────────┼─────────────────────┼─┐        
                              │      Secrets Manager            │        
                              │       - secret key base         │        
                              │       - db password             │        
                              │                                 │        
                              └─────────────────────────────────┘        

Containers

Locally, two containers:

  • api
  • postgres

The postgres conatiner uses the official postgres image with some .sql files mounted into the initdb directory. A container healthcheck on the database allows the api container to wait until the db is healthy before starting and trying to connect.

The api image is build from a Dockerfile generated by the Phoenix release tooling. In docker-compose.yaml, the local "dev" api container targets a build stage in the dockerfile that has installed all the deps and can be run in the same way as a non-containerized elixir project. For convenience, there is an api-release service in docker compose that uses the final build stage in from the dockerfile that is a prod-ready release. This release image is pushed to github container registry for ECS to pull down later.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published