Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmoli committed Mar 18, 2020
1 parent 54c72d0 commit add9cac
Show file tree
Hide file tree
Showing 22 changed files with 514 additions and 321 deletions.
41 changes: 0 additions & 41 deletions .eslintrc.js

This file was deleted.

56 changes: 56 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// {
// "env": {
// "es6": true,
// "node": true
// },
// "extends": [
// "eslint:recommended",
// "plugin:@typescript-eslint/eslint-recommended"
// ],
// "globals": {
// "Atomics": "readonly",
// "SharedArrayBuffer": "readonly"
// },
// "parser": "@typescript-eslint/parser",
// "parserOptions": {
// "ecmaVersion": 2018,
// "sourceType": "module"
// },
// "plugins": [
// "@typescript-eslint"
// ],
// "rules": {
// "no-unused-vars": "off",
// "@typescript-eslint/no-unused-vars": "error"
// }
// }
{
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"env": {
"es6": true,
"node": true,
"jest": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"semi": ["error", "always"],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-inferrable-types": [
"warn",
{
"ignoreParameters": true
}
],
"@typescript-eslint/no-unused-vars": "warn"
}
}
34 changes: 0 additions & 34 deletions .eslintrc.json.bk

This file was deleted.

66 changes: 64 additions & 2 deletions .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,66 @@

# Created by https://www.gitignore.io/api/node,linux
# Edit at https://www.gitignore.io/?templates=node,linux

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/

# Dependency directories
node_modules/
dist/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
build/
.env.test

# End of https://www.gitignore.io/api/node,linux
48 changes: 33 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
# Use the official Node.js 10 image.
# https://hub.docker.com/_/node
FROM node:12
# ---- Base Node ----
FROM node:12.15-slim AS base
# set working directory
WORKDIR /app
# copy project file
COPY package.json .

# Create and change to the app directory.
WORKDIR /usr/src/app

# Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this separately prevents re-running npm install on every code change.
COPY package.json package*.json ./

# Install production dependencies.
#
# ---- Dependencies ----
FROM base AS dependencies
# install node packages
RUN npm set progress=false && npm config set depth 0
RUN npm install --only=production
# copy production node_modules aside
RUN cp -R node_modules prod_node_modules
# install ALL node_modules, including 'devDependencies'
RUN npm install

# Copy local code to the container image.
#
# ---- Test ----
# run linters, setup and tests
FROM dependencies AS test
COPY . .
RUN npm run lint && npm run setup && npm run test

#
# ---- Release ----
FROM base AS release
# copy production node_modules
COPY --from=dependencies /app/prod_node_modules ./node_modules
# copy app sources
COPY . .

# expose port and define CMD
ENV PORT=8080
EXPOSE ${PORT}

# Run the web service on container startup.
CMD [ "npm", "start" ]
CMD npm run start
22 changes: 3 additions & 19 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
MIT License
Copyright 2020 Darshan Shah

Copyright (c) 2020 Michele Memoli
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
27 changes: 0 additions & 27 deletions Makefile

This file was deleted.

32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
# Plumbline
# Steps to run the compile and run the server

Plumbline is a utility container that allows the use of neo4j-graphql-js with a Neo4j instance.
- Run `yarn` or `npm install`
- Run `yarn build` or `npm run build`
- Run `yarn start` or `npm run start`

## Running on GCP Cloud Run
## To run using docker

1. Adjust parameters in the Makefile
2. Make sure to define
the `NEO4J_URI`, `NEO4J_USERNAME`, `NEO4J_PASSWORD` of your instance.
3. Define an env var `TYPEDEFS` with the typedefs you'd like to use with the Neo4j instance.
2. `make cloudrun` will deploy the plumbline service given those specifics.
- Run `docker-compose -f docker-compose.yml up`

## Running in any other Dockerized environment
## To run mongo as a container

Plumbline is just an apollo server running neo4j-graphql-js. Check the Makefile for the repository where the
docker image can be found, and deploy with the key environment variables mentioned above.
- Run `docker-compose -f docker-compose-resources.yml up`

## Generate documentation for code. (uses tsconfig.json file present in your project for generating/serving docs)

## Build the container
- Run `yarn generate-docs` or `npm run generate-docs`
- Run `yarn serve-docs` or `npm run serve-docs` to host the generated documentation

You only need to do this if you're developing plumbline. Existing containers are already hosted in a public
repository, so you can run plumbline without this step.

1. Adjust the registry setting at the top of the `Makefile`.
2. `make` will build and push your docker image
## Things to Remeber / Things to Do

- While coding, please follow proper code-commenting practices.
- **[Can refer and follow standards defined by Microsoft for the same](https://github.com/microsoft/tsdoc)**
Loading

0 comments on commit add9cac

Please sign in to comment.