Skip to content

Commit 422d17d

Browse files
committed
feat: automated tts scrapper
1 parent 3ebbd2c commit 422d17d

6 files changed

Lines changed: 17321 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: tts-scrapper-secrets
6+
namespace: tts
7+
type: Opaque
8+
stringData:
9+
TTS_SCRAPY_USER: <FILL-IN>
10+
TTS_SCRAPY_PASSWORD: <FILL-IN>
11+
TTS_SCRAPY_YEAR: <FILL-IN>
12+
POSTGRES_DB: <FILL-IN>
13+
POSTGRES_HOST: <FILL-IN>
14+
POSTGRES_PASSWORD: <FILL-IN>
15+
POSTGRES_PORT: <FILL-IN>
16+
POSTGRES_USER: <FILL-IN>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: tts-scrapper-secrets
6+
namespace: tts-staging
7+
type: Opaque
8+
stringData:
9+
TTS_SCRAPY_USER: <FILL-IN>
10+
TTS_SCRAPY_PASSWORD: <FILL-IN>
11+
TTS_SCRAPY_YEAR: <FILL-IN>
12+
POSTGRES_DB: <FILL-IN>
13+
POSTGRES_HOST: <FILL-IN>
14+
POSTGRES_PASSWORD: <FILL-IN>
15+
POSTGRES_PORT: <FILL-IN>
16+
POSTGRES_USER: <FILL-IN>

services/ni/scrapper/03_cron.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: batch/v1
2+
kind: CronJob
3+
metadata:
4+
name: automated-scrapper
5+
namespace: tts
6+
annotations:
7+
keel.sh/policy: "force"
8+
keel.sh/match-tag: "true"
9+
spec:
10+
schedule: "0 */6 * * *" # every 3 hours
11+
jobTemplate:
12+
spec:
13+
template:
14+
metadata:
15+
annotations:
16+
keel.sh/policy: force
17+
spec:
18+
containers:
19+
- name: runner
20+
image: registry.niaefeup.pt/niaefeup/uporto-schedule-scrapper:master
21+
command: ["/bin/sh", "-c"]
22+
args:
23+
- |
24+
apt update && apt install -y postgresql-client;
25+
psql;
26+
make clean;
27+
make info faculties courses course_units course_metadata;
28+
make dump;
29+
make convert_postgres;
30+
PGPASSWORD=$POSTGRES_PASSWORD psql -h $POSTGRES_HOST -p 5432 -U $POSTGRES_USER -d $POSTGRES_DB -f ./scripts/dump/data/01_data.sql;
31+
envFrom:
32+
- secretRef:
33+
name: tts-scrapper-secrets
34+
imagePullPolicy: Always
35+
restartPolicy: OnFailure
36+
imagePullSecrets:
37+
- name: harbor-pull-secret
38+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: batch/v1
2+
kind: CronJob
3+
metadata:
4+
name: automated-scrapper
5+
namespace: tts-staging
6+
annotations:
7+
keel.sh/policy: "force"
8+
keel.sh/match-tag: "true"
9+
spec:
10+
schedule: "* * 4 * *"
11+
jobTemplate:
12+
spec:
13+
template:
14+
metadata:
15+
annotations:
16+
keel.sh/policy: force
17+
spec:
18+
containers:
19+
- name: runner
20+
image: registry.niaefeup.pt/niaefeup/uporto-schedule-scrapper:master
21+
command: ["/bin/sh", "-c"]
22+
args:
23+
- |
24+
apt update && apt install -y postgresql-client;
25+
psql;
26+
make clean;
27+
make info faculties courses course_units course_metadata slots;
28+
make dump;
29+
make convert_postgres;
30+
PGPASSWORD=$POSTGRES_PASSWORD psql -h $POSTGRES_HOST -p 5432 -U $POSTGRES_USER -d $POSTGRES_DB -f ./scripts/dump/data/01_data.sql;
31+
envFrom:
32+
- secretRef:
33+
name: tts-scrapper-secrets
34+
imagePullPolicy: Always
35+
restartPolicy: OnFailure
36+
imagePullSecrets:
37+
- name: harbor-pull-secret
38+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
apiVersion: batch/v1
2+
kind: CronJob
3+
metadata:
4+
name: class-vacancies-scrapper
5+
namespace: tts
6+
annotations:
7+
keel.sh/policy: "force"
8+
keel.sh/match-tag: "true"
9+
spec:
10+
schedule: "0 */1 * * *" # every 3 hours
11+
jobTemplate:
12+
spec:
13+
template:
14+
metadata:
15+
annotations:
16+
keel.sh/policy: force
17+
spec:
18+
containers:
19+
- name: runner
20+
image: registry.niaefeup.pt/niaefeup/uporto-schedule-scrapper:master
21+
command: ["/bin/sh", "-c"]
22+
args:
23+
- |
24+
apt update && apt install -y postgresql-client;
25+
psql;
26+
make clean;
27+
make class_vacancies;
28+
make dump;
29+
make convert_postgres;
30+
PGPASSWORD=$POSTGRES_PASSWORD psql -h $POSTGRES_HOST -p 5432 -U $POSTGRES_USER -d $POSTGRES_DB -f ./scripts/dump/data/01_data.sql;
31+
envFrom:
32+
- secretRef:
33+
name: tts-scrapper-secrets
34+
imagePullPolicy: Always
35+
restartPolicy: OnFailure
36+
imagePullSecrets:
37+
- name: harbor-pull-secret

services/ni/scrapper/1.txt

Lines changed: 17176 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)