Code Monkey home page Code Monkey logo

Comments (6)

nickredmark avatar nickredmark commented on June 20, 2024

It should be possible. Are you familiar with docker-compose? Then perhaps you could start from here https://github.com/nmaro/ooth/blob/master/examples/standalone/docker-compose.yml

from ooth.

xiangjunhuang avatar xiangjunhuang commented on June 20, 2024

Thanks @nmaro ! I'm not a intensive user on docker-compose, but I see a good tool Kompose(http://kompose.io/) might help bridge the gap, will give a try soon! Thx!

from ooth.

nickredmark avatar nickredmark commented on June 20, 2024

Here would be another example (with next.js) I just created yesterday: https://github.com/nmaro/staart/tree/master/examples/staart

from ooth.

xiangjunhuang avatar xiangjunhuang commented on June 20, 2024

Thanks @nmaro! I was able to deploy previously mentioned standalone example in my kubernetes cluster, but I haven't figure out the how to get it properly hooked up with my api-gateway: ambassador (https://www.getambassador.io). Feel that I need to update the logic in api part to make it fit ambassador's need. Right?

from ooth.

nickredmark avatar nickredmark commented on June 20, 2024

Yes. Question: are you going to run the api on a different domain? Then you will need JWT. Otherwise I'd recommend working with sessions (this is my preferred solution, in the staart example I use a reverse proxy to keep everything together)... If you work with sessions you can just hook all services to the same session storage (e.g. redis, I did this in the staart example). If you work with JWT you will need to extend your API for auth with JWT, e.g. like here: https://github.com/nmaro/ooth/blob/master/examples/standalone/api/index.js#L47

from ooth.

braytonstafford avatar braytonstafford commented on June 20, 2024

Here are yaml files I created based on the standalone example for the API and ooth. These will create a kubernetes service and deployment for the API and ooth.

Hopefully these can be helpful

api.yaml

apiVersion: v1
kind: Service
metadata:
  name: yourapp-api
  labels:
    app: yourapp-api
spec:
  type: NodePort
  ports:
    - port: 3002
  selector:
    app: yourapp-api
---
apiVersion: 'extensions/v1beta1'
kind: 'Deployment'
metadata:
  name: 'yourapp-api'
spec:
  replicas: 1
  selector:
    matchLabels:
      app: 'yourapp-api'
  template:
    metadata:
      labels:
        app: 'yourapp-api'
    spec:
      containers:
        - name: 'yourapp-api'
          image: 'yourapp-api:latest'
          imagePullPolicy: 'Always'
          ports:
            - containerPort: 3002
              name: yourappapi-port
          env:
            - name: NODE_ENV
              value: 'development'
            - name: URL
              value: 'https://api.EXAMPLE.com'
            - name: PORT
              value: '3002'
            - name: ORIGIN_URL
              value: '*'
            - name: MONGO_URL
              value: 'mongodb://MONGOUSER_USERNAME:MONGOUSER_PASSWORD@MONGOSERVER:27017/MONGOCOLLECTION'
            - name: SHARED_SECRET
              value: 'A-SUPER-SECRET-SECRET'
            - name: SESSION_SECRET
              value: 'ANOTHER-SUPER-SECRET-SECRET'

ooth.yaml

apiVersion: v1
kind: Service
metadata:
  name: yourapp-ooth
  labels:
    app: yourapp-ooth
spec:
  type: NodePort
  ports:
    - port: 3001
  selector:
    app: yourapp-ooth
---
apiVersion: 'extensions/v1beta1'
kind: 'Deployment'
metadata:
  name: 'yourapp-ooth'
spec:
  replicas: 1
  selector:
    matchLabels:
      app: 'yourapp-ooth'
  template:
    metadata:
      labels:
        app: 'yourapp-ooth'
    spec:
      containers:
        - name: 'yourapp-ooth'
          image: 'yourapp-ooth:latest'
          imagePullPolicy: 'Always'
          ports:
            - containerPort: 3001
              name: yourapp-ooth
          env:
            - name: NODE_ENV
              value: 'development'
            - name: URL
              value: 'https://ooth.EXAMPLE.com'
            - name: PORT
              value: '3001'
            - name: ORIGIN_URL
              value: '*'
            - name: MONGO_URL
              value: 'mongodb://MONGOUSER_USERNAME:MONGOUSER_PASSWORD@MONGOSERVER:27017/MONGOCOLLECTION'
            - name: MAIL_FROM
              value: '[email protected]'
            - name: MAIL_SITE_NAME
              value: 'Your App'
            - name: MAIL_URL
              value: 'https://mg.EXAMPLE.com'
            - name: MAILGUN_API_KEY
              value: 'YOUR_MAILGUN_API_KEY'
            - name: MAILGUN_DOMAIN
              value: 'YOUR_MAILGUN_DOMAIN'
            - name: SHARED_SECRET
              value: 'A-SUPER-SECRET-SECRET'
            - name: SESSION_SECRET
              value: 'ANOTHER-SUPER-SECRET-SECRET'

from ooth.

Related Issues (20)

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.