-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine backend and worker with frontend
- Fix upload function - Add production docker image - Merge three repos into one - Update packages - Remove redis - Enable separate worker to be spawned for each request - Remove passport and replace with API authentication - Minor fixes (removing extra spaces, linting errors ... etc) - Update code to ES6 - Update readme - Updated ESlint rules - Dockerize repo - Simplify API - Fix production docker - Update config Bug: T290241 Change-Id: I1e749cd9bd07220c254d9ee0994b6eb3e6997847
- Loading branch information
1 parent
5ceb425
commit 7e3b72d
Showing
78 changed files
with
50,329 additions
and
19,322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# dependencies | ||
.git | ||
*Dockerfile* | ||
*docker-compose* | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
|
||
# WordPress Coding Standards | ||
# https://make.wordpress.org/core/handbook/coding-standards/ | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Disable all a11y rules | ||
const a11y = require('eslint-plugin-jsx-a11y'); | ||
|
||
const a11yOff = Object.keys(a11y.rules).reduce((acc, rule) => { | ||
acc[`jsx-a11y/${rule}`] = 'off'; | ||
return acc; | ||
}, {}); | ||
|
||
module.exports = { | ||
env: { | ||
browser: true, | ||
es6: true | ||
}, | ||
extends: ['plugin:react/recommended', 'airbnb'], | ||
globals: { | ||
Atomics: 'readonly', | ||
SharedArrayBuffer: 'readonly' | ||
}, | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true | ||
}, | ||
ecmaVersion: 2018 | ||
}, | ||
plugins: ['react', 'react-hooks'], | ||
settings: { | ||
'import/resolver': { | ||
alias: { | ||
map: [['@', './src']] | ||
} | ||
} | ||
}, | ||
rules: { | ||
'linebreak-style': 0, | ||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | ||
'no-tabs': 0, | ||
indent: ['warn', 'tab', { SwitchCase: 1 }], | ||
'comma-dangle': 0, | ||
'arrow-parens': 0, | ||
'object-curly-newline': [ | ||
'warn', | ||
{ | ||
ImportDeclaration: { minProperties: 6, consistent: false, multiline: true } | ||
} | ||
], | ||
radix: 0, | ||
camelcase: ['warn', { ignoreDestructuring: true, properties: 'never' }], | ||
'arrow-body-style': ['warn', 'as-needed'], | ||
'no-param-reassign': 0, | ||
'no-underscore-dangle': 0, | ||
'no-unused-vars': ['warn', { vars: 'all', args: 'after-used', ignoreRestSiblings: false }], | ||
'no-use-before-define': ['warn'], | ||
'no-shadow': ['warn'], | ||
'consistent-return': ['warn'], | ||
'operator-linebreak': ['off'], | ||
'import/no-extraneous-dependencies': ['warn'], | ||
'prefer-template': ['warn'], | ||
'object-shorthand': ['warn'], | ||
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], | ||
'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'], | ||
'react/self-closing-comp': ['warn'], | ||
'react/jsx-indent': [2, 'tab'], | ||
'react/jsx-indent-props': [2, 'tab'], | ||
'react/prop-types': ['off'], | ||
'react/jsx-props-no-spreading': ['warn'], | ||
'react/destructuring-assignment': ['warn'], | ||
'react/jsx-one-expression-per-line': ['warn'], | ||
'react/no-array-index-key': ['off'], | ||
...a11yOff | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": true, | ||
"arrowParens": "avoid", | ||
"printWidth": 100, | ||
"singleQuote": true, | ||
"trailingComma": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "stylelint-config-standard", | ||
"rules": { | ||
"indentation": "tab", | ||
"at-rule-no-unknown": null, | ||
"scss/at-rule-no-unknown": true, | ||
"declaration-colon-newline-after": "always-multi-line" | ||
}, | ||
"plugins": ["stylelint-scss"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"editor.formatOnType": false, | ||
"editor.formatOnPaste": false, | ||
"editor.formatOnSave": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Install node | ||
FROM node:14 | ||
|
||
# Install FFMPEG library | ||
RUN apt update -y | ||
RUN apt install ffmpeg -y | ||
|
||
# Set the workdir /app | ||
WORKDIR /app | ||
|
||
# Frontend | ||
# Copy the package.json to workdir | ||
COPY package.json ./ | ||
COPY server/package.json ./server/ | ||
|
||
# Run npm install - install the npm dependencies | ||
RUN npm install --legacy-peer-deps | ||
|
||
# Copy application source | ||
COPY . . | ||
|
||
EXPOSE 3000 4000 8081 | ||
|
||
# Start the application | ||
CMD ["npm", "run", "dev"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Install node | ||
FROM node:16 as build | ||
|
||
# Install FFMPEG library | ||
RUN apt update -y | ||
RUN apt install ffmpeg -y | ||
|
||
# Set the workdir /app | ||
WORKDIR /app | ||
|
||
# Frontend | ||
# Copy the package.json to workdir | ||
COPY package.json ./ | ||
COPY server/package.json ./server/ | ||
|
||
# Install dependncies | ||
RUN npm install --legacy-peer-deps | ||
|
||
# Copy application source | ||
COPY . . | ||
|
||
EXPOSE 80 4000 | ||
|
||
# run express server | ||
# RUN node server/index.js | ||
CMD ["npm", "run", "prd"] | ||
|
||
# Build | ||
RUN npm run build | ||
|
||
# Run ngnix server | ||
FROM nginx:1.21.4 as server | ||
COPY --from=build /app/build /usr/share/nginx/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '3.7' | ||
services: | ||
mongo: | ||
image: mongo | ||
container_name: "mongo" | ||
restart: always | ||
# environment: | ||
# MONGO_INITDB_ROOT_USERNAME: root | ||
# MONGO_INITDB_ROOT_PASSWORD: example | ||
volumes: | ||
- './dockervolume/mongodb:/data/db' | ||
ports: | ||
- 27018:27017 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: '3.7' | ||
services: | ||
videocuttool: | ||
container_name: videocuttool | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.dev | ||
volumes: | ||
- ./src:/app/src:ro | ||
- ./server:/app/server | ||
- ./public:/app/public | ||
- '/app/node_modules' | ||
ports: | ||
- '3000:3000' | ||
- '4000:4000' | ||
environment: | ||
- CHOKIDAR_USEPOLLING=true | ||
- NODE_ENV=development | ||
links: | ||
- mongo | ||
depends_on: | ||
- mongo | ||
mongo: | ||
container_name: videocuttool-mongo | ||
image: 'mongo:4' | ||
ports: | ||
- '27017:27017' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
version: '3.9' | ||
services: | ||
videocuttool: | ||
container_name: videocuttool | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.prd | ||
volumes: | ||
- ./src:/app/src:ro | ||
- ./server:/app/server | ||
- ./public:/app/public | ||
- '/app/node_modules' | ||
ports: | ||
- '80:80' | ||
- '4000:4000' | ||
environment: | ||
- NODE_ENV=production | ||
networks: | ||
- my-network | ||
links: | ||
- mongodb | ||
depends_on: | ||
- mongodb | ||
mongodb: | ||
image: 'mongo:4' | ||
command: ["--bind_ip_all"] | ||
# environment: | ||
# - MONGO_INITDB_ROOT_USERNAME=admin | ||
# - MONGO_INITDB_ROOT_PASSWORD=<YOUR_PASSWORD> | ||
ports: | ||
- 27017:27017 | ||
restart: always | ||
# volumes: | ||
# - ./mongodb/db:/data/db | ||
networks: | ||
- my-network | ||
|
||
networks: | ||
my-network: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '3.4' | ||
|
||
services: | ||
videocuttool: | ||
image: videocuttool | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile | ||
environment: | ||
NODE_ENV: production | ||
ports: | ||
- 80:80 | ||
- 4000:4000 |
Oops, something went wrong.