Skip to content

Commit 3557b20

Browse files
committed
touch ups
Signed-off-by: Luke Roy <[email protected]>
1 parent 4da736a commit 3557b20

File tree

3 files changed

+52
-14
lines changed

3 files changed

+52
-14
lines changed

fotobox/README.md

+29
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# IBM Fotobox
22

3+
This is the IBM Fotobox. Deploy your own Fotobox straight to the IBM Cloud Access it directly from any device with browser and camera. Take Pictures and view them all from your device.
4+
5+
The solution is based on:
6+
- The frontend a Svelte Single Page Application running as a App on Code Engine able to scale to 0 in oder to optimise cost.
7+
- The Upload function which generates a thumbnail of the image and stores both in COS written in Python and running as a Function on Code Engine.
8+
- The Downloader a Go programm designed to serve the images stored in COS or download all at one go if you are the operator of the fotobox.
9+
- All Images are stored in IBM Cloud Object Storage to ensure security and scalability.
10+
11+
## Setup
12+
13+
If you use your own machine you'll need to install the following (if not
14+
already installed) and make sure you have a IBM Cloud Account:
15+
16+
- [IBM Cloud command line (`ibmcloud`)](https://cloud.ibm.com/docs/cli/reference/ibmcloud?topic=cloud-cli-getting-started)
17+
- [Code Engine plugin (`ce`)](https://cloud.ibm.com/codeengine/cli)
18+
- [Terraform ](https://developer.hashicorp.com/terraform/install)
19+
- [jq](https://jqlang.org/)
20+
21+
22+
## Automated Setup
23+
24+
In order to make the setup as convinent as possible we probide you with a setupscript which uses teraform and the IBM Cloud CLI
25+
26+
1. configure the `terraform.auto.tfvars` with your apikey and your resource group id
27+
28+
2. Run the `setup.sh <apikey>`and it will deploy all the required components and done
29+
30+
## Manual setup
31+
332
1. Setup COS with cos bucket this can be done over the UI or using the CLI
433
note dont the bucket name and API credentials
534

fotobox/cos-setup/main.tf

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# create a cos instance
22
resource "ibm_resource_instance" "cos_instance" {
3-
name = "cos-instance"
3+
name = "cos-fotobox-instance"
44
resource_group_id = var.resource_group
55
plan = "standard"
66
service = "cloud-object-storage"
@@ -45,16 +45,16 @@ resource "ibm_code_engine_secret" "fotobox-secret" {
4545
}
4646
}
4747

48-
resource "ibm_code_engine_secret" "registry_secret" {
49-
project_id = ibm_code_engine_project.ce-fotobox-project.id
50-
name = "container-registry-secret"
51-
format = "registry"
52-
data = {
53-
"username" = "iamapikey" # Use 'iamapikey' as username for IBM Cloud
54-
"password" = var.icr_secret
55-
"server" = "us.icr.io" # Change if using a different registry
56-
}
57-
}
48+
#resource "ibm_code_engine_secret" "registry_secret" {
49+
# project_id = ibm_code_engine_project.ce-fotobox-project.id
50+
# name = "container-registry-secret"
51+
# format = "registry"
52+
# data = {
53+
# "username" = "iamapikey" # Use 'iamapikey' as username for IBM Cloud
54+
# "password" = var.icr_secret
55+
# "server" = "us.icr.io" # Change if using a different registry
56+
# }
57+
#}
5858

5959
# create config map in project
6060

@@ -63,9 +63,9 @@ resource "ibm_code_engine_config_map" "fotobox-config" {
6363
project_id = ibm_code_engine_project.ce-fotobox-project.id
6464
data = {
6565
"bucket" = ibm_cos_bucket.cos_bucket.bucket_name
66-
"endpointURL" = ibm_cos_bucket.cos_bucket.s3_endpoint_private
66+
"endpointURL" = ibm_cos_bucket.cos_bucket.s3_endpoint_public
6767
"imageprefix" = "my-event-"
68-
"password" = "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
68+
"passwords" = "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
6969
"region" = ibm_cos_bucket.cos_bucket.region_location
7070
"resource_instance_id" = local.resource_credentials.resource_instance_id
7171
}

fotobox/setup.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
#!/bin/bash
22

3+
pushd cos-setup
4+
5+
terraform init
6+
7+
terraform apply && sleep 10
8+
9+
popd
10+
311
echo "create upload-function and download-application in code engine"
412

5-
ibmcloud target -g Default
13+
ibmcloud login --apikey $1
14+
ibmcloud target -g $(ibmcloud resource groups --default --output JSON | jq -r '.[0].id')
615

716
ibmcloud ce project select -n codeengine-fotobox-project # name of the project that was setup in terraform script
817

0 commit comments

Comments
 (0)