Permalink
Browse files

Add skaffold for local development (#1054)

  • Loading branch information...
AleF83 committed Jan 15, 2019
1 parent 3285ae5 commit db04a0add57a74b6177eb95e993dc1cb20044b34
@@ -1,6 +1,8 @@
# ---- *.csproj FILES ----
FROM debian:stretch-slim as csproj-files
COPY . /src
COPY ./addons /src/addons
COPY ./core /src/core
COPY ./services/api /src/services/api
RUN find /src -type f -not -name "*.csproj" -delete && find /src -type d -empty -delete

# ---- BUILD & TEST ----
@@ -3,10 +3,23 @@ These files are intended to run Tweek in Kubernetes. The files include a very fi

## Deploying to Kubernetes
```
kubectl apply -f infra.yaml
kubectl apply -f redis.yaml -f git.yaml
kubectl apply -f infra/
kubectl apply -f .
# If running on Minikube use cli to get endpoints
minikube service list
```

## Local developing with Skaffold
Install [Skaffold](https://github.com/GoogleContainerTools/skaffold/releases).

First of all, run the skaffold.
```
skaffold dev -f ./deployments/kubernetes/skaffold.yaml
```
Then, create port forwarding
```bash
kubectl port-forward deployment/gateway 8080:80
kubectl port-forward deployment/oidc-server-mock 8081:80
```
Finally, open in browser [http://localhost:8080](http://localhost:8080).
@@ -1,7 +1,6 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
namespace: tweek
name: api
spec:
replicas: 1
@@ -56,7 +55,6 @@ spec:
kind: Service
apiVersion: v1
metadata:
namespace: tweek
name: api
spec:
type: NodePort
@@ -1,7 +1,6 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
namespace: tweek
name: authoring
spec:
replicas: 1
@@ -37,7 +36,6 @@ spec:
kind: Service
apiVersion: v1
metadata:
namespace: tweek
name: authoring
spec:
type: NodePort
@@ -1,7 +1,6 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
namespace: tweek
name: editor
spec:
replicas: 1
@@ -16,9 +15,6 @@ spec:
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
env:
- name: REACT_APP_GATEWAY_URL
value: http://192.168.99.100:30099
volumeMounts:
- name: tweek-secrets
mountPath: /run/secrets/tweek-secrets
@@ -30,7 +26,6 @@ spec:
kind: Service
apiVersion: v1
metadata:
namespace: tweek
name: editor
spec:
type: NodePort
@@ -1,7 +1,6 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
namespace: tweek
name: gateway
spec:
replicas: 1
@@ -32,32 +31,47 @@ spec:
- name: TWEEKGATEWAY_SECURITY_CORS_ALLOWEDMETHODS
value: "['GET','POST','PUT','PATCH','DELETE']"
- name: TWEEKGATEWAY_SECURITY_CORS_ALLOWEDHEADERS
value: "['*']"
value: "['*']"
- name: TWEEKGATEWAY_SECURITY_POLICYSTORAGE_MINIOENDPOINT
value: minio:9000
- name: TWEEKGATEWAY_SECURITY_POLICYSTORAGE_MINIOBUCKETNAME
value: tweek
- name: TWEEKGATEWAY_SECURITY_POLICYSTORAGE_MINIOACCESSKEY
value: AKIAIOSFODNN7EXAMPLE
- name: TWEEKGATEWAY_SECURITY_POLICYSTORAGE_MINIOSECRETKEY
value: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
valueFrom:
secretKeyRef:
name: tweek-secrets
key: minio_secret_key
- name: TWEEKGATEWAY_SECURITY_POLICYSTORAGE_MINIOSECURE
value: "false"
- name: TWEEKGATEWAY_SECURITY_POLICYSTORAGE_MINIOPOLICYOBJECTNAME
value: policy.csv
- name: TWEEKGATEWAY_SECURITY_POLICYSTORAGE_NATSENDPOINT
value: nats://nats:4222
- name: TWEEKGATEWAY_SECURITY_TWEEKSECRETKEY_INLINE
value: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBeE1JdjB3QW9NTkhzc1J6OUhvanM2eUNla2w5RHI5RUt1WjUwZ3QveHk4Wk9DelFKCmVuWG9ub1N4clUrRTZrS01QWnFXOElQVWg3R2gvSkhtMUZXczFlVHdhM1oxK1VFRmtpM1E5ZURGSVBUTzM1bmEKcVYwcFVyWTJ3S0xUV24zczd2ZGhjQVNPWHZ1anN5cXZvbENQa0VxckF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ZnJRWjJlWHpFQ21oVk8vdUpWb01iVApoQS9tUXRYRzVuMk9QMndmSk1LVUNiVVZ2ZTJYNUQxU1VGYk03dWVHU3JlWExXdXJzaHdnN1p6VlpxVDYzUEJSCmpUa1FFNHJ1a1ZFSzNNMFVQOUlNVndzYURqMjgrY01RZk5ORmh0VmhBb0dBQ1Q5cStDUjRUendncHhPOTJFQjAKVUEyYURzYTlmRldBVHBkUDdqdld6MEM2RUVtc0E4bXFDVmR0cHYvcWkzd251dU9mbXVJWVU0cC9teHQzdnBKVwp1V08wa1NCYzVzQXI1THp5dmQ0ZXFSMUtHUUNJMjc0aWNMeXUxcHVKSUE2VDlRZXB5dSsrR3poWGRDc0VIZ0VPCkNrRThVckJMMDhMckRncUVKWEwwZzMwQ2dZQm0welVtR0FnZExEd2tBb0xSbEtDdDRzSm9JNkY2ZmJ3eEtGRnoKc2pla1d0OStpY2VqdlBUSU1lNHJhWmdkU3RIbjk3TzhJU1hncWNsaWJ0Q1lYa253VHFzaG5nWlZXM25kRThVSgoyWHVFVEdlQk84RUp6bW1WMnIrNmhPTkNjZFpWNjR3ZzlpRnl2VW9ua2dyVUx4MnN4aHpMVmhQOW5MUjMyUXp3CklhZDVJUUtCZ1FEWHBhU25seGcrbzMyV0FHd0dzQXhxNUNXK3JFcE84UENEbytSZWU2dmNGN25JZi95NHNSUHUKNDFpcFo2WHhZcHdnUkQ3em5aano5QWVWaEc4aUFBQUJORlUxSkZUaVhpZ1BEWi8wOFlFMHRnQ1ZiL0VPV2ZxVAptS0NBTUgrSjJZWUlwb3NLL3dyQmRXQ1RiUHYvYUI3RkVraFFLeGVJTXYxd0trd2tSaU5BQ0E9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=
- name: TWEEKGATEWAY_SECURITY_TWEEKSECRETKEY_PATH
value: /run/secrets/git/tweek_ssh_private_key
- name: TWEEKGATEWAY_CONFIGFILEPATH
value: /config/gateway.json
- name: CONFIGOR_ENV
value: k8s
volumeMounts:
- name: git-keys
mountPath: /run/secrets/git
- name: gateway-config
mountPath: /config
volumes:
- name: git-keys
secret:
secretName: tweek-secrets
defaultMode: 0600
- name: gateway-config
configMap:
name: gateway-config
---
kind: Service
apiVersion: v1
metadata:
namespace: tweek
name: gateway
spec:
type: NodePort
@@ -1,7 +1,6 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
namespace: tweek
name: git
spec:
replicas: 1
@@ -30,7 +29,6 @@ spec:
kind: Service
apiVersion: v1
metadata:
namespace: tweek
name: git
spec:
selector:
@@ -0,0 +1,37 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: gateway-config
data:
gateway.json: |
{
"upstreams": {
"api": "http://api",
"authoring": "http://authoring:3000",
"publishing": "http://publishing",
"editor": "http://editor:3000"
},
"security": {
"auth": {
"providers": {
"mock": {
"name": "Mock OpenId Connect server",
"issuer": "http://localhost:8081",
"authority": "http://localhost:8081",
"jwks_uri": "http://oidc-server-mock/.well-known/openid-configuration/jwks",
"client_id": "tweek-openid-mock-client",
"login_info": {
"login_type": "oidc",
"scope": "openid profile email",
"response_type": "id_token"
}
}
},
"basic_auth": {
"redirect_urls": [
"http://localhost:8080"
]
}
}
}
}
@@ -0,0 +1,40 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: minio
spec:
replicas: 1
template:
metadata:
labels:
app: minio
spec:
containers:
- name: minio
image: minio/minio
args:
- server
- /data
env:
- name: MINIO_ACCESS_KEY
value: AKIAIOSFODNN7EXAMPLE
- name: MINIO_SECRET_KEY
valueFrom:
secretKeyRef:
name: tweek-secrets
key: minio_secret_key
ports:
- containerPort: 9000
---
kind: Service
apiVersion: v1
metadata:
name: minio
spec:
type: NodePort
selector:
app: minio
ports:
- nodePort: 30007
port: 9000
targetPort: 9000
@@ -0,0 +1,27 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nats
spec:
replicas: 1
template:
metadata:
labels:
app: nats
spec:
containers:
- name: nats
image: nats:1.0.4-linux
ports:
- containerPort: 4222
---
kind: Service
apiVersion: v1
metadata:
name: nats
spec:
selector:
app: nats
ports:
- port: 4222
targetPort: 4222
@@ -0,0 +1,38 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: oidc-server-mock
spec:
replicas: 1
template:
metadata:
labels:
app: oidc-server-mock
spec:
containers:
- name: oidc-mock
image: soluto/oidc-server-mock
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: CLIENT_ID
value: tweek-openid-mock-client
- name: REDIRECT_URIS
value: http://localhost:8080/auth-result/oidc
- name: TEST_USER
value: '{"SubjectId":"00000000-0000-0000-0000-000000000000","Username":"User1","Password":"pwd"}'
ports:
- containerPort: 80
---
kind: Service
apiVersion: v1
metadata:
name: oidc-server-mock
spec:
type: NodePort
selector:
app: oidc-server-mock
ports:
- port: 80
nodePort: 30088
targetPort: 80
@@ -1,7 +1,6 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
namespace: tweek
name: redis
spec:
replicas: 1
@@ -19,7 +18,6 @@ spec:
kind: Service
apiVersion: v1
metadata:
namespace: tweek
name: redis
spec:
selector:
Oops, something went wrong.

0 comments on commit db04a0a

Please sign in to comment.