Deploy multiple services

**Describe the issue **:
I want to deploy my frontend + backend on akash to try the platform and learn something! i already downloaded Akashlytics Deploy and successfully deploy my first container on akash! i have two question for you:

  1. my frontend need to call my backend of course, during local development with docker my frontend can call my backend at localhost:3000, but on akash it did not work, how can i call my backend from my frontend?
  2. why can’t i open adminer from my web browser? i can see that the lease give me a port (http://cluster.provider-0.prod.sjc1.akash.pub:31364/), but chrome says to me ERR_CONNECTION_TIMED_OUT

**Account address **:
akash1sqgvrsv74kkthqt0dgaqr9zs6quxpgyhp0cac9

**Your deploy.yaml file **:

---
version: "2.0"

services:
  backend:
    image: <backend-image>
    depends-on: postgres
    expose:
      - port: 3000
        to:
          - service: admin-dashboard

  admin-dashboard:
    image: <dashboard-image>
    depends-on: backend
    expose:
      - port: 80
        to:
          - global: true

  postgres:
    image: postgres
    expose:
      - port: 5432
        to:
          - service: backend
          - service: adminer

  adminer:
    image: adminer
    depends-on: postgres
    expose:
      - port: 8080
        as: 13356
        to:
          - global: true
profiles:
  compute:
    backend:
      resources:
        cpu:
          units: 0.2
        memory:
          size: 512Mi
        storage:
          size: 512Mi
    admin-dashboard:
      resources:
        cpu:
          units: 0.2
        memory:
          size: 512Mi
        storage:
          size: 512Mi
    postgres:
      resources:
        cpu:
          units: 0.2
        memory:
          size: 512Mi
        storage:
          size: 512Mi
    adminer:
      resources:
        cpu:
          units: 0.2
        memory:
          size: 512Mi
        storage:
          size: 512Mi
  placement:
    dcloud:
      attributes:
        host: akash
      signedBy:
        anyOf:
          - "akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63"
      pricing:
        backend:
          denom: uakt
          amount: 100
        admin-dashboard:
          denom: uakt
          amount: 100
        postgres:
          denom: uakt
          amount: 100
        adminer:
          denom: uakt
          amount: 100
deployment:
  backend:
    dcloud:
      profile: backend
      count: 1
  admin-dashboard:
    dcloud:
      profile: admin-dashboard
      count: 1
  postgres:
    dcloud:
      profile: postgres
      count: 1
  adminer:
    dcloud:
      profile: adminer
      count: 1

**Do you have more than one deployment group? **:
I have 4 group

Thanks to all!

1 Like

For question 1:
I think maybe you should use nginx to reverse proxy your backend and frontend,this could make them in the same domain.
For example:
route backend in uri /api and route front end in the other uri
in this way, the frontend could visit backend with the uri /api without any domain, because they are in the same domain.

For question 2:
I think it may be affected by the above question.

  1. How do you call your backend from the frontend? Is there a fetch where it still tries to connect to localhost:3000?
    If this is the case you could deploy the frontend and backend separately. Input the supplied url in your frontend then.
  2. Try to expose the port 3000 as 80