From 46866b22e075a84d1b7125d652627eb2e379bb0b Mon Sep 17 00:00:00 2001 From: Timothy Chung Date: Sat, 5 Mar 2016 13:09:33 -0500 Subject: [PATCH 1/5] Added Dockerfile that cache npm install --- Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..d9ec5dad49 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM node:4.3.2 +ADD package.json /src/package.json +RUN cd /src && npm install +ADD . /src +WORKDIR /src +CMD ["npm", "run", "dashboard"] From f0fc52cbdcd55262ecbfe06b6449400cda3f1e82 Mon Sep 17 00:00:00 2001 From: Timothy Chung Date: Sat, 5 Mar 2016 13:20:47 -0500 Subject: [PATCH 2/5] Added documentation for Docker --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 2f0d942b23..291f0055f1 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,24 @@ If you want to require a username and password to access the dashboard, you can HTTPS and Basic Auth are mandatory if you are accessing the dashboard remotely instead of accessing it from `localhost`. +## Run with Docker + +It is easy to use it with Docker. First build the image: + + docker build -t parse-dashboard . + +Run the image with your ``config.json`` mounted as a volume + + docker run -d -p 8080:4040 -v host/path/to/config.json:/src/Parse-Dashboard/parse-dashboard-config.json parse-dashboard + +The container will boot up using the default command ``npm run dashboard`` + +However, you can run custom command as well (see ``Deploying in production`` for custom setup) + + docker run -d -p 8080:4040 -v host/path/to/config.json:/src/Parse-Dashboard/parse-dashboard-config.json parse-dashboard npm start -- --allowInsecureHTTP=1 + +If you are not familiar with Docker, ``npm start -- --allowInsecureHTTP=1`` is the custom command. + ## Deploying in production If you're deploying to a provider like Heroku, or Google App Engine, the SSL endpoint is terminated early and handled by the provider and you may encounter this error `Parse Dashboard can only be remotely accessed via HTTPS`. From 00e663c7c10e998adda73011379e8b7c3e481182 Mon Sep 17 00:00:00 2001 From: Timothy Chung Date: Sat, 5 Mar 2016 13:25:54 -0500 Subject: [PATCH 3/5] Formatted README --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 291f0055f1..394f9502bc 100644 --- a/README.md +++ b/README.md @@ -81,19 +81,24 @@ HTTPS and Basic Auth are mandatory if you are accessing the dashboard remotely i ## Run with Docker It is easy to use it with Docker. First build the image: - - docker build -t parse-dashboard . + +``` +docker build -t parse-dashboard . +``` Run the image with your ``config.json`` mounted as a volume - docker run -d -p 8080:4040 -v host/path/to/config.json:/src/Parse-Dashboard/parse-dashboard-config.json parse-dashboard +``` +docker run -d -p 8080:4040 -v host/path/to/config.json:/src/Parse-Dashboard/parse-dashboard-config.json parse-dashboard +``` The container will boot up using the default command ``npm run dashboard`` However, you can run custom command as well (see ``Deploying in production`` for custom setup) - docker run -d -p 8080:4040 -v host/path/to/config.json:/src/Parse-Dashboard/parse-dashboard-config.json parse-dashboard npm start -- --allowInsecureHTTP=1 - +``` +docker run -d -p 8080:4040 -v host/path/to/config.json:/src/Parse-Dashboard/parse-dashboard-config.json parse-dashboard npm start -- --allowInsecureHTTP=1 +``` If you are not familiar with Docker, ``npm start -- --allowInsecureHTTP=1`` is the custom command. ## Deploying in production From ea96b0c67d5f7837fbdcc5ca5bf81c50056460b3 Mon Sep 17 00:00:00 2001 From: Timothy Chung Date: Sat, 5 Mar 2016 15:14:24 -0500 Subject: [PATCH 4/5] Updated README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 394f9502bc..21fcb57e9b 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,9 @@ docker run -d -p 8080:4040 -v host/path/to/config.json:/src/Parse-Dashboard/pars The container will boot up using the default command ``npm run dashboard`` -However, you can run custom command as well (see ``Deploying in production`` for custom setup) +However, you can run custom command as well (see ``Deploying in production`` for custom setup). + +In this example, we want to run the custom command without HTTPS, which is necessary if you are developing using docker on Mac since docker does not run on localhost. ``` docker run -d -p 8080:4040 -v host/path/to/config.json:/src/Parse-Dashboard/parse-dashboard-config.json parse-dashboard npm start -- --allowInsecureHTTP=1 From 4024873219639f24b7c327c7061a2236b1b02610 Mon Sep 17 00:00:00 2001 From: Timothy Chung Date: Sat, 5 Mar 2016 15:37:30 -0500 Subject: [PATCH 5/5] Updated Dockerfile to use ENTRYPOINT with production ready command and updated README --- Dockerfile | 2 +- README.md | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index d9ec5dad49..382e9fb739 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,4 +3,4 @@ ADD package.json /src/package.json RUN cd /src && npm install ADD . /src WORKDIR /src -CMD ["npm", "run", "dashboard"] +ENTRYPOINT ["npm", "start", "--"] \ No newline at end of file diff --git a/README.md b/README.md index 21fcb57e9b..1df8064cf3 100644 --- a/README.md +++ b/README.md @@ -92,16 +92,15 @@ Run the image with your ``config.json`` mounted as a volume docker run -d -p 8080:4040 -v host/path/to/config.json:/src/Parse-Dashboard/parse-dashboard-config.json parse-dashboard ``` -The container will boot up using the default command ``npm run dashboard`` +By default, the container will start the app at port 4040 inside the container. However, you can run custom command as well (see ``Deploying in production`` for custom setup). -However, you can run custom command as well (see ``Deploying in production`` for custom setup). - -In this example, we want to run the custom command without HTTPS, which is necessary if you are developing using docker on Mac since docker does not run on localhost. +In this example, we want to run the application in production mode at port 80 of the host machine. ``` -docker run -d -p 8080:4040 -v host/path/to/config.json:/src/Parse-Dashboard/parse-dashboard-config.json parse-dashboard npm start -- --allowInsecureHTTP=1 +docker run -d -p 80:8080 -v host/path/to/config.json:/src/Parse-Dashboard/parse-dashboard-config.json parse-dashboard --port 8080 ``` -If you are not familiar with Docker, ``npm start -- --allowInsecureHTTP=1`` is the custom command. + +If you are not familiar with Docker, ``--port 8080`` with be passed in as argument to the entrypoint to form the full command ``npm start -- --port 8080``. The application will start at port 8080 inside the container and port ``8080`` will be mounted to port ``80`` on your host machine. ## Deploying in production