Can I create db classes on parser fist run?

I’m using docker and docker-compose to easily setup parser-server for a project using the parseplatform/parse-server image.

So far everything runs perfectly and I can go and manually add the classes I need for the app via the parse-dashboard, but I would like to automate this.

Is there any way to pass a schema on parse first run to populate the database with the required classes? I’m keeping PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION as false.

Any ENV variables that I’m not aware of? Is the only alternative pulling the repo and building the image with some custom config?

As far my search went I can’t find any info on the subject. Parse seems to be a very powerful tool, but the docs tend to be very simplistic as far I’ve seen.

Thanks for any input/help.

docker-compose.yml

version: '3'

services:
  mongodb:
    image: mongo
    container_name: parse-mongo
    volumes:
      - ./mongodb:/data/db
    environment:
      - MONGO_INITDB_ROOT_USERNAME
      - MONGO_INITDB_ROOT_PASSWORD

  parse:
    image: parseplatform/parse-server
    container_name: parse-server
    ports:
      - 1337:1337
    links:
      - mongodb:mongo
    depends_on:
      - mongodb
    environment:
      - PARSE_SERVER_APPLICATION_ID
      - PARSE_SERVER_APP_NAME
      - PARSE_SERVER_MASTER_KEY
      - PARSE_SERVER_DATABASE_URI
      - PARSE_SERVER_MOUNT_GRAPHQL
      - PARSE_SERVER_MOUNT_PLAYGROUND
      - PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION

.env

# MONGO DB
MONGO_INITDB_ROOT_USERNAME=###
MONGO_INITDB_ROOT_PASSWORD=###

# PARSE SERVER
PARSE_SERVER_APPLICATION_ID=###
PARSE_SERVER_APP_NAME=###
PARSE_SERVER_MASTER_KEY=###
PARSE_SERVER_DATABASE_URI="mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@mongo:27017"
PARSE_SERVER_MOUNT_GRAPHQL=1
PARSE_SERVER_MOUNT_PLAYGROUND=1
PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION=0

Yes, you can create Cloud Code functions like the ones in my repo:

and then call them in the server index.js file after the server is created:

Feel free to look through the rest of the files/repo for suggestions. Note that this repo produces a docker image, so can definitely do it with docker: Docker Hub

Thanks a lot for the tip @cbaker6 . I guess a cloud-function to check the schema and create classes if they aren’t present is a good workaround for now.

I found in other post that a predefined schemas are coming for v. 5

Did you ever get all this working? I’m looking to do the same and would appreciate a reference that is working with predefined schemas.

thanks