Merge pull request 'dev' (#14) from dev into main

Reviewed-on: #14
This commit is contained in:
2025-06-09 12:51:34 +03:00
4 changed files with 54 additions and 1 deletions

16
.github/workflows/jenkins-deploy.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
name: Deploy on server
on:
workflow_dispatch:
jobs:
Deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Trigger Jenkins jobs
uses: appleboy/jenkins-action@master
with:
url: "http://ci.saccada.xyz"
user: ${{ env.JENKINS_USERNAME }}
token: ${{ secrets.JENKINS_TOKEN }}
job: "Deploy Django application"

36
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,36 @@
pipeline {
agent any
stages {
stage('Hello') {
steps {
echo 'Hello from Jenkins'
}
}
stage('Connect to server') {
steps {
withCredentials([
sshUserPrivateKey(
credentialsId: '73d234d2-3f9d-44e9-97fc-b6317070b462',
keyFileVariable: 'SSH_PRIVATE_KEY'
)
]) {
sh '''#!/bin/bash
ssh -i "$SSH_PRIVATE_KEY" -p 2222 saccada@saccada.xyz << EOF
cd ~/ws/django-example-app
git pull --rebase
docker compose pull
docker compose down
docker compose up -d
'''
}
}
}
}
post {
always {
sleep 5
}
}
}

View File

@@ -4,4 +4,4 @@ Application made by django's instruction for **DevOps** education purposes
# Pylint
![pylint](https://img.shields.io/badge/PyLint-6.20-orange?logo=python&logoColor=white)
![pylint](https://img.shields.io/badge/PyLint-6.22-orange?logo=python&logoColor=white)

View File

@@ -26,6 +26,7 @@ SECRET_KEY = os.getenv("DJANGO_SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
CSRF_TRUSTED_ORIGINS = ["https://app.saccada.xyz"]
ALLOWED_HOSTS = ["localhost", "app.saccada.xyz"]