blob: 361ffaa789e13fd520b4a9bd1751642618a47add (
plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# AMT James Billings
## Infrastructure
### FastAPI
- Handles HIT acceptance
- Handles interface b/w react and backend: work, preview, report.
- Handling of submitted assignments:
- mturk_notifications view: SNS will POST to this endpoint whenever a user submits an assignment
- The message gets added to our event stream
- process_mturk_events (which calls process_assignment_submitted)
### React
### AirFlow
- Refill Hits, check for expired hits
## Network
## System Environment
### Debian 12
#### Update & Install required system requirements
```shell
apt-get update
apt-get upgrade
apt install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git supervisor python3-dev \
libmemcached-dev libpq-dev htop supervisor rsync
wget https://www.python.org/ftp/python/3.13.7/Python-3.13.7.tgz
tar -xf Python-3.13.7.tgz
cd Python-3.13.7
./configure --enable-optimizations
make -j 4
make altinstall
python3.13 --version
python3.13 -m venv /root/amt-jb-venv
```
#### Git pull projects
```shell
cd ~
git clone ssh://code.g-r-l.com/panels/amt-jb
cd amt-jb
source /root/amt-jb-venv/bin/activate
pip install -U pip setuptools wheel
pip install -r requirements.txt
```
#### Supervisor
```shell
cd /etc/supervisor/conf.d/
ln -s /root/amt-jb/amt-jb.conf .
supervisorctl reread
supervisorctl reload
```
#### Database
```shell
apt install -y postgresql-common
bash /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
apt update
apt-cache policy postgresql
apt install postgresql -y
systemctl enable postgresql
systemctl start postgresql
systemctl status postgresql
vim /etc/postgresql/18/main/pg_hba.conf
```
#### Setup DNS Cache (LXC)
```
apt install dnsutils dnsmasq -y
# /etc/dnsmasq.conf
server=10.16.2.2
server=10.16.2.3
min-cache-ttl=30
no-resolv
listen-address=::1,127.0.0.1
systemctl restart dnsmasq
lxc dns: ::1 (and reboot)
```
#### NGINX
```shell
cd /etc/nginx/
mv nginx.conf nginx.conf.bkp
ln -s /root/amt-jb/nginx.conf .
ln -s /root/amt-jb/nginx_amt-jb_proxy_pass.conf .
cd sites-enabled
rm default
ln -s /root/amt-jb/nginx_amt-jb.conf .
gpasswd -a www-data root
chmod g+x /root && chmod g+x /root/amt-jb && chmod g+x /root/amt-jb/static
chmod g+x /root/amt-jb/static/js
service nginx restart
rm /var/log/nginx/*
service nginx restart
```
Confirm uvicorn is running properly
```shell
curl -i http://localhost:8000/headers/
```
## Telegraf
```shell
# influxdata-archive_compat.key GPG fingerprint:
# 9D53 9D90 D332 8DC7 D6C8 D3B9 D8FF 8E1F 7DF8 B07E
wget -q https://repos.influxdata.com/influxdata-archive_compat.key
echo '393e8779c89ac8d958f81f942f9ad7fb82a25e133faddaf92e15b16e6ac9ce4c influxdata-archive_compat.key' | sha256sum -c && cat influxdata-archive_compat.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg > /dev/null
echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main' | tee /etc/apt/sources.list.d/influxdata.list
apt-get update && apt-get install telegraf
cp /root/amt-jb/telegraf.conf /etc/telegraf/telegraf.conf
chown telegraf:telegraf /etc/telegraf/telegraf.conf
chmod 644 /etc/telegraf/telegraf.conf
# Add the telegraf users to the adm group (for access to /var/log/nginx/)
sudo usermod -aG adm telegraf
systemctl restart telegraf
# sudo -u telegraf telegraf --config /etc/telegraf/telegraf.conf --test
```
|