Skip to content

Commit

Permalink
phase2 --------- partial 4 (#76)
Browse files Browse the repository at this point in the history
* added description to the video url field in project creation form issue #50 (#61)

* new deployment changes (#62)

* domain setup step 1 test 5

* domain setup step 2(backend) test 1

* domain setup step2(backend) test2

* removed .ssl-data from .dockerignore

* added custom nginx container to handle reverse proxying and https requests

* made important changes to deploy_frontend.sh, added google tracking code to index.html, enabled crawling

* increased pagination limit from 6 to 20 (#63)

* phase2 patial ----- 2 (#65)

switched handling of ssl back to valian/docker-nginx-auto-ssl

* fixed bug that occurs when user submit google drive video link (#72)

* added functionality to format youtube video url to embedable format

* made video url optional

* switched image upload location from cloudinary to digital ocean spaces

* added functionality to automatically delete image from digitalocean space once image is deleted from db

* added image count indicator and made video optional. also added project create button to navbar

* removed .ssl from git

* untracked .ssl-data

* added support for various forms of youtube video url, vimeo and google drive

* fixed issues #35, #33, #32, #30, #29

* fixed issue #46

* phase2 patial ----- 2 (#66)

* added description to the video url field in project creation form issue #50 (#61)

* new deployment changes (#62)

* increased pagination limit from 6 to 20 (#63)

* phase2 patial ----- 2 (#65)

switched handling of ssl back to valian/docker-nginx-auto-ssl

* fixed issue #68

* separated docker-compose files into dev and prod in preparation for CI/CD (#75)

* domain setup step 1 test 5

* domain setup step 2(backend) test 1

* domain setup step2(backend) test2

* removed .ssl-data from .dockerignore

* added custom nginx container to handle reverse proxying and https requests

* made important changes to deploy_frontend.sh, added google tracking code to index.html, enabled crawling

* switched handling of ssl back to valian/docker-nginx-auto-ssl

* phase2 patial ----- 2 (#66)

* added description to the video url field in project creation form issue #50 (#61)

* new deployment changes (#62)

* increased pagination limit from 6 to 20 (#63)

* phase2 patial ----- 2 (#65)

switched handling of ssl back to valian/docker-nginx-auto-ssl

* phase 2 partial ------ 3 (#73)

* added description to the video url field in project creation form issue #50 (#61)

* new deployment changes (#62)

* domain setup step 1 test 5

* domain setup step 2(backend) test 1

* domain setup step2(backend) test2

* removed .ssl-data from .dockerignore

* added custom nginx container to handle reverse proxying and https requests

* made important changes to deploy_frontend.sh, added google tracking code to index.html, enabled crawling

* increased pagination limit from 6 to 20 (#63)

* phase2 patial ----- 2 (#65)

switched handling of ssl back to valian/docker-nginx-auto-ssl

* fixed bug that occurs when user submit google drive video link (#72)

* added functionality to format youtube video url to embedable format

* made video url optional

* switched image upload location from cloudinary to digital ocean spaces

* added functionality to automatically delete image from digitalocean space once image is deleted from db

* added image count indicator and made video optional. also added project create button to navbar

* removed .ssl from git

* untracked .ssl-data

* added support for various forms of youtube video url, vimeo and google drive

* fixed issues #35, #33, #32, #30, #29

* fixed issue #46

* phase2 patial ----- 2 (#66)

* added description to the video url field in project creation form issue #50 (#61)

* new deployment changes (#62)

* increased pagination limit from 6 to 20 (#63)

* phase2 patial ----- 2 (#65)

switched handling of ssl back to valian/docker-nginx-auto-ssl

* fixed issue #68

* separated docker-compose files into dev and prod in preparation for CI/CD

* separated docker-compose files into dev and prod in preparation for CI/CD -- backend

* separated docker-compose files into dev and prod in preparation for CI/CD --- patch (#77)

* domain setup step 1 test 5

* domain setup step 2(backend) test 1

* domain setup step2(backend) test2

* removed .ssl-data from .dockerignore

* added custom nginx container to handle reverse proxying and https requests

* made important changes to deploy_frontend.sh, added google tracking code to index.html, enabled crawling

* switched handling of ssl back to valian/docker-nginx-auto-ssl

* separated docker-compose files into dev and prod in preparation for CI/CD

* separated docker-compose files into dev and prod in preparation for CI/CD -- backend

* separated docker-compose files into dev and prod in preparation for CI/CD --- patch

* made deploy_frontend.sh more explanatory

* Code Refactor (#67)

* phase2 patial ----- 2 (#66)

* added description to the video url field in project creation form issue #50 (#61)

* new deployment changes (#62)

* increased pagination limit from 6 to 20 (#63)

* phase2 patial ----- 2 (#65)

switched handling of ssl back to valian/docker-nginx-auto-ssl

* Issue #54: switched from class based views to function based views, moved styles to seprate files and changed the general structure of the project to be more intuitive

* more refactoring

* more refactor -- added new prettier rules and prettified more files not being covered by prettier initially
  • Loading branch information
NdibeRaymond authored Jan 20, 2021
1 parent 70d7432 commit e27329f
Show file tree
Hide file tree
Showing 88 changed files with 7,308 additions and 6,919 deletions.
2 changes: 1 addition & 1 deletion zubhub_backend/deploy_backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ cp -r zubhub/zubhub_backend/ zubhub_backend/
rm -rf zubhub/ zubhub_backend/.env.example
cd zubhub_backend
docker-compose down
docker-compose up -d --build
docker-compose -f ./docker-compose.prod.yml up -d --build
echo "Updated backend"
# EOT
124 changes: 124 additions & 0 deletions zubhub_backend/docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
version: "3.3"

services:
web:
env_file: .env
build:
context: .
dockerfile: ./Dockerfile
command: /start
restart: on-failure
environment:
- ENVIRONMENT=${ENVIRONMENT}
- SECRET_KEY:${SECRET_KEY}
- DEBUG:${DEBUG}
- POSTGRES_NAME=${POSTGRES_NAME}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST}
- SENDGRID_API_KEY=${SENDGRID_API_KEY}
volumes:
- .:/zubhub_backend
ports:
- 8000
depends_on:
- db
- rabbitmq

db:
env_file: .env
image: postgres:11
restart: on-failure
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data/
ports:
- 5432

reverse-proxy:
image: valian/docker-nginx-auto-ssl:1.0.0
container_name: reverse-proxy
restart: on-failure
ports:
- 80:80
- 443:443
volumes:
- ./.ssl-data:/etc/resty-auto-ssl
environment:
ALLOWED_DOMAINS: "(api|www.api|rabbitmq|flower|prometheus).zubhub.unstructured.studio"
SITES:
"api.zubhub.unstructured.studio=web:8000;www.api.zubhub.unstructured.studio=web:8000;\
rabbitmq.zubhub.unstructured.studio=rabbitmq:15672;flower.zubhub.unstructured.studio=flower:5555;\
prometheus.zubhub.unstructured.studio=prometheus:9090"
FORCE_HTTPS: "true"
depends_on:
- web
- rabbitmq
- flower
- prometheus

rabbitmq:
env_file: .env
image: rabbitmq:3-management
restart: on-failure
ports:
- 5672
- 15672

celery_worker:
env_file: .env
build:
context: .
dockerfile: ./Dockerfile
image: zubhub_celery_worker
command: /start-celeryworker
restart: on-failure
volumes:
- .:/zubhub_backend
depends_on:
- rabbitmq
- db

flower:
env_file: .env
build:
context: .
dockerfile: ./Dockerfile
image: zubhub_celery_flower
ports:
- 5555
command: /start-flower
restart: on-failure
volumes:
- .:/zubhub_backend
depends_on:
- celery_worker
- rabbitmq
- db

prometheus:
image: prom/prometheus
ports:
- 9090
command:
- --config.file=/etc/prometheus/prometheus.yml
restart: on-failure
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
depends_on:
- cadvisor

cadvisor:
image: google/cadvisor
container_name: cadvisor
restart: on-failure
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro

volumes:
postgres_data:
.ssl-data:
23 changes: 0 additions & 23 deletions zubhub_backend/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,6 @@ services:
ports:
- 5432:5432

reverse-proxy:
image: valian/docker-nginx-auto-ssl:1.0.0
container_name: reverse-proxy
restart: on-failure
ports:
- 80:80
- 443:443
volumes:
- ./.ssl-data:/etc/resty-auto-ssl
environment:
ALLOWED_DOMAINS: "(api|www.api|rabbitmq|flower|prometheus).zubhub.unstructured.studio"
SITES:
"api.zubhub.unstructured.studio=web:8000;www.api.zubhub.unstructured.studio=web:8000;\
rabbitmq.zubhub.unstructured.studio=rabbitmq:15672;flower.zubhub.unstructured.studio=flower:5555;\
prometheus.zubhub.unstructured.studio=prometheus:9090"
FORCE_HTTPS: "true"
depends_on:
- web
- rabbitmq
- flower
- prometheus

rabbitmq:
env_file: .env
image: rabbitmq:3-management
Expand Down Expand Up @@ -121,4 +99,3 @@ services:

volumes:
postgres_data:
.ssl-data:
10 changes: 10 additions & 0 deletions zubhub_frontend/zubhub/.prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
printWidth: 80
tabWidth: 2
useTabs: false
semi: true
singleQuote: true
trailingComma: all
bracketSpacing: true
jsxBracketSameLine: false
arrowParens: avoid
requirePragma: false
4 changes: 2 additions & 2 deletions zubhub_frontend/zubhub/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ RUN npm run build
FROM nginx:stable-alpine
COPY --from=build /zubhub_frontend/build /usr/share/nginx/html
# new
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
COPY nginx/dev/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]
18 changes: 18 additions & 0 deletions zubhub_frontend/zubhub/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# build environment
FROM node:13.12.0-alpine as build
WORKDIR /zubhub_frontend
ENV PATH /zubhub_frontend/node_modules/.bin:$PATH
COPY package.json ./
COPY package-lock.json ./
RUN npm ci --silent
RUN npm install react-scripts@3.4.1 -g --silent
COPY . ./
RUN npm run build

# production environment
FROM nginx:stable-alpine
COPY --from=build /zubhub_frontend/build /usr/share/nginx/html
# new
COPY nginx/prod/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
13 changes: 12 additions & 1 deletion zubhub_frontend/zubhub/deploy_frontend.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
#! /bin/bash

echo "copying .env file and ssl folder"
mv zubhub_frontend/zubhub/.env zubhub/zubhub_frontend/zubhub/.env
mv zubhub_frontend/zubhub/.ssl-data zubhub/zubhub_frontend/zubhub/
echo "done copying .env file and ssl folder"

echo "removing unneccessary files and folders"
rm -rf zubhub_frontend
cp -r zubhub/zubhub_frontend/ zubhub_frontend/
rm -rf zubhub/ zubhub_frontend/zubhub/.env.example
rm -rf zubhub/ zubhub_frontend/zubhub/Dockerfile
rm -rf zubhub/ zubhub_frontend/zubhub/docker-compose.yml
rm -rf zubhub/ zubhub_frontend/zubhub/nginx/dev
echo "done removing unneccessary files and folders"

cd zubhub_frontend/zubhub/

echo "stopping and rebuilding the containers"
docker-compose down
docker-compose up -d --build
docker-compose -f ./docker-compose.prod.yml up -d --build
echo "Updated frontend"
# EOT
32 changes: 32 additions & 0 deletions zubhub_frontend/zubhub/docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: "3.3"

services:
zubhub_frontend:
container_name: zubhub_frontend
build:
context: .
dockerfile: Dockerfile.prod
volumes:
- ./nginx/prod/default.conf:/etc/nginx/conf.d/default.conf
restart: on-failure
ports:
- "80"

reverse-proxy:
image: valian/docker-nginx-auto-ssl:1.0.0
container_name: reverse-proxy
restart: on-failure
ports:
- 80:80
- 443:443
volumes:
- ./.ssl-data:/etc/resty-auto-ssl
environment:
ALLOWED_DOMAINS: "(zubhub|www.zubhub).unstructured.studio"
SITES: "zubhub.unstructured.studio=zubhub_frontend;www.zubhub.unstructured.studio=zubhub_frontend"
FORCE_HTTPS: "true"
depends_on:
- zubhub_frontend

volumes:
.ssl-data:
23 changes: 2 additions & 21 deletions zubhub_frontend/zubhub/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,7 @@ services:
context: .
dockerfile: Dockerfile
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
- ./nginx/dev/default.conf:/etc/nginx/conf.d/default.conf
restart: on-failure
ports:
- "8080:80"

reverse-proxy:
image: valian/docker-nginx-auto-ssl:1.0.0
container_name: reverse-proxy
restart: on-failure
ports:
- 80:80
- 443:443
volumes:
- ./.ssl-data:/etc/resty-auto-ssl
environment:
ALLOWED_DOMAINS: "(zubhub|www.zubhub).unstructured.studio"
SITES: "zubhub.unstructured.studio=zubhub_frontend;www.zubhub.unstructured.studio=zubhub_frontend"
FORCE_HTTPS: "true"
depends_on:
- zubhub_frontend

volumes:
.ssl-data:
- "3000:3000"
33 changes: 33 additions & 0 deletions zubhub_frontend/zubhub/nginx/dev/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
}
server {
listen 3000;
server_name localhost;

gzip on;
gzip_min_length 1000;
gzip_buffers 4 32k;
gzip_proxied any;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
gzip_vary on;
gzip_disable “MSIE [1–6]\.(?!.*SV1)”;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}
}
File renamed without changes.
6 changes: 6 additions & 0 deletions zubhub_frontend/zubhub/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion zubhub_frontend/zubhub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@testing-library/react": "^11.1.2",
"@testing-library/user-event": "^12.2.2",
"aws-sdk": "^2.813.0",
"classnames": "^2.2.6",
"date-fns": "^2.16.1",
"formik": "^2.2.5",
"nanoid": "^3.1.20",
Expand All @@ -32,7 +33,8 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"pretty": "prettier --config ./.prettierrc.yaml --write \"src/**/*.{js,jsx}\""
},
"eslintConfig": {
"extends": [
Expand All @@ -51,5 +53,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"prettier": "2.2.1"
}
}
Loading

0 comments on commit e27329f

Please sign in to comment.