Search code examples
parse-platformopenstack

Parse Server on Openstack with multiple User accounts (alternative to back4app, Heroku)


I'm a student and at college we're trying to setup our own backend service for our applications, as Backend like Firebase would cost us more.

We settled up on using Openstack to combine and manage the compute resources of multiple computers together in our college Lab, but now we want to make a web portal where our students can login and use the parse server dashboard.

How to setup multiple parse instances for each user and what containers to use and how?


Solution

  • You can try with docker compose. You would need to write a docker-compose.yml file like this:

    version: '2'
    
    services:
      mongo-db:
        image: mongo
        ports:
          - 27017:27017
      parse-server1-user1:
        image: parseplatform/parse-server
        links:
          - mongo-db
        environment:
          - PARSE_SERVER_APPLICATION_ID=parse1-user1
          - PARSE_SERVER_MASTER_KEY=SOME_SECRET_MASTER1_USER1
          - PARSE_SERVER_DATABASE_URI=mongodb://mongo-db:27017/parse1-user1
        ports:
          - 1337:1337
      parse-server2-user1:
        image: parseplatform/parse-server
        links:
          - mongo-db
        environment:
          - PARSE_SERVER_APPLICATION_ID=parse2-user1
          - PARSE_SERVER_MASTER_KEY=SOME_SECRET_MASTER2_USER1
          - PARSE_SERVER_DATABASE_URI=mongodb://mongo-db:27017/parse2-user1
        ports:
          - 1338:1337
      parse-server1-user2:
        image: parseplatform/parse-server
        links:
          - mongo-db
        environment:
          - PARSE_SERVER_APPLICATION_ID=parse1-user2
          - PARSE_SERVER_MASTER_KEY=SOME_SECRET_MASTER1_USER2
          - PARSE_SERVER_DATABASE_URI=mongodb://mongo-db:27017/parse1-user2
        ports:
          - 1339:1337
      parse-server2-user2:
        image: parseplatform/parse-server
        links:
          - mongo-db
        environment:
          - PARSE_SERVER_APPLICATION_ID=parse2-user2
          - PARSE_SERVER_MASTER_KEY=SOME_SECRET_MASTER2_USER2
          - PARSE_SERVER_DATABASE_URI=mongodb://mongo-db:27017/parse2-user2
        ports:
          - 1340:1337
      parse-dashboard:
        image: parseplatform/parse-dashboard
        links:
          - parse-server1-user1
          - parse-server2-user1
          - parse-server1-user2
          - parse-server2-user2
        depends_on:
          - parse-server1-user1
          - parse-server2-user1
          - parse-server1-user2
          - parse-server2-user2
        environment:
          - PARSE_DASHBOARD_CONFIG={"apps":[{"appId":"parse1-user1","serverURL":"http://localhost:1337/parse","masterKey":"SOME_SECRET_MASTER1_USER1","appName":"parse1-user1"},{"appId":"parse2-user1","serverURL":"http://localhost:1338/parse","masterKey":"SOME_SECRET_MASTER2_USER1","appName":"parse2-user1"},{"appId":"parse1-user2","serverURL":"http://localhost:1339/parse","masterKey":"SOME_SECRET_MASTER1_USER2","appName":"parse1-user2"},{"appId":"parse2-user2","serverURL":"http://localhost:1340/parse","masterKey":"SOME_SECRET_MASTER2_USER2","appName":"parse2-user2"}],"users":[{"user":"user1","pass":"secret-pass1","apps":[{"appId":"parse1-user1"},{"appId":"parse2-user1"}]},{"user":"user2","pass":"secret-pass2","apps":[{"appId":"parse1-user2"},{"appId":"parse2-user2"}]}]}
          - PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=1
        ports:
          - 4040:4040
    

    Then run:

    docker-compose up -d