Skip to content

Commit

Permalink
containerized solution (no k8s so far) works without known issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Finnfalter committed Jan 3, 2021
1 parent 5eb50cc commit 61cbc4b
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 10 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Rubric
* https://review.udacity.com/#!/rubrics/2804/view


# Docker

> Docker Cheat Sheet
Expand Down Expand Up @@ -75,7 +79,11 @@ docker run --env-file ../env.list --net host udagram-feed
* https://knowledge.udacity.com/questions/397631
* https://knowledge.udacity.com/questions/192623

# AWS

## S3
* ```aws s3 ls momi-303817241937-dev``` to list the content of given bucket
* ```aws s3 rm s3://momi-303817241937-dev/tea.jpg``` to remove given file

---
**NOTE**
Expand Down
2 changes: 1 addition & 1 deletion udagram-feed/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN npm ci
# Bundle app source
COPY . .

EXPOSE 8080
EXPOSE 8085

CMD [ "npm", "run", "prod" ]

Expand Down
2 changes: 1 addition & 1 deletion udagram-feed/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {V0_FEED_MODELS} from './controllers/v0/model.index';
await sequelize.sync();

const app = express();
const port = process.env.PORT || 8080;
const port = process.env.PORT || 8085;

app.use(bodyParser.json());

Expand Down
11 changes: 4 additions & 7 deletions udagram-frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
## Build
FROM beevelop/ionic:latest AS ionic
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm ci
# Bundle app source
COPY . .
RUN ionic build
## Run
FROM nginx:alpine
#COPY www /usr/share/nginx/html
COPY --from=ionic /usr/src/app/www /usr/share/nginx/html

# __CB__added
#EXPOSE 8100

# __CB__added
#CMD ["ionic", "serve"]
#CMD ["ionic", "serve", "--external"]

Expand Down
3 changes: 3 additions & 0 deletions udagram-reverse-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx:alpine

COPY nginx.conf /etc/nginx/nginx.conf
27 changes: 27 additions & 0 deletions udagram-reverse-proxy/deploy/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
service: reverseproxy
name: reverseproxy
spec:
replicas: 1
template:
metadata:
labels:
service: reverseproxy
spec:
containers:
- image: finfalter/reverse-proxy
name: reverseproxy
imagePullPolicy: Always
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "1024Mi"
cpu: "500m"
ports:
- containerPort: 8080
restartPolicy: Always
30 changes: 30 additions & 0 deletions udagram-reverse-proxy/deploy/deployment_apps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: reverseproxy
labels:
app: reverseproxy
spec:
replicas: 1
selector:
matchLabels:
app: reverseproxy
template:
metadata:
labels:
app: reverseproxy
spec:
containers:
- image: finfalter/reverse-proxy
name: reverseproxy
imagePullPolicy: Always
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "1024Mi"
cpu: "500m"
ports:
- containerPort: 8080
restartPolicy: Always
13 changes: 13 additions & 0 deletions udagram-reverse-proxy/deploy/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
labels:
service: reverseproxy
name: reverseproxy-svc
spec:
ports:
- name: "8080"
port: 8080
targetPort: 8080
selector:
service: reverseproxy
15 changes: 15 additions & 0 deletions udagram-reverse-proxy/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
events {
}
http {
server {
listen 8080;

location /api/v0/feed {
proxy_pass http://localhost:8085/api/v0/feed/;
}

location /api/v0/users {
proxy_pass http://localhost:8081/api/v0/users/;
}
}
}
2 changes: 1 addition & 1 deletion udagram-user/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN npm ci
# Bundle app source
COPY . .

EXPOSE 8080
EXPOSE 8081

CMD [ "npm", "run", "prod" ]

Expand Down

0 comments on commit 61cbc4b

Please sign in to comment.