forked from loklak/loklak_server
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
579dbd9
commit 3aca737
Showing
20 changed files
with
258 additions
and
29 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
export DIR=kubernetes | ||
|
||
USAGE="USAGE: ./kubernetes/bin/deploy-development.sh create|create all|delete|delete all" | ||
|
||
if [[ "$1" = "create" ]]; | ||
then | ||
echo "Creating objects from configurations." | ||
echo "Make sure that persistent disk is already created." | ||
echo "" | ||
echo "Creating Elasticsearch Deployment" | ||
kubectl create -R -f ${DIR}/yamls/staging/elasticsearch/ | ||
# For mqtt | ||
kubectl create -R -f ${DIR}/yamls/mosquitto/ | ||
if [[ "$2" = "all" ]]; | ||
then | ||
# Start KubeLego deployment for TLS certificates | ||
kubectl create -R -f ${DIR}/yamls/lego/ | ||
echo "Start nginx deployment, ingress & service" | ||
kubectl create -R -f ${DIR}/yamls/nginx/ | ||
fi | ||
# Create web namespace | ||
kubectl create -R -f ${DIR}/yamls/staging/web/ | ||
# Wait for some time to prevent any chance of API-Server to access incomplete deployments | ||
sleep 20 | ||
echo "Creating loklak deployment" | ||
# Create API server deployment and service for development branch | ||
kubectl create -R -f ${DIR}/yamls/staging/api-server/ | ||
echo "Deployed loklak on Kubernetes" | ||
echo "Trying to fetch public IP. ~50s." | ||
sleep 50 | ||
if [[ "$2" = "all" ]]; | ||
then | ||
kubectl get services --namespace=nginx-ingress | ||
fi | ||
else | ||
kubectl get services --namespace=web | ||
fi | ||
if [[ "$1" = "delete" ]]; | ||
then | ||
echo "Clearing the cluster." | ||
if [ "$2" = "all" ]; then | ||
kubectl delete -f ${DIR}/yamls/lego/00-namespace.yml | ||
kubectl delete -f ${DIR}/yamls/nginx/00-namespace.yml | ||
fi | ||
kubectl delete -R -f ${DIR}/yamls/staging/ | ||
kubectl delete -f ${DIR}/yamls/mosquitto/00-namespace.yaml | ||
echo "Deleted loklak project from Kubernetes" | ||
elif [[ -z "$1" ]]; | ||
then | ||
echo "No arguments provided" | ||
echo $USAGE | ||
fi |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,3 @@ spec: | |
targetPort: 80 | ||
selector: | ||
app: server | ||
type: LoadBalancer |
2 changes: 1 addition & 1 deletion
2
...yamls/staging/api-server/00-namespace.yml → kubernetes/yamls/lego/00-namespace.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: web | ||
name: kube-lego |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
metadata: | ||
name: kube-lego | ||
namespace: kube-lego | ||
data: | ||
lego.email: "vibhorverma1995@gmail.com" | ||
lego.url: "https://acme-v01.api.letsencrypt.org/directory" | ||
kind: ConfigMap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apiVersion: apps/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: kube-lego | ||
namespace: kube-lego | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: kube-lego | ||
spec: | ||
containers: | ||
- name: kube-lego | ||
image: jetstack/kube-lego:0.1.4 | ||
imagePullPolicy: Always | ||
ports: | ||
- containerPort: 8080 | ||
env: | ||
- name: LEGO_EMAIL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: kube-lego | ||
key: lego.email | ||
- name: LEGO_LOG_LEVEL | ||
value: debug | ||
- name: LEGO_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: kube-lego | ||
key: lego.url | ||
- name: LEGO_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: LEGO_POD_IP | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: status.podIP |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: nginx-ingress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# | ||
# nginx ingress controller config | ||
# @ref https://github.com/kubernetes/ingress/blob/master/controllers/nginx/configuration.md | ||
# | ||
apiVersion: v1 | ||
data: | ||
proxy-connect-timeout: "15" | ||
proxy-read-timeout: "600" | ||
proxy-send-imeout: "600" | ||
hsts-include-subdomains: "false" | ||
body-size: "64m" | ||
server-name-hash-bucket-size: "256" | ||
server-tokens: "false" | ||
kind: ConfigMap | ||
metadata: | ||
namespace: nginx-ingress | ||
name: nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apiVersion: apps/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: default-http-backend | ||
namespace: nginx-ingress | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: default-http-backend | ||
spec: | ||
containers: | ||
- name: default-http-backend | ||
image: gcr.io/google_containers/defaultbackend:1.0 | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 8080 | ||
scheme: HTTP | ||
initialDelaySeconds: 30 | ||
timeoutSeconds: 5 | ||
ports: | ||
- containerPort: 8080 | ||
resources: | ||
limits: | ||
cpu: 10m | ||
memory: 20Mi | ||
requests: | ||
cpu: 10m | ||
memory: 20Mi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: default-http-backend | ||
namespace: nginx-ingress | ||
spec: | ||
ports: | ||
- port: 80 | ||
targetPort: 8080 | ||
protocol: TCP | ||
selector: | ||
app: default-http-backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
apiVersion: apps/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx | ||
namespace: nginx-ingress | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- image: gcr.io/google_containers/nginx-ingress-controller:0.8.3 | ||
name: nginx | ||
imagePullPolicy: Always | ||
env: | ||
- name: POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 10254 | ||
scheme: HTTP | ||
initialDelaySeconds: 30 | ||
periodSeconds: 10 | ||
timeoutSeconds: 5 | ||
ports: | ||
- containerPort: 80 | ||
- containerPort: 443 | ||
args: | ||
- /nginx-ingress-controller | ||
- --default-backend-service=nginx-ingress/default-http-backend | ||
- --nginx-configmap=nginx-ingress/nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: nginx | ||
namespace: nginx-ingress | ||
annotations: | ||
service.beta.kubernetes.io/external-traffic: "OnlyLocal" | ||
spec: | ||
type: LoadBalancer | ||
ports: | ||
- port: 80 | ||
name: http | ||
- port: 443 | ||
name: https | ||
selector: | ||
app: nginx |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: web-notls | ||
namespace: web | ||
annotations: | ||
kubernetes.io/ingress.class: "nginx" | ||
spec: | ||
rules: | ||
- host: staging.loklak.org | ||
http: | ||
paths: | ||
- path: / | ||
backend: | ||
serviceName: server | ||
servicePort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: web | ||
namespace: web | ||
annotations: | ||
kubernetes.io/tls-acme: "true" | ||
kubernetes.io/ingress.class: "nginx" | ||
spec: | ||
tls: | ||
- hosts: | ||
- staging.loklak.org | ||
secretName: loklak-api-tls | ||
rules: | ||
- host: staging.loklak.org | ||
http: | ||
paths: | ||
- path: / | ||
backend: | ||
serviceName: server | ||
servicePort: 80 |