v0.0.6
This commit is contained in:
parent
2d39534023
commit
a36bf31bf8
@ -1,7 +1,7 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
Ansible role to deploy eom services.
|
||||
Ansible role to deploy EOM services on Kubernetes.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
@ -2,6 +2,40 @@ LoadModule proxy_module modules/mod_proxy.so
|
||||
LoadModule proxy_http_module modules/mod_proxy_http.so
|
||||
LoadModule rewrite_module modules/mod_rewrite.so
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName api.eom.dev
|
||||
ServerAlias *.api.eom.dev
|
||||
|
||||
ProxyRequests Off
|
||||
ProxyPreserveHost On
|
||||
|
||||
<Proxy *>
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
</Proxy>
|
||||
|
||||
ProxyPass / http://api/
|
||||
ProxyPassReverse / http://api/
|
||||
</VirtualHost>
|
||||
<VirtualHost *:443>
|
||||
ServerName api.eom.dev
|
||||
ServerAlias *.api.eom.dev
|
||||
|
||||
SSLProxyEngine On
|
||||
SSLCertificateFile "/usr/local/apache2/conf/server.crt"
|
||||
SSLCertificateKeyFile "/usr/local/apache2/conf/server.key"
|
||||
ProxyRequests Off
|
||||
ProxyPreserveHost On
|
||||
|
||||
<Proxy *>
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
</Proxy>
|
||||
|
||||
ProxyPass / http://api/
|
||||
ProxyPassReverse / http://api/
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName git.eom.dev
|
||||
ServerAlias *.git.eom.dev
|
||||
|
3
files/httpd-wsgi.conf
Normal file
3
files/httpd-wsgi.conf
Normal file
@ -0,0 +1,3 @@
|
||||
LoadModule wsgi_module modules/mod_wsgi.so
|
||||
|
||||
WSGIScriptAlias / /usr/local/apache2/htdocs/wsgi_app.py
|
67
tasks/api.yaml
Normal file
67
tasks/api.yaml
Normal file
@ -0,0 +1,67 @@
|
||||
---
|
||||
# tasks file for api
|
||||
- name: Create a config map for api
|
||||
vars:
|
||||
httpd_server_name: "api.eom.dev"
|
||||
httpd_conf_extra:
|
||||
- httpd-auth.conf
|
||||
- httpd-wsgi.conf
|
||||
k8s:
|
||||
state: present
|
||||
api_version: v1
|
||||
kind: ConfigMap
|
||||
name: api
|
||||
namespace: "eom-{{ target_namespace }}"
|
||||
definition:
|
||||
data:
|
||||
httpd.conf: "{{ lookup('template', 'httpd.conf.j2') }}"
|
||||
httpd-auth.conf: "{{ lookup('template', 'httpd-auth.conf.j2') }}"
|
||||
httpd-wsgi.conf: "{{ lookup('file', 'httpd-wsgi.conf') }}"
|
||||
mime.types: "{{ lookup('file', 'mime.types') }}"
|
||||
|
||||
- name: Create a deployment
|
||||
k8s:
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: api
|
||||
namespace: "eom-{{ target_namespace }}"
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: api
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: api
|
||||
spec:
|
||||
containers:
|
||||
- name: api
|
||||
image: ericomeehan/api
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /usr/local/apache2/conf
|
||||
ports:
|
||||
- containerPort: 80
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: api
|
||||
|
||||
- name: Expose deployment as a service
|
||||
k8s:
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: api
|
||||
namespace: "eom-{{ target_namespace }}"
|
||||
spec:
|
||||
selector:
|
||||
app: api
|
||||
ports:
|
||||
- port: 80
|
||||
name: api-80
|
||||
type: ClusterIP
|
95
tasks/influxdb.yaml
Normal file
95
tasks/influxdb.yaml
Normal file
@ -0,0 +1,95 @@
|
||||
---
|
||||
# tasks file for influxdb
|
||||
- name: Create persistent volume for influxdb
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: "eom-{{ target_namespace }}-influxdb"
|
||||
spec:
|
||||
capacity:
|
||||
storage: 32Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: standard
|
||||
hostPath:
|
||||
path: "/data/store-0/eom-{{ target_namespace }}/influxdb"
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- alpha-worker-0
|
||||
|
||||
- name: Create a persistent volume claim for influxdb
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: influxdb
|
||||
namespace: "eom-{{ target_namespace }}"
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 32Gi
|
||||
storageClassName: standard
|
||||
volumeName: "eom-{{ target_namespace }}-influxdb"
|
||||
|
||||
- name: Create a deployment
|
||||
k8s:
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: influxdb
|
||||
namespace: "eom-{{ target_namespace }}"
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: influxdb
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: influxdb
|
||||
spec:
|
||||
containers:
|
||||
- name: influxdb
|
||||
image: bitnami/influxdb
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/mysql
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
env:
|
||||
key: INFLUXDB_ADMIN_USER_PASSWORD
|
||||
value: "{{ influxdb_root_password }}"
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: influxdb
|
||||
|
||||
- name: Expose deployment as a service
|
||||
k8s:
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: influxdb
|
||||
namespace: "eom-{{ target_namespace }}"
|
||||
spec:
|
||||
selector:
|
||||
app: influxdb
|
||||
ports:
|
||||
- port: 3306
|
||||
name: influxdb-3306
|
||||
type: ClusterIP
|
95
tasks/mariadb.yaml
Normal file
95
tasks/mariadb.yaml
Normal file
@ -0,0 +1,95 @@
|
||||
---
|
||||
# tasks file for mariadb
|
||||
- name: Create persistent volume for mariadb
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: "eom-{{ target_namespace }}-mariadb"
|
||||
spec:
|
||||
capacity:
|
||||
storage: 32Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: standard
|
||||
hostPath:
|
||||
path: "/data/store-0/eom-{{ target_namespace }}/mariadb"
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- alpha-worker-0
|
||||
|
||||
- name: Create a persistent volume claim for mariadb
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: mariadb
|
||||
namespace: "eom-{{ target_namespace }}"
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 32Gi
|
||||
storageClassName: standard
|
||||
volumeName: "eom-{{ target_namespace }}-mariadb"
|
||||
|
||||
- name: Create a deployment
|
||||
k8s:
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mariadb
|
||||
namespace: "eom-{{ target_namespace }}"
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mariadb
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mariadb
|
||||
spec:
|
||||
containers:
|
||||
- name: mariadb
|
||||
image: mariadb
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/mysql
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
env:
|
||||
key: MARIADB_ROOT_PASSWORD
|
||||
value: "{{ mariadb_root_password }}"
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: mariadb
|
||||
|
||||
- name: Expose deployment as a service
|
||||
k8s:
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mariadb
|
||||
namespace: "eom-{{ target_namespace }}"
|
||||
spec:
|
||||
selector:
|
||||
app: mariadb
|
||||
ports:
|
||||
- port: 3306
|
||||
name: mariadb-3306
|
||||
type: ClusterIP
|
96
tasks/mongodb.yaml
Normal file
96
tasks/mongodb.yaml
Normal file
@ -0,0 +1,96 @@
|
||||
---
|
||||
# tasks file for mongodb
|
||||
- name: Create persistent volume for mongodb
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: "eom-{{ target_namespace }}-mongodb"
|
||||
spec:
|
||||
capacity:
|
||||
storage: 32Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: standard
|
||||
hostPath:
|
||||
path: "/data/store-0/eom-{{ target_namespace }}/mongodb"
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- alpha-worker-0
|
||||
|
||||
- name: Create a persistent volume claim for mongodb
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: mongodb
|
||||
namespace: "eom-{{ target_namespace }}"
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 32Gi
|
||||
storageClassName: standard
|
||||
volumeName: "eom-{{ target_namespace }}-mongodb"
|
||||
|
||||
- name: Create a deployment
|
||||
k8s:
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mongodb
|
||||
namespace: "eom-{{ target_namespace }}"
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mongodb
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mongodb
|
||||
spec:
|
||||
containers:
|
||||
- name: mongodb
|
||||
image: mongo
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/mysql
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
env:
|
||||
# TODO: check docs for extra vars
|
||||
key: ME_CONFIG_MONGODB_ADMINPASSWORD
|
||||
value: "{{ mongodb_root_password }}"
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: mongodb
|
||||
|
||||
- name: Expose deployment as a service
|
||||
k8s:
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mongodb
|
||||
namespace: "eom-{{ target_namespace }}"
|
||||
spec:
|
||||
selector:
|
||||
app: mongodb
|
||||
ports:
|
||||
- port: 8081
|
||||
name: mongodb-8081
|
||||
type: ClusterIP
|
Loading…
Reference in New Issue
Block a user