diff --git a/.dockerignore b/.dockerignore
index 6ba2399..643c7c9 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -55,3 +55,4 @@ venv.bak/
.DS_Store
.vscode/
**/public/
+data/
diff --git a/.env.example b/.env.example
index 39d6032..d562c9a 100644
--- a/.env.example
+++ b/.env.example
@@ -1,13 +1,6 @@
JOB_HISTORY_ALLOWED_HOSTS=0.0.0.0
-JOB_HISTORY_DB_HOST=job_history_db
-JOB_HISTORY_DB_NAME=job_history
-JOB_HISTORY_DB_PASSWORD=
-JOB_HISTORY_DB_PORT=5432
-JOB_HISTORY_DB_USERNAME=postgres
+JOB_HISTORY_DB_NAME=/data/job_history.sqlite3
JOB_HISTORY_DEBUG=FALSE
JOB_HISTORY_SECRET_KEY=
JOB_HISTORY_STATIC_ROOT=/usr/src/app/static/
JOB_HISTORY_STATIC_URL=/app/static/
-POSTGRES_DB=job_history
-POSTGRES_PASSWORD=
-POSTGRES_USER=postgres
diff --git a/.gitignore b/.gitignore
index f44b510..bb57859 100644
--- a/.gitignore
+++ b/.gitignore
@@ -136,3 +136,4 @@ dmypy.json
*.sql
/local-env.sh
/app/static/
+/data/
diff --git a/.idea/job-history.iml b/.idea/job-history.iml
index 2eb104f..d53b6e5 100644
--- a/.idea/job-history.iml
+++ b/.idea/job-history.iml
@@ -17,6 +17,7 @@
+
diff --git a/app/Dockerfile b/app/Dockerfile
index e398b87..936a173 100644
--- a/app/Dockerfile
+++ b/app/Dockerfile
@@ -7,8 +7,6 @@ WORKDIR /usr/src/app
RUN apt-get -y update
RUN apt-get -y upgrade
-# Netcat is used by tcp-port-wait.sh
-RUN apt-get -y install netcat-traditional postgresql-client libgdal-dev
RUN python -m pip install --upgrade --upgrade-strategy eager pip
@@ -19,7 +17,6 @@ RUN python -m pip install --upgrade -r ./requirements.txt
COPY . /usr/src/app
RUN chmod u+x docker-entrypoint.sh
-RUN chmod u+x tcp-port-wait.sh
RUN chmod u+x manage.py
HEALTHCHECK CMD curl --fail http://localhost:8000 || exit 1
diff --git a/app/docker-entrypoint.sh b/app/docker-entrypoint.sh
index 9fa9969..e606e25 100644
--- a/app/docker-entrypoint.sh
+++ b/app/docker-entrypoint.sh
@@ -3,19 +3,6 @@
# Abort the entire script if an error occurs
set -e
-# Wait for the db (postgres) container to be ready
-./tcp-port-wait.sh "$JOB_HISTORY_DB_HOST" "$JOB_HISTORY_DB_PORT"
-
-# Give it a little extra time, in case it has to create the database
-sleep 2;
-
-# If there's a database backup to restore, restore it
-if [ -f "./backup_to_restore.sql" ]
-then
- echo "backup_to_restore.sql exists; restoring it"
- PGPASSWORD=$JOB_HISTORY_DB_PASSWORD psql -U "$JOB_HISTORY_DB_USERNAME" -d "$JOB_HISTORY_DB_NAME" -h "$JOB_HISTORY_DB_HOST" -p "$JOB_HISTORY_DB_PORT" < ./backup_to_restore.sql
-fi
-
# Next, run any pending database migrations
./manage.py migrate --no-input
diff --git a/app/jobHistorySite/settings.py b/app/jobHistorySite/settings.py
index ede600c..5895e46 100644
--- a/app/jobHistorySite/settings.py
+++ b/app/jobHistorySite/settings.py
@@ -20,10 +20,6 @@
JOB_HISTORY_DEBUG=bool,
JOB_HISTORY_ALLOWED_HOSTS=list,
JOB_HISTORY_DB_NAME=str,
- JOB_HISTORY_DB_USERNAME=str,
- JOB_HISTORY_DB_PASSWORD=str,
- JOB_HISTORY_DB_HOST=str,
- JOB_HISTORY_DB_PORT=int,
JOB_HISTORY_STATIC_URL=str,
JOB_HISTORY_STATIC_ROOT=str
)
@@ -97,12 +93,8 @@
DATABASES = {
'default': {
- 'ENGINE': 'django.contrib.gis.db.backends.postgis',
+ 'ENGINE': 'django.db.backends.sqlite3',
'NAME': env('JOB_HISTORY_DB_NAME'),
- 'USER': env('JOB_HISTORY_DB_USERNAME'),
- 'PASSWORD': env('JOB_HISTORY_DB_PASSWORD'),
- 'HOST': env('JOB_HISTORY_DB_HOST'),
- 'PORT': env('JOB_HISTORY_DB_PORT'),
}
}
diff --git a/app/requirements.txt b/app/requirements.txt
index c8de6b7..32b4d5b 100644
--- a/app/requirements.txt
+++ b/app/requirements.txt
@@ -1,16 +1,18 @@
+asgiref==3.8.1
astroid==3.2.2
colorama==0.4.6
+dill==0.3.8
Django==3.2.25
django-environ==0.11.2
isort==5.13.2
lazy-object-proxy==1.10.0
mccabe==0.7.0
-psycopg2-binary==2.9.9
-pylint==3.2.3
+platformdirs==4.2.2
+pylint==3.2.5
pytz==2024.1
six==1.16.0
sqlparse==0.5.0
-typed-ast==1.5.5
+tomlkit==0.12.5
wheel==0.43.0
whitenoise==6.7.0
wrapt==1.16.0
diff --git a/docker-compose.circleci.yml b/docker-compose.circleci.yml
index 36b4484..a9f65dc 100644
--- a/docker-compose.circleci.yml
+++ b/docker-compose.circleci.yml
@@ -9,47 +9,23 @@ services:
- JOB_HISTORY_DEBUG
- JOB_HISTORY_ALLOWED_HOSTS
- JOB_HISTORY_DB_NAME
- - JOB_HISTORY_DB_USERNAME
- - JOB_HISTORY_DB_PASSWORD
- - JOB_HISTORY_DB_HOST
- - JOB_HISTORY_DB_PORT
- JOB_HISTORY_STATIC_ROOT
- JOB_HISTORY_STATIC_URL
command:
/usr/src/app/manage.py test
- depends_on:
- - db
ports:
- "8000:8000"
+ volumes:
+ - "db_data:/data"
networks:
- job_history_net_1
- - job_history_internal_net
healthcheck:
test: curl --fail http://localhost:8000 || exit 1
restart:
"no"
- db:
- image:
- postgis/postgis:15-3.4
- container_name:
- job_history_db
- environment:
- - POSTGRES_USER
- - POSTGRES_PASSWORD
- - POSTGRES_DB
- volumes:
- - "pg_data:/var/lib/postgresql/data"
- ports:
- - "5432:5432"
- networks:
- - job_history_internal_net
- restart:
- "no"
networks:
job_history_net_1:
- job_history_internal_net:
- internal: true
volumes:
- pg_data:
+ db_data:
diff --git a/docker-compose.yml b/docker-compose.yml
index e1690dd..63b8029 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -8,37 +8,19 @@ services:
./.env
command:
/usr/src/app/manage.py runserver 0.0.0.0:8000
- depends_on:
- - db
ports:
- "8000:8000"
+ volumes:
+ - "db_data:/data"
networks:
- job_history_net_1
- - job_history_internal_net
healthcheck:
test: curl --fail http://localhost:8000 || exit 1
restart:
"no"
- db:
- image:
- postgis/postgis:15-3.4
- container_name:
- job_history_db
- env_file:
- ./.env
- volumes:
- - "pg_data:/var/lib/postgresql/data"
- ports:
- - "5432:5432"
- networks:
- - job_history_internal_net
- restart:
- "no"
networks:
job_history_net_1:
- job_history_internal_net:
- internal: true
volumes:
- pg_data:
+ db_data: