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
0 parents
commit b26c85c
Showing
312 changed files
with
52,136 additions
and
0 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,72 @@ | ||
.DS_Store | ||
|
||
## Secrets | ||
credentials.txt | ||
credentials.env | ||
Wallet_* | ||
**/.env | ||
deploy/helm-chart/**/secrets/* | ||
!deploy/helm-chart/**/secrets/*.md | ||
|
||
## Folders | ||
bin/ | ||
**/.gradle/** | ||
**/.settings/** | ||
**/build/** | ||
**/.vscode/** | ||
**/.project | ||
**/.classpath | ||
installs/ | ||
|
||
# Log file | ||
*.log | ||
|
||
### Go ### | ||
# Binaries for programs and plugins | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
### Go Patch ### | ||
vendor/ | ||
Godeps/ | ||
pkg/ | ||
|
||
### Java ### | ||
# Compiled class file | ||
*.class | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
### Terraform ### | ||
# Local .terraform directories | ||
**/.terraform/* | ||
|
||
# .tfstate files | ||
*.tfstate | ||
*.tfstate.* | ||
|
||
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most | ||
# .tfvars files are managed as part of configuration and so should be included in | ||
# version control. | ||
# | ||
*.tfvars | ||
|
||
# Ignore override files as they are usually used to override resources locally and so | ||
# are not checked in | ||
override.tf | ||
override.tf.json | ||
*_override.tf | ||
*_override.tf.json |
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 @@ | ||
Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. | ||
|
||
The Universal Permissive License (UPL), Version 1.0 | ||
|
||
Subject to the condition set forth below, permission is hereby granted to any person obtaining a copy of this | ||
software, associated documentation and/or data (collectively the "Software"), free of charge and under any and | ||
all copyright rights in the Software, and any and all patent rights owned or freely licensable by each licensor | ||
hereunder covering either (i) the unmodified Software as contributed to or provided by such licensor, or | ||
(ii) the Larger Works (as defined below), to deal in both | ||
|
||
(a) the Software, and | ||
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if one is included with the Software | ||
(each a “Larger Work” to which the Software is contributed by such licensors), | ||
|
||
without restriction, including without limitation the rights to copy, create derivative works of, display, | ||
perform, and distribute the Software and make, use, sell, offer for sale, import, export, have made, and have | ||
sold the Software and the Larger Work(s), and to sublicense the foregoing rights on either these or other terms. | ||
|
||
This license is subject to the following condition: | ||
The above copyright notice and either this complete permission notice or at a minimum a reference to the UPL must | ||
be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO | ||
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
IN THE SOFTWARE. |
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,7 @@ | ||
# oci-quickstart-cloudnative | ||
|
||
These are Terraform modules that deploy MuShop demo on [Oracle Cloud Infrastructure (OCI)](https://cloud.oracle.com/en_US/cloud-infrastructure). They are developed by Oracle. | ||
|
||
* [lite](lite) deploys the lite version of MuShop, light enough to run on the Always Free tier. Deploys the UI (Storefront), API service and the Catalogue service connected to the ATP. | ||
|
||
Please follow the instructions in [lite](deploy/terraform/lite) folders to deploy. |
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,142 @@ | ||
# | ||
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. | ||
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. | ||
# | ||
|
||
##### Oracle Instant Client version | ||
ARG oracleClientVersion=19.3 | ||
|
||
##### Node version | ||
ARG nodeVersion=10 | ||
|
||
############################### | ||
# ----- STOREFRONT ----- # | ||
# Build stage (node/npm) # | ||
############################### | ||
FROM node:10-alpine as storefront-builder | ||
|
||
RUN apk update && apk add --no-cache \ | ||
autoconf \ | ||
automake \ | ||
bash \ | ||
g++ \ | ||
libtool \ | ||
libc6-compat \ | ||
libjpeg-turbo-dev \ | ||
libpng-dev \ | ||
make \ | ||
nasm | ||
|
||
RUN npm config set loglevel warn \ | ||
&& npm set progress=false | ||
|
||
# install dependencies | ||
COPY src/storefront/package.json /tmp/package.json | ||
COPY src/storefront/package-lock.json /tmp/package-lock.json | ||
RUN cd /tmp && npm ci | ||
RUN mkdir -p /app/storefront && cp -a /tmp/node_modules /app/storefront/ | ||
RUN rm -rf /tmp/node_modules | ||
|
||
# copy source and build | ||
WORKDIR /app/storefront | ||
COPY src/storefront/src src | ||
COPY src/storefront/*.js* ./ | ||
COPY src/storefront/VERSION VERSION | ||
|
||
ARG STATIC_ASSET_URL | ||
ENV STATIC_ASSET_URL ${STATIC_ASSET_URL:-""} | ||
ENV NODE_ENV "production" | ||
RUN npm run build | ||
# ----- STOREFRONT ----- # | ||
|
||
############################### | ||
# ----- API Gateway ----- # | ||
# Build stage (node/npm) # | ||
############################### | ||
FROM node:10-alpine as api-builder | ||
|
||
WORKDIR /app/api | ||
COPY src/api/. . | ||
|
||
# Prune | ||
RUN rm -rf test scripts node_modules | ||
# ----- API Gateway ----- # | ||
|
||
############################### | ||
# ------ Catalogue ------ # | ||
# Build stage (Go Build) # | ||
############################### | ||
|
||
# ##### Go Builder image | ||
FROM golang:1.13 AS catalogue-builder | ||
WORKDIR /go/src/mushop/catalogue | ||
|
||
# # Catalogue Go Source | ||
COPY src/catalogue/cmd/cataloguesvc/*.go cmd/cataloguesvc/ | ||
COPY src/catalogue/*.go ./ | ||
COPY src/catalogue/go.mod ./ | ||
|
||
# # Build Catalogue service | ||
RUN GO111MODULE=on GOARCH=amd64 GOOS=linux \ | ||
go build -a \ | ||
-ldflags="-s -w" \ | ||
-installsuffix cgo \ | ||
-o /catalogue mushop/catalogue/cmd/cataloguesvc | ||
|
||
# ------ Catalogue ------ # | ||
|
||
############################### | ||
# ----- Base Image ------ # | ||
# Everything needed # | ||
############################### | ||
|
||
##### Base image with Oracle Instant Client Basic Lite | ||
FROM oraclelinux:7-slim AS base | ||
ARG oracleClientVersion | ||
ARG nodeVersion | ||
RUN yum update -y && \ | ||
yum -y install oracle-release-el7 && \ | ||
yum-config-manager --enable ol7_oracle_instantclient && \ | ||
yum -y install oracle-instantclient${oracleClientVersion}-basiclite && \ | ||
yum install -y gcc-c++ make sudo zip && \ | ||
curl -sL https://rpm.nodesource.com/setup_${nodeVersion}.x | sudo -E bash - && \ | ||
yum -y install nodejs && \ | ||
yum -y install httpd && \ | ||
yum clean all && \ | ||
rm -rf /var/cache/yum | ||
|
||
COPY deploy/monolith-lite/httpd.conf /etc/httpd/conf/ | ||
COPY deploy/monolith-lite/entrypoint.sh / | ||
RUN chmod +x /entrypoint.sh | ||
|
||
# ----- Base Image ------ # | ||
|
||
##### Runtime Image | ||
FROM base | ||
ARG oracleClientVersion | ||
ARG nodeVersion | ||
WORKDIR / | ||
# Support for Offline local image. Online image on OCI Object Storage | ||
COPY src/catalogue/images/ images/ | ||
|
||
# Copy Services apps | ||
COPY --from=storefront-builder /app/storefront/build /app/storefront | ||
COPY --from=api-builder /app/api /app/api | ||
COPY --from=catalogue-builder /catalogue /app/catalogue/catalogue | ||
|
||
# Create zip package of the Apps and local images | ||
RUN mkdir /package && GZIP=-9 tar cvzf /package/mushop-lite-mono.tar.gz /app /images | ||
|
||
# Create ORM package | ||
COPY deploy/terraform/lite /lite | ||
COPY deploy/monolith-lite/httpd.conf /lite/scripts | ||
COPY deploy/monolith-lite/entrypoint.sh /lite/scripts | ||
RUN cp /package/mushop-lite-mono.tar.gz /lite/scripts && \ | ||
cd /lite && zip -r /package/mushop-lite-mono-stack.zip . | ||
|
||
VOLUME ["/usr/lib/oracle/${oracleClientVersion}/client64/lib/network/admin/"] | ||
VOLUME ["/transfer/"] | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
EXPOSE 80 | ||
EXPOSE 3000 | ||
EXPOSE 3005 |
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,37 @@ | ||
# Build | ||
|
||
- Clone MuShop | ||
- From the root of the repo exeucte the command: | ||
`docker build -t mushop-lite-mono -f deploy/monolith-lite/Dockerfile .` | ||
|
||
# [Docker] Run | ||
|
||
- `docker run --rm -it -p 80:80 -p 3000:3000 -p 3005:3005 mushop-lite-mono:latest` | ||
|
||
# [Docker] Run with the wallet extracted locally | ||
|
||
- `docker run --rm -it -v $PWD/Wallet_Creds:/usr/lib/oracle/19.3/client64/lib/network/admin/ -e "OADB_USER=catalogue_user" -e "OADB_PW=default_Password1" -e "OADB_SERVICE=mcatalogue_tp" -p 80:80 -p 3000:3000 -p 3005:3005 mushop-lite-mono:latest` | ||
|
||
# [Monolith] Copy generated App Zip Package for VM | ||
|
||
- `docker run -v $PWD:/transfer --rm --entrypoint cp mushop-lite-mono:latest /package/mushop-lite-mono.tar.gz /transfer/mushop-lite-mono.tar.gz` | ||
|
||
# [Monolith] Copy generated Generate Stack Zip Package for the ORM | ||
|
||
- `docker run -v $PWD:/transfer --rm --entrypoint cp mushop-lite-mono:latest /package/mushop-lite-mono-stack.zip /transfer/mushop-lite-mono-stack.zip` | ||
|
||
|
||
## Monolith VM requirements: | ||
|
||
- Base EL7 | ||
- oracle-instantclient19.3-basiclite | ||
- node 10.x | ||
- httpd | ||
- extract mushop-lite-mono.tar.gz (/app) | ||
- OADB Wallet to /usr/lib/oracle/19.3/client64/lib/network/admin/ | ||
- set to run entrypoint.sh on the VM start | ||
- variables: OADB_USER, OADB_PW and OADB_SERVICE | ||
|
||
# Deploy MuShop Lite Monolith to OCI Free Tier Compute Shape using the cli | ||
|
||
`oci compute instance launch --availability-domain mmXc:PHX-AD-1 --compartment-id ocid1.compartment.oc1..aaa... --shape VM.Standard.E2.1.Micro --image-id ocid1.image.oc1.phx.aaaaaaaadtmpmfm77czi5ghi5zh7uvkguu6dsecsg7kuo3eigc5663und4za --subnet-id ocid1.subnet.oc1.phx.aaa... --user-data-file micro-mushop-mono.cloud-config --display-name mushop-lite-mono-0` |
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,35 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. | ||
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. | ||
# | ||
# Description: Starts MuShop Lite - Monolith. | ||
# Return codes: 0 = | ||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | ||
# | ||
|
||
# To mock all services, change to MOCK_MODE=all | ||
export MOCK_MODE=carts,orders,users | ||
export NODE_ENV=production | ||
export CATALOGUE_PORT=3005 | ||
export CATALOGUE_URL=http://localhost:3005 | ||
export USERS_URL=http://user | ||
|
||
echo "Environment: $(uname -a)"; | ||
|
||
echo "Checking Installation..." | ||
if [ ! -d "/app/api/node_modules" ] | ||
then | ||
echo "Installing..." | ||
cd /app/api && npm ci --production | ||
cd / | ||
fi | ||
|
||
echo "Launching Storefront..."; | ||
/usr/sbin/httpd -D FOREGROUND & | ||
|
||
echo "Launching API..."; | ||
node /app/api/server.js & | ||
|
||
echo "Launching Catalogue..."; | ||
/app/catalogue/catalogue |
Oops, something went wrong.