This commit is contained in:
parent
9e324537c3
commit
fa6550bcf5
17
.drone.yml
Normal file
17
.drone.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
registry: git.kurocon.nl
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
repo: git.kurocon.nl/kurocon/davinci
|
||||||
|
tags:
|
||||||
|
- latest
|
27
Dockerfile
Normal file
27
Dockerfile
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Then build the actual amelie docker image
|
||||||
|
FROM python:latest
|
||||||
|
|
||||||
|
# Set /usr/src/app as startup working directory
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
# Install python requirements
|
||||||
|
COPY requirements.txt ./
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Make dirs
|
||||||
|
RUN mkdir -p /static /config
|
||||||
|
|
||||||
|
# Copy sources
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Check if Django can run
|
||||||
|
RUN python3 manage.py check
|
||||||
|
|
||||||
|
# Expose volumes
|
||||||
|
VOLUME ["/static", "/config"]
|
||||||
|
|
||||||
|
# Expose the web port
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
# Start the website
|
||||||
|
CMD ["/usr/src/app/start.sh"]
|
|
@ -20,11 +20,15 @@ class Command(BaseCommand):
|
||||||
if sync.last_sync is None or timezone.now() > (sync.last_sync + sync.sync_interval):
|
if sync.last_sync is None or timezone.now() > (sync.last_sync + sync.sync_interval):
|
||||||
logger.debug(f"Synchronizing {sync.name}...")
|
logger.debug(f"Synchronizing {sync.name}...")
|
||||||
|
|
||||||
events = sync.get_events()
|
try:
|
||||||
added, existing, unchanged, deleted = sync.target.upload_events(events, purge=sync.purge)
|
events = sync.get_events()
|
||||||
|
added, existing, unchanged, deleted = sync.target.upload_events(events, purge=sync.purge)
|
||||||
|
|
||||||
sync.last_sync = timezone.now()
|
sync.last_sync = timezone.now()
|
||||||
sync.save()
|
sync.save()
|
||||||
logger.debug(f"Sync for {sync.name} done! {added} events added, {existing} updated. {unchanged} unchanged, and {deleted} purged.")
|
logger.debug(f"Sync for {sync.name} done! {added} events added, {existing} updated. {unchanged} unchanged, and {deleted} purged.")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Exception during execution of ical_sync for {sync.name}")
|
||||||
|
raise e
|
||||||
|
|
||||||
logger.debug("iCal sync complete!")
|
logger.debug("iCal sync complete!")
|
||||||
|
|
13
start.sh
Normal file
13
start.sh
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Copy configuration to proper place
|
||||||
|
cp "/config/local.py" "/usr/src/app/davinci/local.py"
|
||||||
|
|
||||||
|
# Make sure staticfiles are collected into the static volume
|
||||||
|
python3 manage.py collectstatic --noinput
|
||||||
|
|
||||||
|
# Make sure database is migrated
|
||||||
|
python3 manage.py migrate
|
||||||
|
|
||||||
|
# Start django server (ASGI)
|
||||||
|
daphne -b 0.0.0.0 -p 8080 davinci.asgi:application
|
Loading…
Reference in a new issue