💥 add all the files
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
|||||||
|
FROM python:3
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
COPY requirements.txt ./
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
#RUN echo "nameserver 8.8.8.8" >> /etc/resolv.conf
|
||||||
|
#CMD [ "python", "./nextcloud_ics_sync.py",">>","/var/log/nextcloud-ics-sync.log"]
|
||||||
|
#CMD [ "sleep","3600" ]
|
||||||
|
CMD echo "==================================================================================" >> /var/log/nextcloud-ics-sync.log 2>&1 ; echo $(date) >> /var/log/nextcloud-ics-sync.log 2>&1 ; python ./nextcloud_ics_sync.py >> /var/log/nextcloud-ics-sync.log 2>&1 ; echo "==================================================================================" >> /var/log/nextcloud-ics-sync.log 2>&1
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2018 Jeff MrBear
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
@@ -1,121 +1 @@
|
|||||||
# nextcloud_ics_sync
|
sudo docker build -t nextcloud_ics_sync .
|
||||||
|
|
||||||
Python project to sync ics calendars into nextcloud.
|
|
||||||
|
|
||||||
Adapted from https://github.com/buzz/ics2owncloud.py .
|
|
||||||
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
|
|
||||||
This project has been tested on CentOS 7.6 with nextcloud 14.x, google calendar and zimbra calendar.
|
|
||||||
|
|
||||||
```
|
|
||||||
Python : 3.4.9
|
|
||||||
pip3 : 8.1.2
|
|
||||||
requests : 2.20.0
|
|
||||||
icalendar : 3.9.2
|
|
||||||
```
|
|
||||||
|
|
||||||
### Installing
|
|
||||||
|
|
||||||
You could either install requirements system wide or use virtual environment / conda, choose your poison.
|
|
||||||
|
|
||||||
To get this up and running you just need to do the following :
|
|
||||||
|
|
||||||
* Clone the repo
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/MrBE4R/nextcloud_ics_sync.git
|
|
||||||
```
|
|
||||||
* Install requirements
|
|
||||||
```bash
|
|
||||||
pip3 install -r ./nextcloud_ics_sync/requirements.txt
|
|
||||||
```
|
|
||||||
* Edit config.json with you values
|
|
||||||
```bash
|
|
||||||
cp nextcloud_ics_sync/nextcloud_ics_sync.ini{.example,}
|
|
||||||
EDITOR ./nextcloud_ics_sync/nextcloud_ics_sync.ini
|
|
||||||
```
|
|
||||||
* Start the script and enjoy your calendars being synced
|
|
||||||
```bash
|
|
||||||
cd ./nextcloud_ics_sync && ./nextcloud_ics_sync.py
|
|
||||||
```
|
|
||||||
|
|
||||||
You should get something like this :
|
|
||||||
```bash
|
|
||||||
[XXXX-XX-XX XX:XX:XX,XXX] [INFO] Initializing script...
|
|
||||||
[XXXX-XX-XX XX:XX:XX,XXX] [INFO] Done.
|
|
||||||
[XXXX-XX-XX XX:XX:XX,XXX] [INFO] Importing calendars...
|
|
||||||
[XXXX-XX-XX XX:XX:XX,XXX] [INFO] Working on section import_a
|
|
||||||
[XXXX-XX-XX XX:XX:XX,XXX] [INFO] Working with calendar nextcloud_a...
|
|
||||||
[XXXX-XX-XX XX:XX:XX,XXX] [INFO] Imported: uuid (Event Name)
|
|
||||||
[XXXX-XX-XX XX:XX:XX,XXX] [INFO] Imported: uuid (Event Name)
|
|
||||||
[XXXX-XX-XX XX:XX:XX,XXX] [INFO] Imported: uuid (Event Name)
|
|
||||||
[XXXX-XX-XX XX:XX:XX,XXX] [INFO] Imported: uuid (Event Name)
|
|
||||||
[XXXX-XX-XX XX:XX:XX,XXX] [INFO] Done.
|
|
||||||
[XXXX-XX-XX XX:XX:XX,XXX] [INFO] Done.
|
|
||||||
[XXXX-XX-XX XX:XX:XX,XXX] [INFO] Done.
|
|
||||||
```
|
|
||||||
|
|
||||||
You could add the script in a cron to run it periodically.
|
|
||||||
|
|
||||||
## Deployment
|
|
||||||
|
|
||||||
How to configure config.json
|
|
||||||
```ini
|
|
||||||
[DEFAULT] # The nextcloud server where we will sync all calendar
|
|
||||||
username: username # Nextcloud username
|
|
||||||
password: password # Nextcloud password
|
|
||||||
server: https://nextcloud.example.com/ # Nextcloud URL
|
|
||||||
|
|
||||||
[import_a] # a convenient name for you
|
|
||||||
calendar: calendar_xy # name of the calendar in nextcloud. must exist prior sync
|
|
||||||
ics_url: https://cloud.owncloud.org/index.php/apps/calendar/export.php?calid=6 # url to the ics file
|
|
||||||
ics_username : # username of the distant ics server
|
|
||||||
ics_password : # password of the distant ics server
|
|
||||||
|
|
||||||
[import_b]
|
|
||||||
calendar: zimbra
|
|
||||||
ics_url: https://zimbra.example.com/home/username/Calendar?fmt=ics
|
|
||||||
ics_username :
|
|
||||||
ics_password :
|
|
||||||
|
|
||||||
[import_c]
|
|
||||||
calendar: google
|
|
||||||
ics_url: https://calendar.google.com/calendar/ical/username/private-xxxxxxx/basic.ics
|
|
||||||
ics_username :
|
|
||||||
ics_password :
|
|
||||||
```
|
|
||||||
For now ```ics_username``` and ```ics_password``` are mandatory in each import, meaning the keys should be here but empty if not needed by the distant ics server.
|
|
||||||
|
|
||||||
## TODO
|
|
||||||
|
|
||||||
- [ ] validate if ```ics_username``` and ```ics_password``` are in config to avoid putting empty value in config
|
|
||||||
- [ ] your suggestions
|
|
||||||
|
|
||||||
## Built With
|
|
||||||
|
|
||||||
* [Python](https://www.python.org/)
|
|
||||||
* [icalendar](https://icalendar.readthedocs.io/en/latest/)
|
|
||||||
* [requests](http://docs.python-requests.org/en/latest/)
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.
|
|
||||||
|
|
||||||
## Authors
|
|
||||||
|
|
||||||
* **Jean-François GUILLAUME (Jeff MrBear)** - *Initial work* - [MrBE4R](https://github.com/MrBE4R)
|
|
||||||
|
|
||||||
See also the list of [contributors](https://github.com/MrBE4R/nextcloud_ics_sync/contributors) who participated in this project.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
|
|
||||||
|
|
||||||
## Acknowledgments
|
|
||||||
|
|
||||||
* Hat tip to anyone whose code was used
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
[DEFAULT]
|
||||||
|
username: calendar_sync
|
||||||
|
password: Displace6ArmingHeadroom
|
||||||
|
server: https://nextcloud.tryton.geeraert.eu/
|
||||||
|
|
||||||
|
[sam-pierre]
|
||||||
|
calendar: shared
|
||||||
|
ics_url: https://outlook.live.com/owa/calendar/90488edb-6373-4e0f-bde7-4b04b9385f5a/6982a203-79f2-419a-ac81-4164ce572d99/cid-B2051C269DBC4793/calendar.ics
|
||||||
|
ics_username :
|
||||||
|
ics_password :
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
[DEFAULT]
|
|
||||||
username: username
|
|
||||||
password: password
|
|
||||||
server: https://nextcloud.example.com/
|
|
||||||
|
|
||||||
[import_a]
|
|
||||||
calendar: calendar_xy
|
|
||||||
ics_url: https://nextcloud.example.org/index.php/apps/calendar/export.php?calid=6
|
|
||||||
ics_username :
|
|
||||||
ics_password :
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: nextcloud-ics-sync
|
||||||
|
---
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: nextcloud-ics-sync
|
||||||
|
namespace: nextcloud-ics-sync
|
||||||
|
spec:
|
||||||
|
schedule: "31 * * * *"
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
ttlSecondsAfterFinished: 100
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
# nodeName: kube-master
|
||||||
|
containers:
|
||||||
|
- name: nextcloud-ics-sync
|
||||||
|
# image: nextcloud_ics_sync
|
||||||
|
image: localhost:31795/nextcloud_ics_sync
|
||||||
|
# imagePullPolicy: Never
|
||||||
|
volumeMounts:
|
||||||
|
- name: nextcloud-ics-sync-log
|
||||||
|
mountPath: /var/log/nextcloud-ics-sync.log
|
||||||
|
restartPolicy: Never
|
||||||
|
dnsConfig:
|
||||||
|
nameservers:
|
||||||
|
- 8.8.8.8
|
||||||
|
volumes:
|
||||||
|
- name: nextcloud-ics-sync-log
|
||||||
|
hostPath:
|
||||||
|
path: /var/log/nextcloud-ics-sync.log
|
||||||
|
type: File
|
||||||
Reference in New Issue
Block a user