davinci/README.md
2020-11-11 17:02:11 +01:00

103 lines
2.3 KiB
Markdown

# DAVinci
DAVinci is a Django application that can keep remote iCalendar files (.ics) synchronized with a CalDAV calendar. It allows for multiple remote ICS files being synchronized to multiple calendars.
## Requirements
- Python 3.8
- Django 3.1
## Installing
- Clone the repository
```bash
git clone https://git.kurocon.nl/Kurocon/DAVinci.git
cd DAVinci
```
- Create a virtualenv
```bash
virtualenv -p /usr/bin/python3 venv
source ./davinci/bin/activate
```
- Install requirements
```bash
pip instal -r requirements.txt
```
- Setup local settings
```bash
cp davinci/local.py.default davinci/local.py
vim davinci/local.py
<edit local.py for your environment>
```
- Run migrations
```bash
python manage.py migrate
```
- Create admin account
```bash
python manage.py createsuperuser
```
Then either run it locally using `python manage.py runserver 0.0.0.0:8000`, or deploy it on a webserver,
for example using [Daphne](https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/daphne/).
When deploying, be sure to set the `STATIC_ROOT` setting, run `python manage.py collectstatic` and
serve the static files directory under `/static` on the web server.
### Configuring auto-sync
To enable the synchronisation, please configure the following command to be executed every minute (to allow update intervals down to 1 minute).
You can run the command every hour as well, but then the minimum update interval will be 1 hour.
```bash
python manage.py ical_sync
```
The configuration can be done for example by using cron:
```
# Run ical sync every minute
* * * * * /path/to/python /path/to/manage.py ical_sync
```
Or via a SystemD timer:
davinci_ical_syc.service
```
[Unit]
Description=Synchronises configured DAVinci iCalendars with CalDAV
Wants=davinci_ical_sync.timer
[Service]
Type=oneshot
ExecStart=/path/to/python /path/to/manage.py ical_sync
[Install]
WantedBy=multi-user.target
```
davinci_ical_syc.service
```
[Unit]
Description=Run the DAVinci iCal sync service every minute
Requires=davinci_ical_syc.service
[Timer]
Unit=davinci_ical_syc.service
OnBootSec=5min
OnCalendar=*:0/1
[Install]
WantedBy=timers.target
```
## Usage
Visit `/admin` and login with your created admin account to manage the synchronisations.
First, add a CalDAV server. Then, add the CalDAV Calendars that you want to sync to, and lastly, create iCalSync objects for each remote `.ics` file.