Start an insecure wiki under simple.localtest.me
Bootstrapping a simpler development environment
This commit is contained in:
parent
1eb8c99d2c
commit
27a80c7b25
@ -3,11 +3,11 @@
|
|||||||
There are easier ways to get started with federated wiki. Here we are
|
There are easier ways to get started with federated wiki. Here we are
|
||||||
using wiki to drive some learning about kubernetes.
|
using wiki to drive some learning about kubernetes.
|
||||||
|
|
||||||
# We're using MacOS, Docker Desktop, and kind
|
# We're using MacOS, Docker Desktop, and k3d
|
||||||
|
|
||||||
brew cask install docker
|
brew cask install docker
|
||||||
brew install kind
|
brew install k3d
|
||||||
kind create cluster --name wiki
|
k3d create --publish 80:80 --name wiki
|
||||||
|
|
||||||
# Deploy Wiki
|
# Deploy Wiki
|
||||||
|
|
||||||
@ -15,13 +15,4 @@ using wiki to drive some learning about kubernetes.
|
|||||||
|
|
||||||
# Play with the wiki
|
# Play with the wiki
|
||||||
|
|
||||||
# pbcopy & open are MacOS commands
|
open http://simple.localtest.me
|
||||||
kubectl port-forward svc/wiki-service 3000:80 \
|
|
||||||
> port-forward.log \
|
|
||||||
2> port-forward.err &
|
|
||||||
# get admin password on the clipboard
|
|
||||||
kubectl exec svc/wiki-service -- \
|
|
||||||
jq -r .admin .wiki/config.json \
|
|
||||||
| pbcopy
|
|
||||||
open http://localhost:3000
|
|
||||||
# login with the password on the clipboard
|
|
||||||
|
@ -10,65 +10,6 @@ spec:
|
|||||||
requests:
|
requests:
|
||||||
storage: 4Gi
|
storage: 4Gi
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: wiki-config
|
|
||||||
data:
|
|
||||||
config.json: |
|
|
||||||
{
|
|
||||||
"admin": "ADMIN",
|
|
||||||
"farm": true,
|
|
||||||
"cookieSecret": "RANDOM",
|
|
||||||
"security_type": "friends",
|
|
||||||
"secure_cookie": false,
|
|
||||||
"wikiDomains": {
|
|
||||||
"local": {
|
|
||||||
"id": "/home/node/.wiki/local.owner.json"
|
|
||||||
},
|
|
||||||
"localhost": {
|
|
||||||
"id": "/home/node/.wiki/local.owner.json"
|
|
||||||
},
|
|
||||||
"localtest.me": {
|
|
||||||
"id": "/home/node/.wiki/local.owner.json"
|
|
||||||
},
|
|
||||||
"local.dbbs.co": {
|
|
||||||
"id": "/home/node/.wiki/local.owner.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
local.owner.json: |
|
|
||||||
{
|
|
||||||
"name": "The Owner",
|
|
||||||
"friend": {
|
|
||||||
"secret": "ADMIN"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
install-config: |
|
|
||||||
#!/bin/sh
|
|
||||||
randomstring() {
|
|
||||||
node -e 'console.log(require("crypto").randomBytes(64).toString("hex"))'
|
|
||||||
}
|
|
||||||
readonly ADMIN=$(randomstring)
|
|
||||||
readonly COOKIE=$(randomstring)
|
|
||||||
|
|
||||||
readonly CONFIG=/home/node/.wiki/config.json
|
|
||||||
readonly OWNER=/home/node/.wiki/local.owner.json
|
|
||||||
[ -f $CONFIG ] || {
|
|
||||||
jq --arg admin $ADMIN \
|
|
||||||
--arg cookie $COOKIE \
|
|
||||||
'.admin = $admin | .cookieSecret = $cookie' \
|
|
||||||
/etc/config/config.json \
|
|
||||||
> $CONFIG
|
|
||||||
}
|
|
||||||
[ -f $OWNER ] || {
|
|
||||||
jq --arg admin $ADMIN \
|
|
||||||
'.friend.secret = $admin' \
|
|
||||||
/etc/config/local.owner.json \
|
|
||||||
> $OWNER
|
|
||||||
}
|
|
||||||
chown -R 1000:1000 /home/node/.wiki
|
|
||||||
---
|
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
@ -97,13 +38,11 @@ spec:
|
|||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: dot-wiki
|
- name: dot-wiki
|
||||||
mountPath: /home/node/.wiki
|
mountPath: /home/node/.wiki
|
||||||
- name: config-templates
|
command: ["chown", "-R", "1000:1000", "/home/node/.wiki"]
|
||||||
mountPath: /etc/config
|
|
||||||
command: ["sh", "/etc/config/install-config"]
|
|
||||||
containers:
|
containers:
|
||||||
- name: farm
|
- name: farm
|
||||||
image: dobbs/farm:1.0.0
|
image: dobbs/farm:1.0.1
|
||||||
command: ["wiki", "--config", "/home/node/.wiki/config.json"]
|
command: ["wiki", "--security_legacy=true", "--data=/home/node/.wiki/simple"]
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
@ -113,9 +52,6 @@ spec:
|
|||||||
- name: dot-wiki
|
- name: dot-wiki
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: dot-wiki
|
claimName: dot-wiki
|
||||||
- name: config-templates
|
|
||||||
configMap:
|
|
||||||
name: wiki-config
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
@ -128,3 +64,19 @@ spec:
|
|||||||
port: 80
|
port: 80
|
||||||
selector:
|
selector:
|
||||||
app: wiki
|
app: wiki
|
||||||
|
---
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: simple-wiki
|
||||||
|
annotations:
|
||||||
|
kubernetes.io/ingress.class: traefik
|
||||||
|
spec:
|
||||||
|
rules:
|
||||||
|
- host: simple.localtest.me
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
backend:
|
||||||
|
serviceName: wiki-service
|
||||||
|
servicePort: http
|
||||||
|
Loading…
x
Reference in New Issue
Block a user