Skip to content

Commit f56b604

Browse files
authored
Merge pull request aboutcode-org#124 from haikoschol/docs-periodic-update
Document methods for periodic data import
2 parents 8185bdb + 4d1c676 commit f56b604

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,37 @@ DJANGO_DEV=1 python manage.py test vulnerabilities/tests
6868
DJANGO_DEV=1 python manage.py import --all
6969
```
7070

71+
If you want to run the import periodically, you can use a systemd timer:
72+
73+
```
74+
$ cat ~/.config/systemd/user/vulnerablecode.service
75+
76+
[Unit]
77+
Description=Update vulnerability database
78+
79+
[Service]
80+
Type=oneshot
81+
Environment="DJANGO_DEV=1"
82+
ExecStart=/path/to/venv/bin/python /path/to/vulnerablecode/manage.py import --all
83+
84+
$ cat ~/.config/systemd/user/vulnerablecode.timer
85+
86+
[Unit]
87+
Description=Periodically update vulnerability database
88+
89+
[Timer]
90+
OnCalendar=daily
91+
92+
[Install]
93+
WantedBy=multi-user.target
94+
```
95+
96+
Start it with
97+
98+
```
99+
systemctl --user daemon-reload && systemctl --user start vulnerablecode.timer
100+
```
101+
71102
## API
72103

73104
Start the webserver
@@ -107,3 +138,13 @@ https://devcenter.heroku.com/articles/deploying-python#how-to-keep-build-artifac
107138
9. Load the data referring to chapter "Data import" above.
108139

109140
10. To check the logs: `heroku logs --tail`
141+
142+
### Periodic Data Import
143+
144+
Note: Running jobs with Heroku Scheduler might incur costs. If you haven't already, you need to add a credit card in your account (https://dashboard.heroku.com/account/billing).
145+
146+
1. Install the Scheduler add-on: `heroku addons:create scheduler:standard`
147+
148+
2. Open the Scheduler dashboard: `heroku addons:open scheduler`
149+
150+
3. Click on "Create job" and enter `python manage.py import --all` under "Run Command"

0 commit comments

Comments
 (0)