Skip to content

Commit 943547b

Browse files
committed
update readme for testing and cleanup
1 parent 5c90ec5 commit 943547b

File tree

3 files changed

+37
-13
lines changed

3 files changed

+37
-13
lines changed

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,39 @@ kubectl port-forward svc/frames 8080:8080
171171
To clean things up:
172172
```
173173
k3d cluster delete frames
174-
```
174+
```
175+
176+
# Building with Webpack
177+
178+
You'll see that some of our iframes are built with webpack. Note that configurations may vary: some may have standalone HTML pages to serve separately (e.g. import), while others do not. Take a peek at some of the webpack config files for reference.
179+
180+
## Testing and iterating with Webpack
181+
182+
For iframes that utilize webpack, the development flows change a bit. Each change you make will likely require a subsequent `npm run build` to webpack-ify your changes. You can then test your changes with `npm run start` to view the site locally.
183+
184+
Furthermore, the trickier part is ensuring that built files (most of the time persisted in `/dist`) are accessible. See `Dockerfile`, `nginx.conf`, and `kustomize/base/resources.yaml` to see some example configurations.
185+
186+
Finally, when iterating on an iframe and rebuilding, you may want to test locally with Docker + k8s. If you do so, you may need to add `imagePullPolicy: IfNotPresent` to both the `initContainers` and `containers` within `kustomize/base/resources.yaml`, and `newName: frames` + `newTag: latest` to `kustomize/base/kustomization.yaml`. This helps ensure you're using non-stale artifacts. In total, here's what you might do:
187+
188+
```bash
189+
# (Re)-Build image
190+
docker build --no-cache -t frames:latest .
191+
192+
# Import to k3d
193+
k3d image import frames:latest --cluster frames
194+
195+
# Deploy
196+
kubectl kustomize kustomize | kubectl --context k3d-frames apply -f-
197+
198+
# Test (with whichever ports are applicable for your iframe)
199+
kubectl port-forward svc/frames 8083:8083 --context k3d-frames
200+
```
201+
202+
If testing in a live, non-local environment, you can point containers to a new image as follows:
203+
204+
```
205+
# Update containers (main + init) to new image
206+
kubectl --context <context> -n tkhq-frames set image deployment/frames \
207+
frames=ghcr.io/tkhq/frames@sha256:<digest> \
208+
template-quorum-key=ghcr.io/tkhq/frames@sha256:<digest>
209+
```

import/src/turnkey-core.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ function getSubtleCrypto() {
4040
return crypto.subtle;
4141
}
4242

43-
console.log('global', global.crypto)
44-
console.log('window', window.crypto)
45-
4643
return null;
4744
}
4845

nginx.conf

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,10 @@ http {
6969
location / {
7070
try_files $uri $uri/ /index.html /standalone.html =404;
7171
}
72-
# root /usr/share/nginx;
73-
# location / {
74-
# try_files /import/$uri /templated/import/$uri /templated/import/$uri/index.html =404;
75-
# }
7672
}
7773
server {
7874
listen 8086;
79-
# root /usr/share/nginx;
80-
# add_header Content-Security-Policy "frame-ancestors 'self';";
81-
# location / {
82-
# try_files /export-and-sign/$uri /templated/export-and-sign/$uri /templated/export-and-sign/$uri/index.html =404;
83-
# }
75+
# optional: add CSP-related configs here later
8476
root /usr/share/nginx/templated/export-and-sign;
8577
location / {
8678
try_files $uri $uri/ /index.html =404;

0 commit comments

Comments
 (0)