How to transform my docker-compose to render.yaml

Hey guys, I’m trying to deploy my application to render, but I’m not getting anything. I have already spent a very, very long time, I need help!
My project contains docker-compose. I have already found information that render does not support docker compose. I am trying to create a render.yaml file. But it doesn’t work for me, can you tell me what I’m doing wrong?

If I use a Dockerfile for both the frontend and the API, do I have to specify docker in the env? (I suspect not)

project-repo

services:
  - type: web
    env: node
    name: backend
    repo: https://github.com/szx231/ship-paralect-root
    buildFilter:
      paths:
        - apps/api/**
    buildCommand: npm && npm build --filter=backend
    startCommand: cd apps/api; npm start
    envVars:
      - key:  DATABASE_URL
        fromDatabase:
          name: backend
          property: connectionString

  - type: web
    env: static
    name: frontend
    repo: https://github.com/szx231/ship-paralect-root
    buildFilter:
      paths:
        - apps/web/**
    buildCommand: npm && npm build --filter=frontend
    staticPublishPath: ./apps/web/build
    routes:
      - type: rewrite
        source: /*
        destination: /index.html

databases:
  - name: backend



Hi,

When you say it “doesn’t work”, please could you elaborate on that? Clicking into each “sync” under a Blueprint will show what happened, is the Blueprint itself throwing an error? Or is a deploy failing on one of the services? etc.

A few notes on your render.yaml:

  • npm, as a command on its own, does nothing. Maybe you mean npm install

  • Additionally, running a script usually looks like npm run build

  • The Root Directory setting may be useful for your monorepo (docs). With that set, you could likely remove the buildFilters, any directory traversal (cd), and the --filter options (which I’m not sure is an npm option).

  • type: mongodb is not valid. The valid service types are documented here: Blueprint Specification - Services. If you’re looking to run a MongoDB instance on Render, you’ll need a Private Service (pserv), using the MongoDB Docker image, and a Disk. A standalone example is also covered in the docs Deploy MongoDB

  • fromDatabase: in an env var block should reference a Render database instance, if you’re trying to set a Firebase config, you’ll need to do that manually (sync: false)

  • databases: is for Render Postgres instances only Blueprint Specification - Databases

  • I suggest you also at least set these on each service so that you are aware of pricing and where the service will be provisioned:

Kind regards

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.