-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
59 changed files
with
1,259 additions
and
19,319 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,12 @@ | ||
COMPOSE_PROJECT_NAME=my-weather-app | ||
|
||
NODE_ENV=production | ||
ENV_SERVER_API_MONGODB_URI=mongodb://mongo-service:27017 | ||
ENV_SERVER_API_ALLOW_HOSTS=* | ||
ENV_SERVER_API_PORT=30001 | ||
|
||
ENV_WEBAPP_NODE_ENV=prod | ||
ENV_WEBAPP_PORT=80 | ||
|
||
ENV_FRONTEND_IMAGE_TAG=danmgs/weather-app-frontend | ||
ENV_BACKEND_IMAGE_TAG=danmgs/weather-app-backend |
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 |
---|---|---|
|
@@ -33,6 +33,7 @@ npm-debug.log | |
testem.log | ||
/typings | ||
yarn-error.log | ||
*.lock.json | ||
|
||
# e2e | ||
/e2e/*.js | ||
|
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 @@ | ||
language: node_js | ||
node_js: | ||
- "10" | ||
|
||
# whitelist | ||
branches: | ||
only: | ||
- /.*/ | ||
|
||
script: | ||
- sh ./travis-script.sh | ||
|
||
notifications: | ||
- email: false |
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,75 @@ | ||
{ | ||
"AWSEBDockerrunVersion": 2, | ||
"volumes": [ | ||
{ | ||
"name": "mongodata", | ||
"host": { | ||
"sourcePath": "/var/app/current/mongodata/data/db" | ||
} | ||
} | ||
], | ||
"containerDefinitions": [ | ||
{ | ||
"name": "mongo-service", | ||
"image": "mongo:latest", | ||
"hostname": "mongo-service", | ||
"essential": true, | ||
"memory": 512, | ||
"mountPoints": [ | ||
{ | ||
"sourceVolume": "mongodata", | ||
"containerPath": "/data/db" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "app-backend", | ||
"image": "danmgs/weather-app-backend:1.1", | ||
"hostname": "app-backend", | ||
"environment": [ | ||
{ | ||
"name": "NODE_ENV", | ||
"value": "production" | ||
}, | ||
{ | ||
"name": "ENV_SERVER_API_MONGODB_URI", | ||
"value": "mongodb://mongo-service:27017" | ||
}, | ||
{ | ||
"name": "ENV_SERVER_API_ALLOW_HOSTS", | ||
"value": "*" | ||
}, | ||
{ | ||
"name": "ENV_SERVER_API_PORT", | ||
"value": "30001" | ||
} | ||
], | ||
"essential": true, | ||
"memory": 256, | ||
"portMappings": [ | ||
{ | ||
"hostPort": 30001, | ||
"containerPort": 30001 | ||
} | ||
], | ||
"links": [ | ||
"mongo-service" | ||
] | ||
}, | ||
{ | ||
"name": "app-frontend", | ||
"image": "danmgs/weather-app-frontend:1.1", | ||
"essential": true, | ||
"memory": 128, | ||
"portMappings": [ | ||
{ | ||
"hostPort": 80, | ||
"containerPort": 80 | ||
} | ||
], | ||
"links": [ | ||
"app-backend" | ||
] | ||
} | ||
] | ||
} |
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,36 @@ | ||
--- | ||
version: '3' | ||
services: | ||
|
||
mongo-service: | ||
image: mongo:latest | ||
volumes: | ||
- mongodata:/data/db | ||
restart: always | ||
|
||
app-backend: | ||
container_name: app-backend | ||
image: danmgs/weather-app-backend:1.1 | ||
environment: | ||
NODE_ENV: production | ||
ENV_SERVER_API_MONGODB_URI: mongodb://mongo-service:27017 | ||
ENV_SERVER_API_ALLOW_HOSTS: "*" | ||
ENV_SERVER_API_PORT: 30001 | ||
ports: | ||
- "30001:30001" | ||
depends_on: | ||
- mongo-service | ||
restart: always | ||
|
||
app-frontend: | ||
container_name: app-frontend | ||
image: danmgs/weather-app-frontend:1.1 | ||
working_dir: /usr/src/app | ||
ports: | ||
- "80:80" | ||
depends_on: | ||
- app-backend | ||
restart: always | ||
|
||
volumes: | ||
mongodata: |
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,45 @@ | ||
--- | ||
version: '3' | ||
services: | ||
|
||
mongo-service: | ||
image: mongo:latest | ||
volumes: | ||
- mongodata:/data/db | ||
restart: always | ||
|
||
app-backend: | ||
build: | ||
context: ./server | ||
dockerfile: Dockerfile | ||
container_name: app-backend | ||
image: ${ENV_BACKEND_IMAGE_TAG} | ||
environment: | ||
NODE_ENV: ${NODE_ENV} | ||
ENV_SERVER_API_MONGODB_URI: ${ENV_SERVER_API_MONGODB_URI} | ||
ENV_SERVER_API_ALLOW_HOSTS: ${ENV_SERVER_API_ALLOW_HOSTS} | ||
ENV_SERVER_API_PORT: ${ENV_SERVER_API_PORT} | ||
ports: | ||
- ${ENV_SERVER_API_PORT}:${ENV_SERVER_API_PORT} | ||
depends_on: | ||
- mongo-service | ||
restart: always | ||
|
||
app-frontend: | ||
build: | ||
context: ./public | ||
dockerfile: Dockerfile | ||
args: | ||
- NODE_ENV=${ENV_WEBAPP_NODE_ENV} # development / staging / prod | ||
container_name: app-frontend | ||
image: ${ENV_FRONTEND_IMAGE_TAG} | ||
working_dir: /usr/src/app | ||
ports: | ||
- ${ENV_WEBAPP_PORT}:${ENV_WEBAPP_PORT} | ||
depends_on: | ||
- app-backend | ||
restart: always | ||
|
||
# https://github.com/docker-library/mongo/issues/74#issuecomment-350034758 | ||
volumes: | ||
mongodata: |
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,18 @@ | ||
# Purpose: script to push image into your docker hub. Must be logged in first. | ||
# Usage: powershell docker-push.ps1 -tag <version> | ||
Param([parameter(Mandatory=$true, | ||
HelpMessage="Enter docker tag version")] | ||
$tag) | ||
|
||
write-output "Entered tag = $tag" | ||
|
||
# Build the images using tag name specify via image attributes in the docker-compose files. | ||
docker-compose build | ||
|
||
# Tags the images | ||
docker tag danmgs/weather-app-frontend danmgs/weather-app-frontend:$tag | ||
docker tag danmgs/weather-app-backend danmgs/weather-app-backend:$tag | ||
|
||
# Push the images | ||
docker push danmgs/weather-app-frontend:$tag | ||
docker push danmgs/weather-app-backend:$tag |
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,21 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: client-web-deployment | ||
namespace: weatherapp | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
component: client-web | ||
template: | ||
metadata: | ||
labels: | ||
component: client-web | ||
spec: | ||
containers: | ||
- name: client-web-cont | ||
image: danmgs/weatherapp-client:latest | ||
ports: | ||
- containerPort: 4200 | ||
args: ["npm", "run" , "start-for-k8s"] |
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 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: client-web-service | ||
namespace: weatherapp | ||
spec: | ||
selector: | ||
component: client-web | ||
ports: | ||
- port: 4200 | ||
targetPort: 4200 | ||
nodePort: 31515 | ||
type: NodePort | ||
|
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,6 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: weatherapp | ||
labels: | ||
component: weatherapp |
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,11 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: database-persistent-volume-claim | ||
namespace: weatherapp | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 1Gi |
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 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: mongodb-deployment | ||
namespace: weatherapp | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
component: mongodatabase | ||
template: | ||
metadata: | ||
labels: | ||
component: mongodatabase | ||
spec: | ||
volumes: | ||
- name: mongo-storage | ||
persistentVolumeClaim: | ||
claimName: database-persistent-volume-claim | ||
containers: | ||
- name: mongodb-cont | ||
image: mongo | ||
ports: | ||
- containerPort: 27017 | ||
volumeMounts: | ||
- name: mongo-storage | ||
mountPath: /data/data-mongo |
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,12 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: mongodb-service | ||
namespace: weatherapp | ||
spec: | ||
selector: | ||
component: mongodatabase | ||
ports: | ||
- port: 27017 | ||
targetPort: 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,23 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: server-api-deployment | ||
namespace: weatherapp | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
component: server-api | ||
template: | ||
metadata: | ||
labels: | ||
component: server-api | ||
spec: | ||
containers: | ||
- name: server-api-cont | ||
image: danmgs/weatherapp-server:latest | ||
ports: | ||
- containerPort: 30001 | ||
env: | ||
- name: MONGODB_URI | ||
value: mongodb://mongodb-service |
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 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: server-api-service | ||
namespace: weatherapp | ||
spec: | ||
selector: | ||
component: server-api | ||
ports: | ||
- port: 30001 | ||
targetPort: 30001 | ||
# nodePort: 31516 | ||
# type: NodePort |
Oops, something went wrong.