From f036b0cf34f95ef3c51c08fc8cbdc2996c24749d Mon Sep 17 00:00:00 2001 From: Zach Hancock Date: Thu, 3 Jan 2019 16:50:49 -0500 Subject: [PATCH] move project run/setup to devstack --- Dockerfile | 29 ----------------------------- Makefile | 32 +++----------------------------- README.md | 12 ++++++------ config/webpack.dev.config.js | 4 ++-- docker-compose.yml | 20 -------------------- 5 files changed, 11 insertions(+), 86 deletions(-) delete mode 100755 Dockerfile delete mode 100755 docker-compose.yml diff --git a/Dockerfile b/Dockerfile deleted file mode 100755 index f1af01c..0000000 --- a/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -# Copied from https://github.com/BretFisher/node-docker-good-defaults/blob/master/Dockerfile - -FROM node:8.9.3 - -# Create app directory -RUN mkdir -p /edx/app - -ARG NODE_ENV=production -ENV NODE_ENV $NODE_ENV - -ARG PORT=80 -ENV PORT $PORT -EXPOSE $PORT 1991 - -WORKDIR /edx -# Install app dependencies -# A wildcard is used to ensure both package.json AND package-lock.json are copied -# where available (npm@5+) -COPY package*.json ./ - -# If you are building your code for production -# RUN npm install --only=production -RUN npm install -ENV PATH /edx/app/node_modules/.bin:$PATH - -WORKDIR /edx/app -COPY . /edx/app - -ENTRYPOINT npm install && npm run start diff --git a/Makefile b/Makefile index eaed283..24ab053 100755 --- a/Makefile +++ b/Makefile @@ -1,35 +1,9 @@ -shell: ## run a shell on the cookie-cutter container - docker exec -it edx.gradebook /bin/bash - -build: - docker-compose build - -up: ## bring up cookie-cutter container - docker-compose up - -up-detached: ## bring up cookie-cutter container in detached mode - docker-compose up -d - -logs: ## show logs for cookie-cutter container - docker-compose logs -f - -down: ## stop and remove cookie-cutter container - docker-compose down - -npm-install-%: ## install specified % npm package on the cookie-cutter container - docker exec npm install $* --save-dev +npm-install-%: ## install specified % npm package + npm install $* --save-dev git add package.json -restart: - make down - make up - -restart-detached: - make down - make up-detached - validate-no-uncommitted-package-lock-changes: git diff --exit-code package-lock.json test: - docker exec -it edx.gradebook jest + npm run test diff --git a/README.md b/README.md index 23beda1..e4836eb 100755 --- a/README.md +++ b/README.md @@ -21,20 +21,20 @@ npm i --save @edx/gradebook ## Running the UI Standalone -After cloning the repository, run `make up-detached` in the `gradebook` directory - this will build and start the `gradebook` web application in a docker container. +To install the project please refer to the [`edX Developer Stack`](https://github.com/edx/devstack) instructions. -The web application runs on port **1991**, so when you go to `http://localhost:1991/course-v1:edX+DemoX+Demo_Course` you should see the UI (assuming you have such a Demo Course in your devstack). Note that you always have to provide a course id to actually see a gradebook. +The web application runs on port **1994**, so when you go to `http://localhost:1994/course-v1:edX+DemoX+Demo_Course` you should see the UI (assuming you have such a Demo Course in your devstack). Note that you always have to provide a course id to actually see a gradebook. -If you don't, you can see the log messages for the docker container by executing `make logs` in the `gradebook` directory. +If you don't, you can see the log messages for the docker container by executing `make gradebook-logs` in the `devstack` directory. -Note that `make up-detached` executes the `npm run start` script which will hot-reload JavaScript and Sass files changes, so you should (:crossed_fingers:) not need to do anything (other than wait) when making changes. +Note that starting the container executes the `npm run start` script which will hot-reload JavaScript and Sass files changes, so you should (:crossed_fingers:) not need to do anything (other than wait) when making changes. ## Configuring for local use in edx-platform -Assuming you've got the UI running at `http://localhost:1991`, you can configure the LMS in edx-platform +Assuming you've got the UI running at `http://localhost:1994`, you can configure the LMS in edx-platform to point to your local gradebook from the instructor dashboard by putting this settings in `lms/env/private.py`: ``` -WRITABLE_GRADEBOOK_URL = 'http://localhost:1991' +WRITABLE_GRADEBOOK_URL = 'http://localhost:1994' ``` There are also several edx-platform waffle and feature flags you'll have to enable from the Django admin: diff --git a/config/webpack.dev.config.js b/config/webpack.dev.config.js index 5c42d5c..721f957 100755 --- a/config/webpack.dev.config.js +++ b/config/webpack.dev.config.js @@ -97,7 +97,7 @@ module.exports = Merge.smart(commonConfig, { }), new webpack.EnvironmentPlugin({ NODE_ENV: 'development', - BASE_URL: 'localhost:1991', + BASE_URL: 'localhost:1994', LMS_BASE_URL: 'http://localhost:18000', LOGIN_URL: 'http://localhost:18000/login', LOGOUT_URL: 'http://localhost:18000/login', @@ -120,7 +120,7 @@ module.exports = Merge.smart(commonConfig, { // reloading. devServer: { host: '0.0.0.0', - port: 1991, + port: 1994, historyApiFallback: true, hot: true, inline: true, diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100755 index 4f200cf..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,20 +0,0 @@ -version: "2" -services: - web: - build: - context: . - dockerfile: Dockerfile - args: - - NODE_ENV=development - container_name: edx.gradebook - image: edxops/front-end-cookie-cutter:latest - volumes: - - .:/edx/app:delegated - - notused:/edx/app/node_modules - ports: - - "1991:1991" - environment: - - NODE_ENV=development - -volumes: - notused: