Compare commits

...

11 Commits

Author SHA1 Message Date
ducoterra
e01bf28646 collectstatic 2020-04-24 21:26:21 -04:00
ducoterra
f362194c5e add README 2020-04-24 21:20:12 -04:00
ducoterra
bdc4c90705 wrong port for the service 2020-04-24 21:18:28 -04:00
ducoterra
b309e5fa4a fail safe 2020-04-24 21:14:32 -04:00
ducoterra
a6127703e9 add external ingress 2020-04-24 21:07:34 -04:00
ducoterra
6be7034f9b disable button while submitting 2020-04-24 21:05:19 -04:00
ducoterra
1adaf20f61 major style overhaul 2020-04-24 21:00:29 -04:00
ducoterra
c32ed88713 fix the button 2020-04-24 20:54:05 -04:00
ducoterra
1d572cec43 oops broke the button 2020-04-24 20:51:53 -04:00
ducoterra
fd42b38c23 all focus on button 2020-04-24 20:50:23 -04:00
ducoterra
b8faf538be don't do anything unless tag 2020-04-24 20:46:03 -04:00
10 changed files with 103 additions and 31 deletions

View File

@@ -20,6 +20,9 @@ build:
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
test:
only:
variables:
- $CI_COMMIT_TAG
stage: test
image:
name: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG

View File

@@ -7,5 +7,6 @@ COPY ui ui
COPY manage.py manage.py
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
RUN python manage.py collectstatic
CMD ["gunicorn","-b",":8000", "-w", "4", "config.wsgi"]

5
README.md Normal file
View File

@@ -0,0 +1,5 @@
# CI Builder
My CI testing pipeline for a django project.
[![pipeline status](http://gitlab.ducoterra.net/ducoterra/ci_builder/badges/master/pipeline.svg)](http://gitlab.ducoterra.net/ducoterra/ci_builder/-/commits/master)

View File

@@ -23,7 +23,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'b8fi9=f-qj=@-#1iru34-f@a6pzfysgrf(1n_&d=ur%!1w$q*w'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = True if os.getenv("DEBUG") == "True" else False
ALLOWED_HOSTS = ["localhost", "test.ducoterra.net"]
@@ -122,3 +122,4 @@ USE_TZ = True
# https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

View File

@@ -15,4 +15,40 @@ spec:
paths:
- backend:
serviceName: test
servicePort: 8000
servicePort: 8000
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: test-external-tls
spec:
entryPoints:
- websecure
tls:
secretName: letsencrypt
routes:
- match: Host(`test.ducoterra.net`)
kind: Rule
services:
- name: test
port: 8000
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: test-external-web
spec:
entryPoints:
- web
routes:
- match: Host(`test.ducoterra.net`)
kind: Rule
services:
- name: test
port: 8000
middlewares:
- name: httpsredirect

View File

@@ -5,6 +5,7 @@ import sys
def main():
os.environ.setdefault('DEBUG', 'True')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
try:
from django.core.management import execute_from_command_line

0
ui/static/ui/button.css Normal file
View File

View File

@@ -19,6 +19,7 @@ var button = document.getElementById("BUTTON");
var count = document.getElementById("COUNT");
button.addEventListener("click", event => {
button.disabled = true;
fetch('/button', {
method: 'POST',
headers: {
@@ -31,5 +32,9 @@ button.addEventListener("click", event => {
})
.then((data) => {
count.innerText = data.pressed;
}).finally(() => {
button.disabled = false;
});
})
});
button.focus();

24
ui/templates/ui/base.html Normal file
View File

@@ -0,0 +1,24 @@
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The Button</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.8.2/css/bulma.min.css">
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
{% block css %}
{% endblock %}
</head>
<body>
{% csrf_token %}
{% block body %}
{% endblock %}
{% block js %}
{% endblock %}
</body>

View File

@@ -1,33 +1,29 @@
{% extends 'ui/base.html' %}
{% load static %}
<!DOCTYPE html>
<html>
{% block css %}
<link rel="stylesheet" href="{% static 'ui/button.css' %}">
{% endblock %}
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello Bulma!</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.8.2/css/bulma.min.css">
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
</head>
{% block js %}
<script src="{% static 'ui/button.js' %}"></script>
{% endblock %}
<body>
{% csrf_token %}
<section class="section">
<div class="container">
<div>
<h1 class="title">
The Button
</h1>
<button class="button" id="BUTTON">Press</button>
</div>
<div><br></div>
<div>
<h1 class="title" id="COUNT">{{ pressed }}</h1>
</div>
{% block body %}
<section class="section">
<div class="container">
<div>
<h1 class="title">
The Button
</h1>
<button class="button is-primary" id="BUTTON">Press</button>
</div>
</section>
<script src="{% static 'ui/button.js' %}"></script>
</body>
</html>
<div><br></div>
<div>
<h1 class="title" id="COUNT">{{ pressed }}</h1>
</div>
</div>
</section>
{% endblock %}