Archived
1

Compare commits

...

6 Commits

Author SHA1 Message Date
ventilaar
741ac73e35 redirect to secure site, since it's supported 2022-04-06 12:48:13 +02:00
ventilaar
bb5390928e working kubernetes services, just add the secret variables 2022-04-06 12:33:02 +02:00
ventilaar
e9be4808ed change callback domain and add mango to dockerfile 2022-04-06 12:28:38 +02:00
ventilaar
3b6312b596 change callback domain and add mango to dockerfile 2022-04-06 12:28:24 +02:00
ventilaar
f31221caf0 function serverless works! 2022-04-05 15:31:38 +02:00
ventilaar
f1b0ace7ae terraform works! 2022-04-05 14:02:10 +02:00
7 changed files with 189 additions and 53 deletions

View File

@@ -17,16 +17,17 @@ spec:
containers:
- name: api-container
image: 4grxfq/api
imagePullPolicy: Always
ports:
- containerPort: 5001
name: api-port
env:
- name: OPENID_SECRET
value: CHANGEME
value:
- name: DNS_SERVER
value: "IP"
value: dnsns.mashallah.nl
- name: MONGO_CONNECTIONSTRING
value: CHANGEME
value:
---
apiVersion: v1
kind: Service
@@ -36,7 +37,27 @@ metadata:
run: api-service
spec:
ports:
- port: 5001
- port: 80
targetPort: 5001
protocol: TCP
selector:
app: api-deployment
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: api-ingress
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: dnsapi.mashallah.nl
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: api-service
port:
number: 80

View File

@@ -17,16 +17,17 @@ spec:
containers:
- name: gui-container
image: 4grxfq/gui
imagePullPolicy: Always
ports:
- containerPort: 5000
name: gui-port
env:
- name: OPENID_SECRET
value: CHANGEME
value:
- name: DNS_API
value: "http://api:5001"
value: http://api-service:80
- name: MONGO_CONNECTIONSTRING
value: CHANGEME
value:
---
apiVersion: v1
kind: Service
@@ -36,7 +37,27 @@ metadata:
run: gui-service
spec:
ports:
- port: 5000
- port: 80
targetPort: 5000
protocol: TCP
selector:
app: gui-deployment
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: gui-ingress
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: dnsgui.mashallah.nl
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: gui-service
port:
number: 80

File diff suppressed because one or more lines are too long

View File

@@ -6,5 +6,6 @@ RUN pip install --no-cache-dir -r /app/requirements.txt
COPY openid.py /app/
COPY dnszone.py /app/
COPY openid.py /app/
COPY mango.py /app
COPY api.py /app/
CMD ["python3", "/app/api.py"]

View File

@@ -14,7 +14,7 @@ class GoogleOID:
self.settings = {'client_id': '954325872153-1v466clrtgg6h4ptt2ne5pgpb9mhilr5.apps.googleusercontent.com',
'client_secret': client_secret,
'callback_uri': 'http://dnsdash.mashallah.nl:5000/login/gcp/callback',
'callback_uri': 'https://dnsgui.mashallah.nl/login/gcp/callback',
'key_server': 'https://www.googleapis.com/oauth2/v3/certs'} # global oid settings
def settings(self): # make it so that the settings variable is callable

View File

@@ -14,7 +14,7 @@ class GoogleOID:
self.settings = {'client_id': '954325872153-1v466clrtgg6h4ptt2ne5pgpb9mhilr5.apps.googleusercontent.com',
'client_secret': client_secret,
'callback_uri': 'http://dnsdash.mashallah.nl:5000/login/gcp/callback',
'callback_uri': 'https://dnsgui.mashallah.nl/login/gcp/callback',
'key_server': 'https://www.googleapis.com/oauth2/v3/certs'} # global oid settings
def settings(self): # make it so that the settings variable is callable

View File

@@ -0,0 +1,40 @@
import json
import boto3
import base64
def lambda_handler(event, context):
method = str(event.get('requestContext').get('http').get('method'))
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('lambdatable')
if method == "POST":
key = str(event.get('pathParameters').get('id'))
url = str(base64.b64decode(event.get('body')), 'utf-8')
table.put_item(Item={'key': key, 'url': url})
return {'message': url}
elif method == "DELETE":
key = str(event.get('pathParameters').get('id'))
table.delete_item(Key={'key': key})
return {'message': key}
else:
key = str(event.get('pathParameters').get('id'))
data = table.get_item(Key={"key": key})
if len(data) is 1:
return {'message': 'No such key'}
response = {
"statusCode": 302,
"headers": {
'Location': data['Item']['url']
}
}
return response