-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/SCK-SEAL-TEAM-One/shoppin…
- Loading branch information
Showing
11 changed files
with
177 additions
and
3 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,3 @@ | ||
FROM nginx:1.16-alpine | ||
|
||
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf |
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,13 @@ | ||
apiVersion: extentions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: store-service | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: store-service | ||
spec: | ||
restartPolicy: Always | ||
|
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: Service | ||
metadata: | ||
name: store-service | ||
spec: | ||
selector: | ||
app: store-service | ||
port: | ||
- protocal: TCP | ||
port: 8000 | ||
targetPort: 8000 |
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: store-web | ||
labels: | ||
app: store-web | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: store-web | ||
template: | ||
metadata: | ||
labels: | ||
app: store-web | ||
spec: | ||
containers: | ||
- name: store-web | ||
image: sckseal/shoppingcart-web:latest | ||
ports: | ||
- containerPort: 3000 |
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,56 @@ | ||
#https://steveholgado.com/nginx-for-nextjs/#nginx | ||
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=7d use_temp_path=off; | ||
|
||
upstream store-service { | ||
server store-service:8000; | ||
} | ||
|
||
upstream store-ui { | ||
server store-ui:3000; | ||
} | ||
|
||
server { | ||
listen 80 default_server; | ||
|
||
server_name _; | ||
|
||
server_tokens off; | ||
|
||
gzip on; | ||
gzip_proxied any; | ||
gzip_comp_level 4; | ||
gzip_types text/css application/javascript image/svg+xml; | ||
|
||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection 'upgrade'; | ||
proxy_set_header Host $host; | ||
proxy_cache_bypass $http_upgrade; | ||
|
||
location /_next/static { | ||
proxy_cache STATIC; | ||
proxy_pass http://store-ui; | ||
|
||
# For testing cache - remove before deploying to production | ||
add_header X-Cache-Status $upstream_cache_status; | ||
} | ||
|
||
location /static { | ||
proxy_cache STATIC; | ||
proxy_ignore_headers Cache-Control; | ||
proxy_cache_valid 60m; | ||
proxy_pass http://store-ui; | ||
|
||
# For testing cache - remove before deploying to production | ||
add_header X-Cache-Status $upstream_cache_status; | ||
} | ||
|
||
location /api { | ||
proxy_pass http://store-service; | ||
} | ||
|
||
|
||
location / { | ||
proxy_pass http://store-ui; | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,19 @@ | ||
|
||
import fetch from 'isomorphic-unfetch' | ||
import useSWR from 'swr' | ||
|
||
const API_URL = '/api/v1/health' | ||
async function fetcher() { | ||
const res = await fetch(API_URL) | ||
const json = await res.json() | ||
return json | ||
} | ||
|
||
function HealthCheck(){ | ||
const { data, error } = useSWR('/repos/zeit/next.js', fetcher) | ||
if (error) return <div>failed to load</div> | ||
if (!data) return <div>loading...</div> | ||
return <div>Next stars: {data.message.Name}</div> | ||
} | ||
|
||
export default HealthCheck |