Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Can anyone share how they setup their CI/CD pipeline with payload

default discord avatar
techinverted2 years ago
2

I'm deploying my first production ready project in a few days. Would love to better optimise my current pipeline

  • default discord avatar
    chris_toxicness2 years ago

    Did you made project dockerized?

  • default discord avatar
    hades2000822 years ago

    In my most recent deployment, I used DevOps Pipelines deploying to Azure App Services with a MongoDB Atlas instance from the Azure Marketplace.



    I created a new Dockerfile for each environment (dev, qa, uat, production).



    In each Dockerfile, I added a line before the npm install

    ENV PAYLOAD_PUBLIC_SERVER_URL=https://myserver.com

    (different URL in each reflecting the environment's URL.



    In my Payload Config, I use the environment variable to set the

    serverUrl

    property.



    Note: This could also have been achieved using .env.<environment-name> files and a single Dockerfile.

    In my DevOps

    azure-pipelines.yml

    file I use variables to determine which Dockerfile to use depending on which git branch triggered the pipeline.



    I build and publish the relevant Dockerfile to an Azure Container Registry.



    The Azure App Services were created as Docker app services and are deployed from the Azure Container Registry, re-deploying via webhook whenever the associated docker image is updated.



    I found this was the only way to get it working in Azure App Services due to the fact that the

    PAYLOAD_PUBLIC_*

    variables need to be present at

    build time

    so they are passed to the admin app, and a bug in Kudu ZipDeploy that breaks

    node_modules/.bin

    symlinks preventing any kind of

    npm build

    on the app service itself. (

    npm rebuild

    also doesn't work on app services due to file permissions)



    I've opened a discussion at

    https://github.com/payloadcms/payload/discussions/2288

    to talk about improving the Payload documentation in regards to production deployments and CI/CD.

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.