diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..46c0e893e --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,46 @@ +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/heroku.PNG b/assets/heroku.PNG new file mode 100644 index 000000000..17d0d89f3 Binary files /dev/null and b/assets/heroku.PNG differ diff --git a/labreports/LAB.md b/labreports/LAB.md index 749a1046d..9f30cf7d0 100644 --- a/labreports/LAB.md +++ b/labreports/LAB.md @@ -3,20 +3,24 @@ Course: Messiah College CIS 411, Fall 2018 Instructors: [Joel Worrall](https://github.com/tangollama) & [Trevor Bunch](https://github.com/trevordbunch) -Name: YOUR NAME +Name: Luke Meads + +GitHub: [lukemeads3](https://github.com/YOUR_HANDLE) -GitHub: [YOUR_HANDLE](https://github.com/YOUR_HANDLE) # Required Content 1. Generate a markdown file in the labreports directoy named LAB_[GITHUB HANDLE].md. Write your lab report there. 2. Create the directory ```./circleci``` and the file ```.circleci/config.yml``` in your project and push that change to your GitHub repository. 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. -4. Write the URL of your running Heroku app here: ```ex: http://[cis411lab2-tangollama.herokuapp.com/graphql``` +4. Write the URL of your running Heroku app here: ```https://cis411lab2-lukemeads3.herokuapp.com/graphql``` 5. Embed _using markdown_ a screenshot of your successful build and deployment to Heroku of your project. +![image](../assets/heroku.PNG) 6. Answer the questions below. 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? +Containers require less resources and computing power than a traditional virtual machine. Another advantage is portability, which means that you can access it through the cloud or different platforms. There is also an improved secruity by isolating applications from each other. 2. If we have the ability to publish directory to Heroku, why involve a CI solution like CircleCI? What benefit does it provide? +Involving a CI solution helps the developer troubleshoot what went wrong and where. It highlights where in the code broke it. When something breaks you can roll back and fix it. diff --git a/package-lock.json b/package-lock.json index 485e285fb..06af87ba3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -304,23 +304,133 @@ } }, "@heroku-cli/plugin-certs-v5": { - "version": "7.18.7", - "resolved": "https://registry.npmjs.org/@heroku-cli/plugin-certs-v5/-/plugin-certs-v5-7.18.7.tgz", - "integrity": "sha512-5xqLc0GJyfpadqRGBT9QOtVeNZPY06XB3ZX0A9rvzZjgK6xivHpTWYEBd/Mo/uvwyTx6T5o1G8PTbyIiwotX4Q==", + "version": "7.39.2", + "resolved": "https://registry.npmjs.org/@heroku-cli/plugin-certs-v5/-/plugin-certs-v5-7.39.2.tgz", + "integrity": "sha512-/ubmVOpu7FpwxDPrNYiDQSzG7kT7p/9KJbDDU0kAE1FKQYHZjnQG/1u+FWgiGTbcsVROPN5jLa/AhS7AZGr0gA==", "requires": { "co": "4.6.0", "co-wait": "0.0.0", "date-fns": "^1.29.0", - "heroku-cli-util": "^8.0.10", - "inquirer": "^6.2.0", - "lodash": "4.17.11", + "heroku-cli-util": "^8.0.11", + "inquirer": "^6.2.2", + "lodash": "^4.17.13", "psl": "^1.1.29" }, "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, "date-fns": { - "version": "1.29.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.29.0.tgz", - "integrity": "sha512-lbTXWZ6M20cWH8N9S6afb0SBm6tMk+uUg6z3MqHPKE9atmsY3kJkTm8vKe93izJ2B2+q5MV990sM2CHgtAZaOw==" + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", + "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==" + }, + "heroku-cli-util": { + "version": "8.0.12", + "resolved": "https://registry.npmjs.org/heroku-cli-util/-/heroku-cli-util-8.0.12.tgz", + "integrity": "sha512-63wB17oSktlA/HzpIV/PGe8Isq5AZArT51KAW1gg54zyYRIiHOwXik93HZuuRVUaVrWvVUhItFeLgqMwAwlTsw==", + "requires": { + "@heroku-cli/color": "^1.1.3", + "ansi-escapes": "^3.1.0", + "ansi-styles": "^3.2.1", + "cardinal": "^2.0.1", + "chalk": "^2.4.1", + "co": "^4.6.0", + "got": "^8.3.1", + "heroku-client": "^3.1.0", + "lodash": "^4.17.10", + "netrc-parser": "^3.1.4", + "opn": "^3.0.3", + "strip-ansi": "^4.0.0", + "supports-color": "^5.4.0", + "tslib": "^1.9.0", + "tunnel-agent": "^0.6.0" + } + }, + "heroku-client": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/heroku-client/-/heroku-client-3.1.0.tgz", + "integrity": "sha512-UfGKwUm5duzzSVI8uUXlNAE1mus6uPxmZPji4vuG1ArV5DYL1rXsZShp0OoxraWdEwYoxCUrM6KGztC68x5EZQ==", + "requires": { + "is-retry-allowed": "^1.0.0", + "tunnel-agent": "^0.6.0" + } + }, + "inquirer": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz", + "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", + "requires": { + "ansi-escapes": "^3.2.0", + "chalk": "^2.4.2", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^2.0.0", + "lodash": "^4.17.12", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^6.4.0", + "string-width": "^2.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==" + }, + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "opn": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/opn/-/opn-3.0.3.tgz", + "integrity": "sha1-ttmec5n3jWXDuq/+8fsojpuFJDo=", + "requires": { + "object-assign": "^4.0.1" + } + }, + "rxjs": { + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", + "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } } } }, @@ -538,37 +648,111 @@ } }, "@heroku-cli/plugin-pg-v5": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@heroku-cli/plugin-pg-v5/-/plugin-pg-v5-7.18.6.tgz", - "integrity": "sha512-4iJAbd15NXLcqas/clRM9wVdIQMdu16RkSApQLXNu4YcEeKZJ4Z2PnBm6j3dVMnB/K8xunCDt50U+McpZewBhg==", + "version": "7.39.2", + "resolved": "https://registry.npmjs.org/@heroku-cli/plugin-pg-v5/-/plugin-pg-v5-7.39.2.tgz", + "integrity": "sha512-i4WWw1FN3ThT7LGUp2uFhOziG2w8OV0IZTse2bJlP9tm7rAJG35pV0u6S1tsf45Sr59IWNWoayl0TmOzoLC7zA==", "requires": { "@heroku-cli/plugin-addons": "^1.2.29", - "bytes": "^3.0.0", + "bytes": "^3.1.0", "co": "^4.6.0", "co-wait": "^0.0.0", - "debug": "^4.1.0", - "filesize": "^3.6.1", - "heroku-cli-util": "^8.0.10", + "debug": "^4.1.1", + "filesize": "^4.0.0", + "heroku-cli-util": "^8.0.11", "lodash": "^4.17.11", "mkdirp": "^0.5.1", - "node-notifier": "^5.3.0", + "node-notifier": "^5.4.0", "smooth-progress": "^1.1.0", "strip-eof": "^1.0.0", "tunnel-ssh": "^4.1.4" }, "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "bytes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + }, "debug": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", - "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "requires": { "ms": "^2.1.1" } }, + "filesize": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/filesize/-/filesize-4.2.1.tgz", + "integrity": "sha512-bP82Hi8VRZX/TUBKfE24iiUGsB/sfm2WUrwTQyAzQrhO3V9IhcBBNBXMyzLY5orACxRyYJ3d2HeRVX+eFv4lmA==" + }, + "heroku-cli-util": { + "version": "8.0.12", + "resolved": "https://registry.npmjs.org/heroku-cli-util/-/heroku-cli-util-8.0.12.tgz", + "integrity": "sha512-63wB17oSktlA/HzpIV/PGe8Isq5AZArT51KAW1gg54zyYRIiHOwXik93HZuuRVUaVrWvVUhItFeLgqMwAwlTsw==", + "requires": { + "@heroku-cli/color": "^1.1.3", + "ansi-escapes": "^3.1.0", + "ansi-styles": "^3.2.1", + "cardinal": "^2.0.1", + "chalk": "^2.4.1", + "co": "^4.6.0", + "got": "^8.3.1", + "heroku-client": "^3.1.0", + "lodash": "^4.17.10", + "netrc-parser": "^3.1.4", + "opn": "^3.0.3", + "strip-ansi": "^4.0.0", + "supports-color": "^5.4.0", + "tslib": "^1.9.0", + "tunnel-agent": "^0.6.0" + } + }, + "heroku-client": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/heroku-client/-/heroku-client-3.1.0.tgz", + "integrity": "sha512-UfGKwUm5duzzSVI8uUXlNAE1mus6uPxmZPji4vuG1ArV5DYL1rXsZShp0OoxraWdEwYoxCUrM6KGztC68x5EZQ==", + "requires": { + "is-retry-allowed": "^1.0.0", + "tunnel-agent": "^0.6.0" + } + }, "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node-notifier": { + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.4.3.tgz", + "integrity": "sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q==", + "requires": { + "growly": "^1.3.0", + "is-wsl": "^1.1.0", + "semver": "^5.5.0", + "shellwords": "^0.1.1", + "which": "^1.3.0" + } + }, + "opn": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/opn/-/opn-3.0.3.tgz", + "integrity": "sha1-ttmec5n3jWXDuq/+8fsojpuFJDo=", + "requires": { + "object-assign": "^4.0.1" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } } } }, @@ -2485,9 +2669,9 @@ "dev": true }, "js-yaml": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", - "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -2552,9 +2736,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, "lodash._reinterpolate": { "version": "3.0.0", @@ -2582,9 +2766,9 @@ "integrity": "sha1-hzVWbGGLNan3YFILSHrnllivE2o=" }, "lodash.merge": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.1.tgz", - "integrity": "sha512-AOYza4+Hf5z1/0Hztxpm2/xiPZgi/cjMqdnKTUWTBSKchJlxXXuUSxCCl8rJlf4g6yww/j6mA8nC8Hw/EZWxKQ==" + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" }, "lodash.padstart": { "version": "4.6.1", @@ -2697,16 +2881,16 @@ } }, "minimist": { - "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "mkdirp": { - "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "requires": { - "minimist": "0.0.8" + "minimist": "^1.2.5" } }, "ms": { @@ -2857,6 +3041,7 @@ "version": "0.1.4", "bundled": true, "dev": true, + "optional": true, "requires": { "kind-of": "^3.0.2", "longest": "^1.0.1", @@ -3181,7 +3366,8 @@ "is-buffer": { "version": "1.1.6", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "is-builtin-module": { "version": "1.0.0", @@ -3265,6 +3451,7 @@ "version": "3.2.2", "bundled": true, "dev": true, + "optional": true, "requires": { "is-buffer": "^1.1.5" } @@ -3311,7 +3498,8 @@ "longest": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "lru-cache": { "version": "4.1.3", @@ -3577,7 +3765,8 @@ "repeat-string": { "version": "1.6.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "require-directory": { "version": "2.1.1", @@ -4150,9 +4339,9 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" }, "psl": { - "version": "1.1.29", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", - "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" }, "pump": { "version": "3.0.0",