Skip to content

Commit

Permalink
chore(refactor): files and folders
Browse files Browse the repository at this point in the history
  • Loading branch information
koitoror committed Jul 15, 2021
1 parent 050da1a commit 52142a0
Show file tree
Hide file tree
Showing 47 changed files with 82 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ __pycache__
hs_err_pid*

.env
storybooks/config/config.env
debby-hand-knits/config/config.env
node_modules
*key.json
.terraform/
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM node:14-slim
FROM node:16-slim
# FROM node:14-slim

WORKDIR /usr/src/app

Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ terraform-action: check-env

###

SSH_STRING=koitoror@storybooks-vm-$(ENV)
SSH_STRING=koitoror@debby-hand-knits-vm-$(ENV)
OAUTH_CLIENT_ID=542106262510-8ki8hqgu7kmj2b3arjdqvcth3959kmmv.apps.googleusercontent.com

GITHUB_SHA?=latest
LOCAL_TAG=debby-app:$(GITHUB_SHA)
# REMOTE_TAG=gcr.io/$(PROJECT_ID)/$(LOCAL_TAG)
REMOTE_TAG=ghcr.io/koitoror/$(PROJECT_ID)/$(LOCAL_TAG)

CONTAINER_NAME=storybooks-api
DB_NAME=storybooks
CONTAINER_NAME=debby-hand-knits-api
DB_NAME=debby-hand-knits

ssh: check-env
gcloud compute ssh $(SSH_STRING) \
Expand Down Expand Up @@ -87,7 +87,7 @@ deploy: check-env
--restart=unless-stopped \
-p 80:3000 \
-e PORT=3000 \
-e \"MONGO_URI=mongodb+srv://storybooks-user-$(ENV):$(call get-secret,atlas_user_password_$(ENV))@storybooks-$(ENV)cluster0.gps3l.mongodb.net/$(DB_NAME)?retryWrites=true&w=majority\" \
-e \"MONGO_URI=mongodb+srv://debby-hand-knits-user-$(ENV):$(call get-secret,atlas_user_password_$(ENV))@debby-hand-knits-$(ENV)cluster0.gps3l.mongodb.net/$(DB_NAME)?retryWrites=true&w=majority\" \
-e GOOGLE_CLIENT_ID=$(OAUTH_CLIENT_ID) \
-e GOOGLE_CLIENT_SECRET=$(call get-secret,google_oauth_client_secret) \
$(REMOTE_TAG) \
Expand Down
6 changes: 4 additions & 2 deletions backend-order_service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
FROM python:3.8-alpine
FROM python:3.9-alpine
# FROM python:3.8-alpine

MAINTAINER Daniel Kamar

COPY ./app/requirements.txt /app/requirements.txt

WORKDIR /app

RUN apk add --no-cache py3-setuptools
RUN apk add py3-setuptools
# RUN apk add --no-cache py3-setuptools

RUN apk add --update \
bash \
Expand Down
10 changes: 6 additions & 4 deletions backend-order_service/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
version: '3'

volumes:
order-db-data:

services:
order:
build:
Expand All @@ -17,10 +14,15 @@ services:
- order_db

order_db:
image: mysql:5.7.22
# image: mysql:5.7.22
image: mysql:5.7.34
volumes:
- product-db-data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=test
- MYSQL_DATABASE=order
restart: always

volumes:
order-db-data:

6 changes: 4 additions & 2 deletions backend-product_service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
FROM python:3.8-alpine
FROM python:3.9-alpine
# FROM python:3.8-alpine

LABEL Daniel Kamar

COPY ./app/requirements.txt /app/requirements.txt

WORKDIR /app

RUN apk add --no-cache py3-setuptools
RUN apk add py3-setuptools
# RUN apk add --no-cache py3-setuptools

# RUN apk add \
# build-dep \
Expand Down
11 changes: 6 additions & 5 deletions backend-product_service/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
version: '3'

volumes:
product-db-data:

services:
product:
build:
Expand All @@ -15,10 +12,14 @@ services:
- product_db

product_db:
image: mysql:5.7.22
# image: mysql:5.7.22
image: mysql:5.7.34
volumes:
- product-db-data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=test
- MYSQL_DATABASE=product
restart: always
restart: always

volumes:
product-db-data:
6 changes: 4 additions & 2 deletions backend-user_service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
FROM python:3.8-alpine
FROM python:3.9-alpine
# FROM python:3.8-alpine

MAINTAINER Daniel Kamar

COPY ./app/requirements.txt /app/requirements.txt

WORKDIR /app

RUN apk add --no-cache py3-setuptools
RUN apk add py3-setuptools
# RUN apk add --no-cache py3-setuptools

RUN apk add --update \
bash \
Expand Down
17 changes: 9 additions & 8 deletions backend-user_service/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
version: '3'

volumes:
user-db-data:

networks:
user-network:
driver: bridge

services:
user:
build:
Expand All @@ -22,7 +15,8 @@ services:
- user-network

user_db:
image: mysql:5.7.22
# image: mysql:5.7.22
image: mysql:5.7.34
volumes:
- user-db-data:/var/lib/mysql
environment:
Expand All @@ -31,3 +25,10 @@ services:
restart: always
networks:
- user-network

volumes:
user-db-data:

networks:
user-network:
driver: bridge
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions storybooks/readme.md → debby-hand-knits/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# StoryBooks
# Debby-Hand-Knits

https://storybooks.imani.events
https://debby.ga

> Create public and private stories from your life
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 18 additions & 16 deletions docker-compose.deploy.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
version: '3'

volumes:
product-node-modules:
user-node-modules:
order-node-modules:
product-db-data:
user-db-data:
order-db-data:

networks:
order-network:
driver: bridge

services:
frontend:
build:
context: ./frontend-service/
# context: .
ports:
- 80:5000
- 5000:5000
volumes:
- ./frontend-service/app:/app
# - ./app:/app
Expand Down Expand Up @@ -46,7 +35,8 @@ services:
- order-network

product_db:
image: mysql:5.7.22
# image: mysql:5.7.22
image: mysql:5.7.34
volumes:
- product-db-data:/var/lib/mysql
environment:
Expand All @@ -71,7 +61,8 @@ services:
- order-network

user_db:
image: mysql:5.7.22
# image: mysql:5.7.22
image: mysql:5.7.34
volumes:
- user-db-data:/var/lib/mysql
environment:
Expand All @@ -81,7 +72,6 @@ services:
networks:
- order-network


order:
build:
context: ./backend-order_service/
Expand All @@ -97,7 +87,8 @@ services:
- order-network

order_db:
image: mysql:5.7.22
# image: mysql:5.7.22
image: mysql:5.7.34
volumes:
- order-db-data:/var/lib/mysql
environment:
Expand All @@ -107,3 +98,14 @@ services:
networks:
- order-network

volumes:
product-node-modules:
user-node-modules:
order-node-modules:
product-db-data:
user-db-data:
order-db-data:

networks:
order-network:
driver: bridge
17 changes: 10 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
version: '3'

services:
api-server:
build: ./
entrypoint: [ "npm", "run", "dev" ]
env_file: ./storybooks/config/config.env
entrypoint: ['npm', 'run', 'dev']
env_file: ./debby-hand-knits/config/config.env
ports:
- '3000:3000'
networks:
- storybooks-app
- debby-hand-knits-app
volumes:
- ./:/usr/src/app
- /usr/src/app/node_modules
depends_on:
- mongo

mongo:
image: mongo:3.6-xenial
# image: mongo:3.6-xenial
image: mongo:4.0.25-xenial
environment:
- MONGO_INITDB_DATABASE=storybooks
- MONGO_INITDB_DATABASE=debby-hand-knits
ports:
- '27017:27017'
networks:
- storybooks-app
- debby-hand-knits-app
volumes:
- mongo-data:/data/db

networks:
storybooks-app:
debby-hand-knits-app:
driver: bridge

volumes:
Expand Down
3 changes: 2 additions & 1 deletion frontend-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3-alpine
FROM python:3.9-alpine
# FROM python:3-alpine

MAINTAINER Daniel Kamar

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "debby-hand-knits",
"version": "1.0.0",
"description": "App for creating public and private stories",
"main": "storybooks/app.js",
"main": "debby-hand-knits/app.js",
"scripts": {
"start": "cross-env NODE_ENV=production node storybooks/app",
"dev": "cross-env NODE_ENV=development nodemon storybooks/app"
"start": "cross-env NODE_ENV=production node debby-hand-knits/app",
"dev": "cross-env NODE_ENV=development nodemon debby-hand-knits/app"
},
"author": "Daniel Kamar",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions terraform/atlas.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ resource "mongodbatlas_cluster" "mongo_cluster" {

# db user
resource "mongodbatlas_database_user" "mongo_user" {
username = "storybooks-user-${terraform.workspace}"
username = "debby-hand-knits-user-${terraform.workspace}"
password = var.atlas_user_password
project_id = var.atlas_project_id
auth_database_name = "admin"

roles {
role_name = "readWrite"
database_name = "storybooks"
database_name = "debby-hand-knits"
}
}

Expand Down
2 changes: 1 addition & 1 deletion terraform/cloudflare.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ data "cloudflare_zones" "cf_zones" {
# DNS A record
resource "cloudflare_record" "dns_record" {
zone_id = data.cloudflare_zones.cf_zones.zones[0].id
name = "storybooks${terraform.workspace == "prod" ? "" : "-${terraform.workspace}"}"
name = "debby-hand-knits${terraform.workspace == "prod" ? "" : "-${terraform.workspace}"}"
value = google_compute_address.ip_address.address
type = "A"
proxied = true
Expand Down
2 changes: 1 addition & 1 deletion terraform/environments/common.tfvars
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app_name="storybooks"
app_name="debby-hand-knits"

gcp_project_id="debby-hand-knits"

Expand Down
2 changes: 1 addition & 1 deletion terraform/gcp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ provider "google" {

# IP ADDRESS
resource "google_compute_address" "ip_address" {
name = "storybooks-ip-${terraform.workspace}"
name = "debby-hand-knits-ip-${terraform.workspace}"
}

# NETWORK
Expand Down
2 changes: 1 addition & 1 deletion terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
terraform {
backend "gcs" {
bucket = "debby-hand-knits-terraform"
prefix = "/state/storybooks"
prefix = "/state/debby-hand-knits"
}
}

0 comments on commit 52142a0

Please sign in to comment.