Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mpetrunic committed Apr 12, 2020
0 parents commit ae060e1
Show file tree
Hide file tree
Showing 36 changed files with 6,177 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
version: 2
jobs:
build:
working_directory: ~/app
machine:
image: circleci/classic:latest
steps:
- checkout
- run: chown -R $USER:$USER ~/app
- restore_cache:
keys:
- v2-docker-{{ .Branch }}
- run:
name: Load Docker layers cache
command: |
set +o pipefail
docker load -i ~/docker-layers.tar || true
- run:
name: Build application Docker image
command: |
export IMAGE_TAG=$CIRCLE_SHA1
docker-compose build
- run:
name: Tag docker image as latest
command: |
docker tag nodefactory/nodejs-ts-starter:${CIRCLE_SHA1} nodefactory/nodejs-ts-starter:latest
- run:
name: Set coveralls variables
command: |
touch .coveralls.env
echo "COVERALLS_SERVICE_NAME=circle-ci" >> .coveralls.env
echo "CIRCLECI=true" >> .coveralls.env
echo "COVERALLS_REPO_TOKEN=${COVERALLS_REPO_TOKEN}" >> .coveralls.env
echo "CIRCLE_BUILD_NUM=${CIRCLE_BUILD_NUM}" >> .coveralls.env
echo "CIRCLE_BUILD_NUM=${CIRCLE_BUILD_NUM}" >> .coveralls.env
echo "CI_PULL_REQUEST=${CI_PULL_REQUEST}" >> .coveralls.env
echo "CIRCLE_SHA1=${CIRCLE_SHA1}" >> .coveralls.env
echo "CIRCLE_BRANCH=${CIRCLE_BRANCH}" >> .coveralls.env
- run:
name: Send test results to Coveralls
command: |
docker run --env-file .coveralls.env nodefactory/nodejs-ts-starter:${CIRCLE_SHA1} sh -c "npm run coverage && npm run coveralls"
- run:
name: Save docker layers cache
command: |
docker save -o ~/docker-layers.tar node:12.13-alpine
docker save -o ./image.tar nodefactory/nodejs-ts-starter:latest
- save_cache:
key: v2-docker-{{ .Branch }}-{{ epoch }}
paths:
- ~/docker-layers.tar
- persist_to_workspace:
root: ./
paths:
- ./image.tar
deploy:
working_directory: ~/app
machine:
image: circleci/classic:latest
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Load Docker images
command: |
set +o pipefail
docker load -i ./image.tar || true
- run:
name: Build production image
command: docker build -t final -f Dockerfile.production .
workflows:
version: 2
build-deploy:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only:
- master
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.git/
*.tar
*.tgz
test_results
27 changes: 27 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Port on which express server is running (inside docker)
SERVER_PORT=3000
# Local port that "forwards" requests to express port inside docker
BACKEND_LOCAL_PORT=3000
# Name of docker container
BACKEND_CONTAINER_NAME=nodejs-ts-starter-backend
# Docker image tag
IMAGE_TAG=latest

# Database settings

# Default user that will be created on first start
DB_USER=nodefactory
# Password of default user
DB_PASSWORD=nodefactory
# Database that will be created on first start
DB_NAME=nodefactory
# Port on localhost on which database will listen to
DB_LOCAL_PORT=9876
# Name of docker database container
DB_CONTAINER_NAME=nodejs-db
# Database host (db is name of service in docker compose)
DB_HOST=db
# Database port inside docker
DB_PORT=5432
# mysql | postgres | sqlite | mssql
DB_DIALECT=postgres
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/Migrations
25 changes: 25 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"env": {
"mocha": true,
"node": true,
"es6": true
},
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/ban-ts-ignore": "warn",
"@typescript-eslint/no-unused-vars": ["error", {
"varsIgnorePattern": "^_"
}],
"max-len": ["error", {
"code": 120
}]
}
}
246 changes: 246 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@

# Created by https://www.gitignore.io/api/node,macos,linux,windows,solidity,jetbrains+all

### JetBrains+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Ruby plugin and RubyMine
/.rakeTasks

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### JetBrains+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/

# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023

*.iml
modules.xml
.idea/misc.xml
*.ipr

### 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*

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

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

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

#test-results
test-results

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

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

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# 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


### Solidity ###
# Logs

# Runtime data

# Directory for instrumented libs generated by jscoverage/JSCover

# Coverage directory used by tools like istanbul

# nyc test coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)

# Bower dependency directory (https://bower.io/)

# node-waf configuration

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

# Dependency directories

# Typescript v1 declaration files

# Optional npm cache directory

# Optional eslint cache

# Optional REPL history

# Output of 'npm pack'

# Yarn Integrity file

# dotenv environment variables file

installed_contracts
build

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

#build
dist

src/**/*.js
src/**/*.js.map
test/**/*.js
test/**/*.js.map

.postgres

# End of https://www.gitignore.io/api/node,macos,linux,windows,solidity,jetbrains+all
Loading

0 comments on commit ae060e1

Please sign in to comment.