diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..c1329dd6c --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,45 @@ +version: 2 +jobs: + build: + docker: + - image: circleci/node:11 + steps: + - checkout + + # Download and cache dependencies + - restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + + - run: yarn install + + - save_cache: + paths: + - node_modules + key: v1-dependencies-{{ checksum "package.json" }} + + # run tests! + - run: yarn test + deploy: + docker: + - image: buildpack-deps:trusty + steps: + - checkout + - run: + name: Deploy Master to Heroku + command: | + git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git master + +workflows: + version: 2 + build-deploy: + jobs: + - build + - deploy: + requires: + - build + filters: + branches: + only: master \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..9a6c211be --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM node:11 +WORKDIR /dist +COPY package.json /dist +RUN npm install +COPY . /dist +CMD node server.js +EXPOSE 4000 \ No newline at end of file diff --git a/assets/drewpoo99-circleci-failed.png b/assets/drewpoo99-circleci-failed.png new file mode 100644 index 000000000..edefc7f1c Binary files /dev/null and b/assets/drewpoo99-circleci-failed.png differ diff --git a/labreports/LAB_drewpoo99.md b/labreports/LAB_drewpoo99.md new file mode 100644 index 000000000..961de74a6 --- /dev/null +++ b/labreports/LAB_drewpoo99.md @@ -0,0 +1,23 @@ +# Lab Report Template for CIS411_Lab2 +Course: Messiah College CIS 411, Fall 2018 + +Instructors: [Joel Worrall](https://github.com/tangollama) & [Trevor Bunch](https://github.com/trevordbunch) + +Name: YOUR NAME + +GitHub: [@drewpoo99](https://github.com/drewpoo99) + +# Required Content + +[x] 1. Generate a markdown file in the labreports directoy named LAB_[GITHUB HANDLE].md. Write your lab report there. +[x] 2. Create the directory ```./circleci``` and the file ```.circleci/config.yml``` in your project and push that change to your GitHub repository. +[x] 3. Create the file ```Dockerfile``` in the root of your project and include the contents of the file as described in the instructions. Push that change to your GitHub repository. +[x] 4. Write the URL of your running Heroku app here: ```http://cis411lab2-drewpoo99.herokuapp.com/graphql``` +[x]5. ![image](https://github.com/drewpoo99/cis411_lab2/blob/master/assets/drewpoo99-circleci-failed.png) +[x]7. Submit a Pull Request to cis411_lab2 and provide the URL of that Pull Request in Canvas as your URL submission. + +## Questions +1. Why would a containerized version of an application be beneficial if you can run the application locally already? + Containerization allows for the app to be scalable for users without wasting resources. If lots of users want to use the app at once, more containers can be replicated to serve those users, then when they are done using the app those containers can be turned off so the resources aren't being used for nothing. +2. If we have the ability to publish directory to Heroku, why involve a CI solution like CircleCI? What benefit does it provide? + CI is important because it allows us to set up tests and other functions when deploying to make sure our app is able to function and get deployed well. It can act as a saftey net when we deploy because depending on the automated testing that we have set up, it can let us know when an update to the repository is not working with currently deployed software. CI can do lots of other things too, I'm sure. diff --git a/package-lock.json b/package-lock.json index 485e285fb..f72acc3a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2857,6 +2857,7 @@ "version": "0.1.4", "bundled": true, "dev": true, + "optional": true, "requires": { "kind-of": "^3.0.2", "longest": "^1.0.1", @@ -3181,7 +3182,8 @@ "is-buffer": { "version": "1.1.6", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "is-builtin-module": { "version": "1.0.0", @@ -3265,6 +3267,7 @@ "version": "3.2.2", "bundled": true, "dev": true, + "optional": true, "requires": { "is-buffer": "^1.1.5" } @@ -3311,7 +3314,8 @@ "longest": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "lru-cache": { "version": "4.1.3", @@ -3577,7 +3581,8 @@ "repeat-string": { "version": "1.6.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "require-directory": { "version": "2.1.1",