Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Origin/release 1.0.1 #27

Open
wants to merge 8 commits into
base: release-1.0.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# 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
.idea/**/shelf

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

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

# CMake
cmake-build-debug/
cmake-build-release/

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

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

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

# Editor-based Rest Client
.idea/httpRequests
### VisualStudioCode template
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### Remove MongoDB Docker Data from Git
MongoDB/**

24 changes: 24 additions & 0 deletions Nginx/conf.d/app.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
server {
listen 80;
charset utf-8;
access_log off;

location / {
proxy_pass http://frontend:8080;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

location /api/ {
proxy_pass http://backend:3000/;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ FocusBlock uses a Node.js server in order to handle communication between the cl

Start by creating a `.env` file that will store these properties:

- `BASE_PATH`=localhost:3000
- `DB_PATH`=mongodb://localhost:27017/focusblock
- `BASE_PATH`=localhost
- `PORT`=3000
- `DB_HOST`=localhost:27017
- `DB_NAME`=focusblock

##### Start Server
Expand Down
5 changes: 5 additions & 0 deletions Server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
.gitignore
README.md
docker-compose.yml
node_modules
5 changes: 4 additions & 1 deletion Server/Database/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
const MongoClient = require('mongodb').MongoClient;
var db;

let dbstring = `mongodb://${process.env.DB_HOST}/${process.env.DB_NAME}`;

// Connect to DB //
MongoClient.connect(
process.env.DB_PATH,
dbstring,
{ useNewUrlParser: true },
(error, client) => {
if (error) throw error;

console.log('Connected to FocusBlock DB!');
console.log(dbstring)
db = client.db(process.env.DB_NAME);
}
);
Expand Down
16 changes: 16 additions & 0 deletions Server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:8-slim

RUN mkdir /app

RUN npm install nodemon -g

WORKDIR /app
COPY . .
#ADD . .

RUN npm install


EXPOSE 3000

CMD npm start
6 changes: 6 additions & 0 deletions Server/nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"env": {
"NODE_ENV": "development"
},
"ext": "js json hjs"
}
2 changes: 1 addition & 1 deletion Server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ server.post('/new', async (req, res) => {
let id = shortid.generate();
let userObj = {
_id: id,
url: `${process.env.BASE_PATH}/dashboard/${id}`,
url: `/dashboard/${id}`,
focusBlocks: []
};

Expand Down
61 changes: 61 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
version: '3'
services:
nginx:
container_name: focusblock-nginx
image: nginx:latest
#restart: always
ports:
- "80:80"
volumes:
- ./Nginx/conf.d:/etc/nginx/conf.d
links:
- frontend
depends_on:
- frontend

mongodb:
container_name: focusblock-mongodb
image: mongo:latest
command: mongod
ports:
- "27017:27017"
volumes:
- ./MongoDB:/data/db

backend:
container_name: focusblock-backend
build: ./Server
restart: on-failure
environment:
- BASE_PATH=localhost
- DB_HOST=mongodb:27017
- DB_NAME=focusblock
- PORT=3000
#volumes:
# - ./Server:/app
ports:
- "3000:3000"
links:
- mongodb
depends_on:
- mongodb

frontend:
container_name: focusblock-frontend
build: "./focus-block"
environment:
#SMTP Username for SMTPJS (From Sengrid)
- REACT_APP_SMTP_USERNAME=CHANGE_ME
#SMTP Password for SMTPJS (From Sengrid)
- REACT_APP_SMTP_PW=CHANGE_ME_TOO
#The route for your Node Server (ex. http://localhost:8000)
- PORT=8080
- REACT_APP_ENVIRONMENT=docker
#volumes:
# - ./focus-block:/app
ports:
- "8080:8080"
links:
- backend
depends_on:
- backend
5 changes: 5 additions & 0 deletions focus-block/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
../Server/.gitignore
README.md
docker-compose.yml
node_modules
13 changes: 13 additions & 0 deletions focus-block/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:8-slim

RUN mkdir /app
RUN npm install npm-run-all -g

WORKDIR /app
COPY . .
#ADD . .
RUN npm install

EXPOSE 8080

CMD npm start
Loading