zenbook migration

This commit is contained in:
2026-02-08 10:25:39 +01:00
commit 84b8735385
178 changed files with 5350 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
module github.com/tikinang/cdn
go 1.24.0
View File
+14
View File
@@ -0,0 +1,14 @@
<!-- directly served by the object storage (S3) origin -->
<img src='https://storage-prg1.zerops.io/my-bucket/path/to/my-image.png'/>
<img src='{{ osGetEnv "storage_cdnUrl" }}/path/to/my-image.png'/>
<!-- served cached S3 object close to users by the "storage" CDN -->
<img src='https://storage.cdn.zerops.app/my-bucket/path/to/my-image.png'/>
<img src='{{ osGetEnv "storage_apiUrl" }}/{{ osGetEnv "storage_bucketName" }}/path/to/my-image.png'/>
<!-- directly served by your app -->
<img src='/static/path/to/my-image.png'/>
<!-- served cached static content close to users by the "url" CDN -->
<img src='https://url.cdn.zerops.app/my.domain.com/static/path/to/my-image.png'/>
<img src='{{ osGetEnv "zeropsCdnUrl" }}/my.domain.com/static/path/to/my-image.png'/>
+32
View File
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<title>Fetch Image Example</title>
</head>
<body>
<h1>Image loaded with fetch</h1>
<div id="image-container"></div>
<img height="128" src="https://app.zerops.matejpavlicek.cz/static/gopher-profilovka.png" alt="gopher"/>
<img height="128" src="https://nginx-fd5.prg1.zerops.app/static/gopher-profilovka.png" alt="gopher-with-cors"/>
<script>
fetch('https://cz-url.cdn.zerops.app/nginx.zerops.matejpavlicek.cz/static/gopher-profilovka-2.png')
.then(response => response.blob())
.then(blob => {
const objectURL = URL.createObjectURL(blob);
const img = document.createElement('img');
img.height = 128;
img.src = objectURL;
document.getElementById('image-container').appendChild(img);
img.onload = () => {
URL.revokeObjectURL(objectURL);
};
})
.catch(error => {
console.error('Error:', error);
});
</script>
</body>
</html>
+48
View File
@@ -0,0 +1,48 @@
<html>
<head>
<title>CDN TEST</title>
</head>
<body>
<h1>TEST</h1>
<p>
direct static
<img height="128" src="static/gopher_profilovka.png" alt="gopher"/>
</p>
<p>
cdn static
<img height="128" src="https://static.cdn.zerops.app/nginx.zerops.matejpavlicek.cz/static/gopher_profilovka.png" alt="gopher"/>
</p>
<p>
direct s3
<img height="128" src="https://storage-prg1.zerops.io/4gh42-bucket1/gopher_profilovka.png" alt="gopher"/>
</p>
<p>
cdn s3
<img height="128" src="https://storage.cdn.zerops.app/4gh42-bucket1/gopher_profilovka.png" alt="gopher"/>
</p>
<p>
fetch static
<div id="image-container"></div>
</p>
<script>
fetch('https://static.cdn.zerops.app/nginx.zerops.matejpavlicek.cz/static/gopher_profilovka.png')
.then(response => response.blob())
.then(blob => {
const objectURL = URL.createObjectURL(blob);
const img = document.createElement('img');
img.height = 128;
img.src = objectURL;
img.alt = 'gopher'
document.getElementById('image-container').appendChild(img);
img.onload = () => {
URL.revokeObjectURL(objectURL);
};
})
.catch(error => {
console.error('Error:', error);
});
</script>
</body>
</html>
+14
View File
@@ -0,0 +1,14 @@
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
_, _ = fmt.Fprintln(w, "OK")
})
_ = http.ListenAndServe(":8080", nil)
}
+32
View File
@@ -0,0 +1,32 @@
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /var/www;
location ^~ /.git {
deny all;
return 404;
}
location / {
try_files $uri $uri/ /index.html;
}
location /static/ {
try_files $uri $uri/ =404;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' '*' always;
add_header 'Access-Control-Allow-Headers' '*' always;
add_header 'Access-Control-Expose-Headers' '*' always;
if ($request_method = 'OPTIONS') {
return 204;
}
}
access_log syslog:server=unix:/dev/log,facility=local1,tag=nginx,severity=info default_short;
error_log syslog:server=unix:/dev/log,facility=local1,tag=nginx,severity=error;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

+1
View File
@@ -0,0 +1 @@
HELLO
+11
View File
@@ -0,0 +1,11 @@
services:
- hostname: app
type: alpine@3.20
maxContainers: 1
- hostname: static
type: static@latest
maxContainers: 1
- hostname: nginx
type: nginx@latest
maxContainers: 1
startWithoutCode: true
+49
View File
@@ -0,0 +1,49 @@
zerops:
- setup: app
build:
os: alpine
base:
- go@1
buildCommands:
- go build -o app main.go
cache: true
deployFiles:
- app
run:
os: alpine
base: alpine@latest
ports:
- port: 8080
httpSupport: true
start: ./app
- setup: static
build:
deployFiles:
- index.html
- static/
run:
os: alpine
base: static@latest
ports:
- port: 80
httpSupport: true
- setup: nginx
build:
deployFiles:
- index.html
- static/
- nginx.conf
addToRunPrepare:
-
run:
os: alpine
base: nginx@latest
prepareCommands:
- sudo apk update
- sudo apk add vim
ports:
- port: 80
httpSupport: true
siteConfigPath: nginx.conf