From ef645b071cacdd38eab460f624fb54f598d6c5a3 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sat, 8 Jan 2022 21:19:01 +0100 Subject: [PATCH 1/3] Jenkinsfile added --- Dockerfile | 2 ++ Jenkinsfile | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Jenkinsfile diff --git a/Dockerfile b/Dockerfile index 18b7e5b6..d47cc2a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,8 @@ COPY --from=builder /opt/venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" #COPY ./fet2020 /app +COPY ./fet2020 /app +COPY ./assets /app/assets COPY ./deployment/nginx.conf /etc/nginx/conf.d/fet2020.conf #RUN python manage.py makemigrations && python manage.py makemigrations posts members diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..beb62865 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,50 @@ +pipeline { + agent any + stages { + stage('Checkout'){ + steps { + git credentialsId: '3e336704-7d58-4dcb-88b6-1ef7b5392576', url: 'https://git.fet.at/bofh/fet2020.git' + } + + } + + stage('build Test') { + steps{ + script { + app = docker.build("django2020test", "-f Dockerfile .") + } + } + } + stage('Test Inside') { + steps{ + script { + app.inside("-u root:root") { + sh 'ls && cd fet2020 && ls && ./manage.py test' + } + } + } + } + + stage('build') { + steps{ + script { + app = docker.build("fet2020django", "-f Dockerfile.test .") + } + } + } + stage('Deploy Image') { + steps{ + script { + docker.withRegistry( 'https://docker.fet.at/', '3e336704-7d58-4dcb-88b6-1ef7b5392576') { + app.push("1.$BUILD_NUMBER") + app.push('latest') + + } + } + } + } + + + + } +} \ No newline at end of file From 8a9ce06b30ae2c56bc09da56293ed6f988564bf2 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sat, 8 Jan 2022 22:42:16 +0100 Subject: [PATCH 2/3] added resolver to nginx --- deployment/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/deployment/nginx.conf b/deployment/nginx.conf index 4fa4fd80..51b7951f 100644 --- a/deployment/nginx.conf +++ b/deployment/nginx.conf @@ -15,6 +15,7 @@ server { } location /fotos { + resolver 127.0.0.1 valid=30s; proxy_ssl_server_name on; proxy_ssl_verify off; From d8d3177d0c1e49204014a69714c6fa3a67fb7802 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sat, 8 Jan 2022 23:03:18 +0100 Subject: [PATCH 3/3] nginxconf --- deployment/nginx.conf | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/deployment/nginx.conf b/deployment/nginx.conf index 51b7951f..e8cdf2a7 100644 --- a/deployment/nginx.conf +++ b/deployment/nginx.conf @@ -2,8 +2,9 @@ server { listen 8080; error_log /var/log/nginx/error.log notice; rewrite_log on; - - + resolver 127.0.0.1 valid=30s; + set $flaskfetfotos flaskfetfotos:8080; + set $etherpad etherpad:9001; location /assets { alias /app/assets; try_files $uri =404; @@ -15,11 +16,9 @@ server { } location /fotos { - resolver 127.0.0.1 valid=30s; proxy_ssl_server_name on; proxy_ssl_verify off; - - proxy_pass http://flaskfetfotos:8080; + proxy_pass http://$flaskfetfotos; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; # proxy_set_header REMOTE-USER $http_REMOTE_USER; @@ -32,7 +31,7 @@ server { location /etherpad { rewrite /etherpad/(.*) /$1 break; rewrite ^/etherpad$ /etherpad/ permanent; - proxy_pass http://etherpad:9001; + proxy_pass http://$etherpad; proxy_redirect / /etherpad/; proxy_set_header Host $host; proxy_buffering off;