-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (49 loc) · 1.7 KB
/
Makefile
File metadata and controls
65 lines (49 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Files for generate commands
target_dir=definitions
rd_file=$(target_dir)/blaauw.rd
data_dir=../data
logs_dir=./logs
# Gavo directories
schema_name=blaauw
base_dir=/var/gavo
input_dir=$(base_dir)/inputs/$(schema_name)
web_dir=$(base_dir)/web
now := $(shell date +%Y%m%d-%H%M%S)
## Commands
reload: reload-rd publish-rd
# Static resources (config, images, templates etc.)
move-static: move-logo move-config
move-logo:
mkdir -p $(web_dir)/nv_static/img
cp resources/rug-logo.png $(web_dir)/nv_static/img/logo_medium.png
move-config:
cp resources/defaultmeta.txt $(base_dir)/etc/defaultmeta.txt
# Data resources
reload-rd:
mkdir -p $(input_dir)
cd $(input_dir)
pwd
cp $(rd_file) $(input_dir)/q.rd
dachs imp -m $(schema_name)/q.rd
publish-rd:
dachs pub -m $(schema_name)/q.rd
restart:
sudo systemctl restart dachs.service
# Database stuff
# Use with care!
reload-db: create-db insert
create-db:
# WARNING: Removes all data in the db!!!!
# psql dachs -f $(table_file)
mkdir -p $(logs_dir)
python3 scripts/insert.py --reload-db &> $(logs_dir)/$(now)-create-db.log
insert:
mkdir -p $(logs_dir)
python3 scripts/insert.py --file $(data_dir)/gbt-headers.txt &> $(logs_dir)/$(now)-insert.log
python3 scripts/insert.py --file $(data_dir)/gbt-22-23-headers.txt &>> $(logs_dir)/$(now)-insert.log
python3 scripts/insert.py --file $(data_dir)/processed-gbt-headers.txt &>> $(logs_dir)/$(now)-insert.log
python3 scripts/insert.py --file $(data_dir)/ldst-headers.pickle &>> $(logs_dir)/$(now)-insert.log
# Docker stuff
start-db:
sudo docker run --restart=always -d --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=password -v postgres:/var/lib/postgresql/data postgres:14
# docker exec -it postgres psql -U postgres