Coder Social home page Coder Social logo

microgram-feed's Introduction

microgram-auth

Auth service for the microgram project as part of Udacity's course.

Root project resides at https://github.com/oswaldoferreira/microgram.

Development

Setup a .env file:

POSTGRES_USERNAME=<change>
POSTGRES_PASSWORD=<change>
POSTGRES_HOST=<change>
POSTGRES_DB=<change>
JWT_SECRET=<change>
CORS_ORIGIN=http://localhost:4200 # if not modified at the front-end project

Run locally:

docker build -t microgram-auth .
docker run -p 5000:5000 microgram-auth:latest

› curl localhost:5000
/api/v0/%

Kubernetes example

The deployment.yml. The infrastructure bit creation is up to the platform being used (e.g. AWS EKS):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: microgram-auth
spec:
  replicas: 1
  selector:
    matchLabels:
      app: microgram-auth
  template:
    metadata:
      labels:
        app: microgram-auth
    spec:
      containers:
        - name: microgram-auth-app
          image: <remote>/microgram-auth:latest
          imagePullPolicy: Always
          env:
          - name: POSTGRES_USERNAME
            value: <change>
          - name: POSTGRES_PASSWORD
            value: <change>
          - name: POSTGRES_HOST
            value: <change>
          - name: POSTGRES_DB
            value: <change>
          - name: JWT_SECRET
            value: <change>
          - name: AWS_ACCESS_KEY_ID
            value: <change>
          - name: AWS_SECRET_ACCESS_KEY
            value: <change>
          - name: CORS_ORIGIN
            value: <change>
          ports:
            - name: web
              containerPort: 5000
              protocol: TCP

The service.yml with a simple load balancer. The infrastructure bit creation is up to the platform being used (e.g. AWS ELB).

apiVersion: v1
kind: Service
metadata:
  name: microgram-auth-lb-svc
spec:
  selector:
    app: microgram-auth
  type: LoadBalancer
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: web

Apply both to the Kubernetes cluster:

kubectl apply -f deployment.yml
kubectl apply -f load_balancer.yml

› kubectl get pods
NAME                              READY   STATUS    RESTARTS   AGE
microgram-auth-84689bbdb9-6jfzm   1/1     Running   0          14h

microgram-feed's People

Contributors

waldofe avatar

Watchers

 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.