Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
trkyshorty committed Aug 18, 2022
1 parent c0c7565 commit f57d330
Show file tree
Hide file tree
Showing 40 changed files with 11,192 additions and 47 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
npm-debug.log
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
16 changes: 16 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#Environment
NODE_ENV=development

# Express
PORT=3000

# JWT Secret
JWT_SECRET=jwtsecret

# Mongoose
MONGODB_URL=mongodb://mongodb:27017/radioju-development

# Redis
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=redispassword
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
26 changes: 26 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"env": {
"node": true
},
"extends": [
"airbnb-base",
"plugin:security/recommended",
"plugin:prettier/recommended"
],
"plugins": ["security", "prettier"],
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"no-console": "off",
"func-names": "off",
"no-underscore-dangle": "off",
"consistent-return": "off",
"security/detect-object-injection": "off",
"security/detect-non-literal-require": "off",
"import/no-dynamic-require": "off",
"global-require": "off",
"security/detect-non-literal-fs-filename": "off",
"class-methods-use-this": "off"
}
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
50 changes: 4 additions & 46 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ logs
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

# Runtime data
pids
Expand All @@ -20,12 +16,11 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

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

# Bower dependency directory (https://bower.io/)
Expand All @@ -41,24 +36,15 @@ build/Release
node_modules/
jspm_packages/

# TypeScript v1 declaration files
# Typescript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

Expand All @@ -70,35 +56,7 @@ typings/

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
# next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
.DS_Store
7 changes: 7 additions & 0 deletions .huskyrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"hooks": {
"post-checkout": "yarn",
"pre-commit": "npx lint-staged",
"post-commit": "git status"
}
}
3 changes: 3 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.js": "eslint"
}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
coverage
logs
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 120,
"jsdocParser": true
}
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:16-alpine

# Create app directory
WORKDIR /usr/src/radioju-api

# 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 ./

# npm i bcrypt needed python3
RUN apk --no-cache add --virtual .builds-deps build-base python3

RUN npm install
# If you are building your code for production
# RUN npm ci --only=production

# Bundle app source
COPY . .

EXPOSE 3000
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# radioju-api
# radioju-api
63 changes: 63 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
version: '3'

services:
redis:
image: redis:6.2-alpine
ports:
- 6379:6379
command: redis-server --save 20 1 --loglevel warning --requirepass ${REDIS_PASSWORD}
networks:
- redis

mongodb:
image: mongo:5.0.6
ports:
- 27017:27017
volumes:
- mongodb:/data/db
networks:
- mongodb

api:
build:
context: ./
dockerfile: Dockerfile
environment:
- MONGODB_URL=${MONGODB_URL}
- NODE_ENV=${NODE_ENV}
- JWT_SECRET=${JWT_SECRET}
- REDIS_HOST=${REDIS_HOST}
- REDIS_PORT=${REDIS_PORT}
- REDIS_PASSWORD=${REDIS_PASSWORD}
ports:
- '3000:3000'
depends_on:
- redis
- mongodb
volumes:
- api:/usr/src/radioju-api
- storage:/usr/src/radioju-api/storage
networks:
- api
- redis
- mongodb
command: yarn start

volumes:
api:
driver: local
storage:
driver: local
name: radioju-storage
mongodb:
driver: local

networks:
api:
driver: bridge
name: nginx-bridge
redis:
driver: ipvlan
mongodb:
driver: ipvlan

14 changes: 14 additions & 0 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
apps: [
{
name: 'radioju-api',
script: 'src/bin/www',
watch: false,
autorestart: true,
time: false,
env: {
NODE_ENV: 'production',
},
},
],
};
Loading

0 comments on commit f57d330

Please sign in to comment.