Skip to content

Commit d89351e

Browse files
committed
db initialization
1 parent 3a92a5a commit d89351e

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

build_docker.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ else
88
git checkout $tag || exit 1
99
fi
1010

11-
docker build -t DevAlone/proxy_py:$tag .
12-
docker push DevAlone/proxy_py:$tag
11+
docker build -t devalone/proxy_py:$tag .
12+
docker push devalone/proxy_py:$tag

docker-compose.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ services:
1010
- POSTGRES_DB=proxy_py
1111
volumes:
1212
- db_data:/var/lib/postgresql/data
13+
- ./init_db.sql:/docker-entrypoint-initdb.d/init_db.sql
1314
core:
14-
build: .
15+
image: "devalone/proxy_py:latest"
16+
restart: always
1517
ports:
1618
- "55555:55555"
1719
environment:

init_db.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE EXTENSION IF NOT EXISTS tsm_system_rows;

models.py

-2
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,6 @@ class Meta:
206206

207207
db = peewee_async.Manager(raw_db)
208208

209-
# TODO: make it work
210-
# raw_db.execute_sql('CREATE EXTENSION IF NOT EXISTS tsm_system_rows;')
211209
raw_db.execute_sql('''CREATE MATERIALIZED VIEW IF NOT EXISTS working_proxies
212210
AS SELECT * FROM proxies WHERE number_of_bad_checks = 0;''')
213211
db.allow_sync()

0 commit comments

Comments
 (0)