Skip to content

Commit f2fec45

Browse files
Appid (#23)
* YAML and appid<-->kp updates * Updated generate shell script * Updated the schematics and cloudant details * Kubernetes namespace fix * Updated the pattern * Remove legacy credentials from Cloudant * Updated README.md and diagram * Removed Terraform version * Updated the default cluster name
1 parent 0754977 commit f2fec45

17 files changed

+1903
-44
lines changed

.bluemix/deploy.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"$ref": "#/messages/deploy.schematicsWorkspaceDescription"
6060
},
6161
"type": "string",
62-
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
62+
"pattern": "\\S"
6363
}
6464
},
6565
"required": [

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ local_yaml
2020

2121
#vim swap files
2222
[._]*.sw[a-p]
23+
terraform/.terraform.lock.hcl

Architecture.svg

Lines changed: 3 additions & 0 deletions
Loading

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
An older code version for this tutorial can be found in the branch [archive_classic_tekton](https://github.com/IBM-Cloud/secure-file-storage/tree/archive_classic_tekton).
1+
> An older code version for this tutorial can be found in the branch [archive_classic_tekton](https://github.com/IBM-Cloud/secure-file-storage/tree/archive_classic_tekton).
22
33
# Apply end to end security to a cloud application
44

55
The repository features a sample application that enables groups of users to upload files to a common storage pool and to provide access to those files via shareable links. The application is written in Node.js and deployed as Docker container to the IBM Cloud Kubernetes service. It leverages several security-related services and features to improve app security. It includes data encrypted with your own keys, user authentication, and security auditing.
66

77
Refer to [this tutorial](https://cloud.ibm.com/docs/solution-tutorials?topic=solution-tutorials-cloud-e2e-security) for instructions.
88

9-
![Architecture](Architecture.png)
9+
![Architecture](Architecture.svg)
1010

1111
1. The user connects to the application.
1212
2. [App ID](https://cloud.ibm.com/catalog/services/AppID) secures the application and redirects the user to the authentication page. Users can sign up from there too.
@@ -31,7 +31,7 @@ Please note that the Kubernetes cluster and the resources deployed via Terraform
3131

3232
### Deploy resources using Terraform managed by Schematics
3333

34-
Either create the Schematics workspace automatically by clicking this ["deploy link"](https://cloud.ibm.com/schematics/workspaces/create?repository=https://github.com/IBM-Cloud/secure-file-storage/tree/master/terraform&terraform_version=terraform_v0.13). Or set it up manually by going to the [Schematics workspaces](https://cloud.ibm.com/schematics/workspaces) and using https://github.com/IBM-Cloud/secure-file-storage/tree/master/terraform as source respository including path and Terraform v0.13 as runtime.
34+
Either create the Schematics workspace automatically by clicking this ["deploy link"](https://cloud.ibm.com/schematics/workspaces/create?repository=https://github.com/IBM-Cloud/secure-file-storage/tree/master/terraform). Or set it up manually by going to the [Schematics workspaces](https://cloud.ibm.com/schematics/workspaces) and using https://github.com/IBM-Cloud/secure-file-storage/tree/master/terraform as source respository including path and the latest version of Terraform runtime.
3535

3636
Configure all required variables:
3737
- **basename**: project basename which is used as prefix for names, e.g., secure-file-storage
@@ -74,6 +74,7 @@ In the dialog configure the git repository and the pipeline:
7474
- IBM Cloud API Key: click New+ (do not click Save this key in a secrets store for reuse). The API key provides the same privileges as your user id and is used during pipeline execution
7575
- Region: Region matching the toolchain is the default, but should be adjusted to where you plan to deploy the app.
7676
- Image Registry Namespace, e.g., secure-file-storage or your username
77+
- Schematics Workspace ID: Can be found under `Settings` tab of Schematics Workspace
7778
- Docker Image name: secure-file-storage default is good
7879

7980
Click **Create**.

app/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var allowAnonymousAccess = process.env.allow_anonymous || false;
1515
// Initialize Cloudant
1616
var Cloudant = require('@cloudant/cloudant');
1717
var cloudant = new Cloudant({
18-
account: process.env.cloudant_username,
18+
url: process.env.cloudant_url,
1919
plugins: [
2020
'promises',
2121
{

app/credentials.template.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Cloudant Credentials
2-
cloudant_username=
2+
cloudant_url=
33
cloudant_iam_apikey=
44
cloudant_database=secure-file-storage-metadata
55

app/generate_yaml.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -o pipefail
5+
6+
if [[ -z "$INGRESS_SUBDOMAIN" ]]; then
7+
echo "Ingress subdomain cannot be empty"
8+
fi
9+
10+
if [[ -z "$IMAGE_REPOSITORY" ]]; then
11+
echo "Image repository cannot be empty"
12+
fi
13+
14+
if [[ -z "$INGRESS_SECRET" ]]; then
15+
echo "Ingress secret cannot be empty"
16+
fi
17+
18+
if [[ -z "$BASENAME" ]]; then
19+
BASENAME=secure-file-storage
20+
fi
21+
22+
if [[ -z "$TARGET_NAMESPACE" ]]; then
23+
TARGET_NAMESPACE=default
24+
fi
25+
26+
cat secure-file-storage.template.yaml | \
27+
INGRESS_SUBDOMAIN=$INGRESS_SUBDOMAIN \
28+
INGRESS_SECRET=$INGRESS_SECRET \
29+
IMAGE_REPOSITORY=$IMAGE_REPOSITORY \
30+
BASENAME=$BASENAME \
31+
TARGET_NAMESPACE=$TARGET_NAMESPACE \
32+
envsubst '$IMAGE_NAME $INGRESS_SECRET $INGRESS_SUBDOMAIN $IMAGE_PULL_SECRET $IMAGE_REPOSITORY $TARGET_NAMESPACE $BASENAME' > secure-file-storage.yaml
33+
#| \
34+
#oc apply -f - || exit 1

0 commit comments

Comments
 (0)