This article is the third in the series whose goal is to create a Docker-based web application. In this article, we will see how to add and configure Parse Dashboard.
You can read the previous articles from this page.
To add Parse Dashboard, we will start by creating a dashboard folder and creating the Dockerfile.
mkdir dashboard
cd dashboard
touch DockerfileAdd the following code to the Dockerfile:
FROM node:latest
ENV PARSE_DASHBOARD_VERSION 1.0.25
RUN npm install -g parse-dashboard@${PARSE_DASHBOARD_VERSION}
ENV PORT 4040
EXPOSE $PORT
CMD ["parse-dashboard"]Next, we will add the dashboard service to our docker-compose.yml file:
dashboard:
build: ./dashboard
container_name: "parse-dashboard"
environment:
PORT: 4040
PARSE_DASHBOARD_ALLOW_INSECURE_HTTP: "True"
PARSE_DASHBOARD_SERVER_URL: "http://localhost:1337/parse"
PARSE_DASHBOARD_MASTER_KEY: "master"
PARSE_DASHBOARD_APP_ID: "web-app-docker"
PARSE_DASHBOARD_APP_NAME: "Docker Web App"
PARSE_DASHBOARD_USER_ID: "user"
PARSE_DASHBOARD_USER_PASSWORD: "password"
ports:
- "4040:4040"As we did in the previous article for Parse Server, we start by indicating the Dockerfile path and naming the container:
build: ./dashboard
container_name: 'parse-dashboard'Next, we define the environment variables:
environment:
PORT: 4040
PARSE_DASHBOARD_ALLOW_INSECURE_HTTP: 'True'
PARSE_DASHBOARD_SERVER_URL: 'http://localhost:1337/parse'
PARSE_DASHBOARD_MASTER_KEY: 'master'
PARSE_DASHBOARD_APP_ID: 'web-app-docker'
PARSE_DASHBOARD_APP_NAME: 'Docker Web App'
PARSE_DASHBOARD_USER_ID: 'user'
PARSE_DASHBOARD_USER_PASSWORD: 'password'- PORT: Dashboard port
- PARSE_DASHBOARD_ALLOW_INSECURE_HTTP: By default, the dashboard is only accessible over HTTPS. This setting therefore makes it possible to access the dashboard over HTTP.
- PARSE_DASHBOARD_SERVER_URL: Parse server URL.
- PARSE_DASHBOARD_MASTER_KEY: Parse server master key.
- PARSE_DASHBOARD_APP_ID: Parse server app ID.
- PARSE_DASHBOARD_APP_NAME: Name that will be displayed in the dashboard for the Parse application.
- PARSE_DASHBOARD_USER_ID: Username used to log in.
- PARSE_DASHBOARD_USER_PASSWORD: Password used to log in.
And finally, we map the ports between the host machine and the container.
ports:
- '4040:4040'To finish, start the services:
docker-compose upGo to localhost:4040 and you should see the dashboard login page appear.
We are done configuring Parse Dashboard.
In the next article, we will add Next to this configuration.