Skip to content

Commit

Permalink
Merge pull request #117 from francescotimperi/static-web-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
francescotimperi authored Oct 2, 2023
2 parents 076fb76 + 5e850bc commit 611e813
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 11 deletions.
4 changes: 4 additions & 0 deletions actions/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ tasks:
- >
curl -X PUT -T ../nuvolaris/templates/content.html -H "minioauth: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG" {{.APIHOST}}/api/v1/web/whisk-system/nuv/upload/nuvolaris/content.html
upload:chess:
- >
curl -X PUT -T ../nuvolaris/templates/content.html -H "minioauth: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG" {{.APIHOST}}/api/v1/web/whisk-system/nuv/upload/nuvolaris/chess/index.html
login:all:
- task: login:prepare
Expand Down
4 changes: 4 additions & 0 deletions nuvolaris/kopf_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.
#
import json, logging
import nuvolaris.config as cfg

def normalize(item:tuple):
"""
Expand All @@ -42,6 +43,9 @@ def endpoint(response: dict, item: dict):
"""
if(item['path']=='spec.components.tls' or item['path']=='spec.nuvolaris.apihost'):
response["endpoint"]="update"
# if we update the endpoint we need to be sure that we update also the static if still active
if cfg.get('components.static'):
response["static"]="update"

def openwhisk(response: dict, item: dict):
"""
Expand Down
25 changes: 14 additions & 11 deletions nuvolaris/templates/nginx-static-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,11 @@ data:
# index index.html index.htm;
#}
#rewrite ^/$ ${request_uri}index.html break;
#rewrite (.*)/$ /$1/index.html;
#rewrite ^([^.]*[^/])$ /$1/ permanent;
location / {
rewrite ^/$ ${request_uri}index.html break;
rewrite (.*)/$ $1/index.html;
rewrite ^([^.]*[^/])$ $1/ permanent;
location / {
rewrite ^/$ ${request_uri}index.html break;
rewrite ^([^.]*[^/])$ $1/;
rewrite (.*)/$ $1/index.html;
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-meta-etag;
proxy_hide_header x-amz-request-id;
Expand All @@ -50,10 +46,17 @@ data:
proxy_set_header Host $http_host;
proxy_pass http://{{minio_host}}.nuvolaris.svc.cluster.local:{{minio_port}}/;
error_page 404 @not_found;
proxy_intercept_errors on;
proxy_redirect off;
}
}
location @not_found {
root /usr/share/nginx/html;
}
#error_page 404 /404.html;
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
Expand Down
134 changes: 134 additions & 0 deletions tests/kind/whisk-minimal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
apiVersion: nuvolaris.org/v1
kind: Whisk
metadata:
name: controller
namespace: nuvolaris
spec:
components:
# start openwhisk controller
openwhisk: true
# start openwhisk invoker
invoker: false
# start couchdb
couchdb: true
# start kafka
kafka: false
# start mongodb
mongodb: false
# start redis
redis: false
# start cron based action parser
cron: false
# tls enabled or not
tls: false
# minio enabled or not
minio: true
# minio static enabled or not
static: true
# postgres enabled or not
postgres: false
openwhisk:
namespaces:
whisk-system: 789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
nuvolaris: cbd68075-dac2-475e-8c07-d62a30c7e683:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
# controller:
# image: "ghcr.io/nuvolaris/openwhisk-controller:0.3.0-morpheus.22122609"
nuvolaris:
storageclass: auto #standard
provisioner: auto #rancher.io/local-path
ingressclass: auto #nginx
ingresslb: auto #ingress-nginx/ingress-nginx-controller
couchdb:
host: couchdb
port: 5984
volume-size: 10
admin:
user: whisk_admin
password: some_passw0rd
controller:
user: invoker_admin
password: s0meP@ass1
invoker:
user: controller_admin
password: s0meP@ass2
kafka:
host: kafka
volume-size: 10
scheduler:
schedule: "* * * * *"
tls:
acme-registered-email: [email protected]
acme-server-url: https://acme-staging-v02.api.letsencrypt.org/directory
configs:
limits:
actions:
sequence-maxLength: 50
invokes-perMinute: 999
invokes-concurrent: 250
triggers:
fires-perMinute: 999
controller:
javaOpts: "-Xmx2048M"
#resources:
# cpu-req: "500m"
# cpu-lim: "1"
# mem-req: "1G"
# mem-lim: "2G"
#couchdb:
#resources:
#cpu-req: "500m"
#cpu-lim: "1"
#mem-req: "512M"
#mem-lim: "1G"
redis:
persistence-enabled: true
volume-size: 10
default:
password: s0meP@ass3
nuvolaris:
#prefix: nuvolaris
password: s0meP@ass3
mongodb:
host: mongodb
volume-size: 5
admin:
user: whisk_admin
password: 0therPa55
nuvolaris:
user: nuvolaris
password: s0meP@ass3
exposedExternally: False
useOperator: False
minio:
volume-size: 2
admin:
user: minioadmin
password: minioadmin
nuvolaris:
user: nuvolaris
password: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG
postgres:
volume-size: 5
replicas: 2
admin:
password: 0therPa55
replica-password: 0therPa55RR
nuvolaris:
password: s0meP@ass3

0 comments on commit 611e813

Please sign in to comment.