Skip to content

Commit

Permalink
Merge pull request #13 from oracle/feature/lifecycle_deploy_assets
Browse files Browse the repository at this point in the history
deploy_assets_lifecycle_plus_fixes
  • Loading branch information
junior authored Sep 17, 2019
2 parents ff2e471 + 3386b2e commit 5500c16
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 17 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ that creates all the required resources and configures the application on the cr

The steps below guide you through deploying the application on your tenancy using the OCI Resource Manager.

1. Download the latest [`mushop-v1.0.0-basic-stack.zip`](../../releases/download/v1.0.0/mushop-v1.0.0-basic-stack.zip) file.
2. [Login](https://console.us-phoenix-1.oraclecloud.com/resourcemanager/stacks/create) to Oracle Cloud Infrastructure to import the stack
1. Download the latest [`mushop-basic-stack-v1.0.1.zip`](../../releases/download/v1.0.1/mushop-basic-stack-v1.0.1.zip) file.
2. [Login](https://console.us-ashburn-1.oraclecloud.com/resourcemanager/stacks/create) to Oracle Cloud Infrastructure to import the stack
> `Home > Solutions & Platform > Resource Manager > Stacks > Create Stack`
3. Upload the `mushop-v1.0.0-basic-stack.zip` file that was downloaded earlier, and provide a name and description for the stack
3. Upload the `mushop-basic-stack-v1.0.1.zip` file that was downloaded earlier, and provide a name and description for the stack
4. Configure the stack
1. **Database Name** - You can choose to provide a database name (optional)
2. **Node Count** - Select if you want to deploy one or two application instances.
Expand Down
2 changes: 1 addition & 1 deletion deploy/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The application uses a typical topology for a 3-tier web application as follows

- Generate Stack Zip Package for OCI Resource Manager

`docker run -v $PWD:/transfer --rm --entrypoint cp mushop-basic:latest /package/mushop-basic.zip /transfer/mushop-basic-stack.zip`
`docker run -v $PWD:/transfer --rm --entrypoint cp mushop-basic:latest /package/mushop-basic-stack.zip /transfer/mushop-basic-stack.zip`

This creates a `.zip` file in your working directory that can be imported in to OCI Resource Manager.

Expand Down
12 changes: 12 additions & 0 deletions deploy/basic/terraform/storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,16 @@ resource "oci_objectstorage_preauthrequest" "mushop_lite_preauth" {
object = "${oci_objectstorage_object.mushop_basic.object}"
}

resource "oci_objectstorage_object_lifecycle_policy" "mushop_deploy_assets_lifecycle_policy" {
namespace = "${data.oci_objectstorage_namespace.user_namespace.namespace}"
bucket = "${oci_objectstorage_bucket.mushop.name}"

rules {
action = "DELETE"
is_enabled = "true"
name = "mushop-delete-deploy-assets-rule"
time_amount = "1"
time_unit = "DAYS"

}
}
2 changes: 2 additions & 0 deletions src/catalogue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ To run it use:
./catalogue
```

Note: When doing development and running local, you need to set the variables to connect to the Oracle Autonomous Database. OADB_USER, OADB_PW and OADB_SERVICE need to be load as environment variables. Using [.env](https://docs.docker.com/compose/env-file/) file or EXPORT.

#### Docker
`docker-compose up`

Expand Down
2 changes: 1 addition & 1 deletion src/catalogue/cmd/cataloguesvc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func init() {

func main() {
var (
port = flag.String("port", getEnv("CATALOGUE_PORT", "80"), "Port to bind HTTP listener") // TODO(pb): should be -addr, default ":80"
port = flag.String("port", getEnv("CATALOGUE_PORT", "80"), "Port to bind HTTP listener")
images = flag.String("images", "./images/", "Image path")
connectString = flag.String("CONNECTSTRING", os.Getenv("OADB_USER")+"/"+os.Getenv("OADB_PW")+"@"+os.Getenv("OADB_SERVICE"), "Connection String: [username[/password]@][tnsname]]")
zip = flag.String("zipkin", os.Getenv("ZIPKIN"), "Zipkin address")
Expand Down
52 changes: 52 additions & 0 deletions src/catalogue/docker/docker-compose-zipkin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
# 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.
#

version: '2'

services:
catalogue:
build:
context: ..
dockerfile: ./Dockerfile
image: mushop/catalogue
hostname: catalogue
restart: always
cap_drop:
- all
cap_add:
- NET_BIND_SERVICE
read_only: true
volumes:
- Wallet_Creds:/usr/lib/oracle/19.3/client64/lib/network/admin/
environment:
- reschedule=on-node-failure
- OADB_USER=${OADB_USER}
- OADB_PW=${OADB_PW}
- OADB_SERVICE=${OADB_SERVICE}
- ZIPKIN=http://zipkin:9411/api/v1/spans
ports:
- "8080:80"

zipkin:
image: openzipkin/zipkin
hostname: zipkin
restart: always
cap_drop:
- all
cap_add:
- CHOWN
- SETGID
- SETUID
read_only: true
tmpfs:
- /tmp:rw,noexec,nosuid
environment:
- reschedule=on-node-failure
ports:
- "9411:9411"

zipkinseed:
image: alpine
command: /bin/sh -c 'sleep 10 ; wget http://catalogue/health ; wget http://catalogue/catalogue ; wget http://catalogue/catalogue/size ; wget http://catalogue/categories'
6 changes: 3 additions & 3 deletions src/catalogue/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ services:
- Wallet_Creds:/usr/lib/oracle/19.3/client64/lib/network/admin/
environment:
- reschedule=on-node-failure
- OADB_USER=catalogue_user
- OADB_PW=default_Password1
- OADB_SERVICE=mcatalogue_tp
- OADB_USER=${OADB_USER}
- OADB_PW=${OADB_PW}
- OADB_SERVICE=${OADB_SERVICE}
ports:
- "8080:80"

9 changes: 0 additions & 9 deletions src/catalogue/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,3 @@ func cut(products []Product, pageNum, pageSize int) []Product {
}
return products[start:end]
}

func contains(s []string, e string) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}

0 comments on commit 5500c16

Please sign in to comment.