Skip to content

Payload CMS installation

Installing Payload CMS Locally and Restoring PostgreSQL Dump

Section titled “Installing Payload CMS Locally and Restoring PostgreSQL Dump”
  1. Unzip your Payload CMS project to a desired location, e.g.

    C:\Users\milan\Desktop\cosmus
  2. Install Dependencies. Open Command Prompt in the project folder and run:

    pnpm i
  3. Create PostgreSQL Database. Go to your PostgreSQL bin folder::

    cd "C:\Program Files\PostgreSQL\18\bin"
  4. Connect to PostgreSQL.

    psql -h 127.0.0.1 -U postgres

    Enter your password (postgres in this example) when prompted.

  5. Create the Database.

    CREATE DATABASE test1;
  6. Locate the backup file. Inside the main project folder, you will find the database backup file named:

    cosmus.backup
  7. Restore Database Dump Use pg_restore to load your backup file:

    pg_restore -d "postgres://postgres:postgres@127.0.0.1:5432/test1" "C:\Users\milan\cosmus.backup"
  8. Configure Payload CMS Set your PostgreSQL connection URL: inn .env

    DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/test1
    PAYLOAD_SECRET=your_secret_key
    PORT=3000
  9. Start Payload CMS Locally

    Open Command Prompt in your project folder.

    Run:

    pnpm dev
  10. Open a browser and go to:

    Run:

    http://localhost:3000/admin

    You should see the Payload CMS admin interface with your restored data.

  1. Upload the project files. First, upload the botify.zip file to your VPS using FTP, SCP, or your preferred file transfer method.

    scp main.zip root@your-server-ip:/var/www/
  2. Unzip the project once uploaded.

    cd /var/www/
    sudo unzip cosmus.zip -d cosmus
  3. Navigate to the project directory.

    cd /var/www/cosmus
  4. Update the .env file with the correct credentials and configuration values.

    NEXT_PUBLIC_SERVER_URL=http://localhost:3000
    DATABASE_URL=postgresql://myuser:mypassword@localhost:5432/my_database
    PAYLOAD_SECRET=e508b874afbf9bdb8d9778d7
    SMTP_HOST=
    SMTP_USER=
    SMTP_PASS=
    PAYLOAD_ENABLE_JOB_QUEUE=true
    WHATSAPP_API_KEY=
    PAYLOAD_DEV=false
    NODE_ENV=production
    ORGANIZATION_NAME=Cosmos Beauty Clinic
  5. Run the following command to install all project dependencies.

    pnpm i
  6. Execute the initial database migrations.

    pnpm migrate
  7. Start the application.

    pnpm start
  8. Keep your Node.js application running continuously in the background with PM2.

    pm2 start pnpm -- start

    Note: Click Here PM2 Installation

Note: Botify Docker installation requires an extended license. Please contact us for more details.

  1. Upload the project files to your VPS using FTP, SCP, or your preferred transfer method.

    scp cosmus.zip root@your-server-ip:/var/www/
  2. Unzip the project once uploaded.

    cd /var/www/
    sudo unzip cosmus.zip -d cosmus
  3. Navigate to the project directory.

    cd /var/www/cosmus
  4. Open the Dockerfile in the root directory and update it with the correct port and configuration settings.

    FROM node:20-alpine AS builder
    RUN npm install -g pnpm
    WORKDIR /app
    COPY package.json pnpm-lock.yaml ./
    RUN pnpm install --frozen-lockfile
    ENV DATABASE_URL=postgres://postgres:postgres@db:5432/cosmos
    ENV NEXT_PUBLIC_SERVER_URL=https://beauty.codenik.in
    ENV PAYLOAD_SECRET=secret
    ENV NODE_ENV=production
    ENV PAYLOAD_DISABLE_DB_PUSH=true
    COPY . .
    RUN pnpm build
    FROM node:20-alpine AS prod
    WORKDIR /app
    COPY --from=builder /app/.next/standalone ./
    COPY --from=builder /app/public ./public
    COPY --from=builder /app/.next/static ./.next/static
    EXPOSE 3000
    ENV PORT=3000
    ENV NODE_ENV=production
    ENV PAYLOAD_DISABLE_DB_PUSH=true
    CMD ["node", "server.js"]
  5. Open docker-compose.yml in the root directory and update it with the correct port and configuration settings.

    services:
    cosmos_payload:
    build: .
    container_name: cosmos_payload
    volumes:
    - ./public/uploads:/app/public/uploads
    ports:
    - "3000:3000"
    depends_on:
    - db
    restart: unless-stopped
    environment:
    NODE_ENV: production
    PAYLOAD_SECRET: secret
    PAYLOAD_DISABLE_DB_PUSH: "true"
    DATABASE_URL: postgres://postgres:postgres@db:5432/cosmos
    PAYLOAD_PUBLIC_SERVER_URL: https://beauty.codenik.in
    networks:
    - default-net
    db:
    image: postgres:15
    container_name: cosmos_db
    environment:
    POSTGRES_USER: postgres
    POSTGRES_PASSWORD: postgres
    POSTGRES_DB: cosmos
    ports:
    - "5432:5432"
    volumes:
    - postgres-data:/var/lib/postgresql/data
    networks:
    - default-net
    volumes:
    postgres-data:
    networks:
    default-net:
    driver: bridge
  6. Verify containers are running.

    sudo docker ps

    You should see containers for:

    • botify-web (Next.js app)
    • postgres
  7. Start the application using Docker.

    sudo docker compose up -d --build
  8. Access the application.

    http://yourdomain.com

    You will be automatically redirected to the onboarding page.

    Success

    Your Payload CMS cosmus template is now successfully installed and running in a secure, Dockerized environment.

  9. Create admin account.

    Onboarding

    Note: The first user typically has full administrative privileges and can create additional users and manage roles.