diff --git a/README.md b/README.md index 939af24d409e91d414146958e3c5e16b7583dd06..3df885902f49a825c4b375dd993acf221732e93a 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,9 @@ Deployment Diagram: * https://drive.google.com/file/d/1_j9Fp505pZTxcmzAEdgftdPkoIFrKfAX/view?usp=sharing ### Manual deploy in Docker -For the `master' branch there is a CI/CD pipeline in place (with a manual deploy button on the 'pipelines' page) +For the `master' branch there is a CI/CD pipeline in place which builds and deploys the backend at https://sdc.astron.nl:5554/atdb/ +The deploy step requires pushing the 'play' button in the gitlab pipelines section. +This is done to not have a mandatory deploy for every minor commmit. #### initial @@ -61,6 +63,19 @@ This is how to do that manually for a persistent database in a Docker container. > docker exec -it atdb-ldv python manage.py makemigrations --settings atdb.settings.docker_sdc > docker exec -it atdb-ldv python manage.py migrate --settings atdb.settings.docker_sdc +### Postgres Database operations + +#### dump a copy of the database + > cd $HOME/shared + > docker exec -it atdb-ldv-postgres pg_dump -U postgres -O atdbldv > atdb_ldv.sql + +#### load a database (warning, this overwrites the database) + > docker exec -it atdb-ldv-postgres psql --command "drop database atdbldv" + > docker exec -it atdb-ldv-postgres psql --command "create database atdbldv" + > docker exec -it atdb-ldv-postgres psql -U postgres atdbldv -f /shared/atdb_ldv.sql + > docker exec atdb-ldv-postgres psql --command "grant ALL ON DATABASE atdbldv TO dbadmin;" + + ### Original ATDB diagrams These diagrams can be used as guidance to the original ATDB services, which can be harvested for functionality diff --git a/atdb/atdb/settings/docker_dop457.py b/atdb/atdb/settings/docker_dop457.py deleted file mode 100644 index d0e4b4820a41d5cfd973d2bd1b63f9121790af29..0000000000000000000000000000000000000000 --- a/atdb/atdb/settings/docker_dop457.py +++ /dev/null @@ -1,72 +0,0 @@ -from atdb.settings.base import * - -# Import production setting must remain False. -DEBUG = True - -ALLOWED_HOSTS = ["*"] - - -##################################################### -# These settings mainly deal with https. -# See http://django-secure.readthedocs.io/en/latest/middleware.html -# Check the warning and instructions with: -# (.env) atdb@/var/.../atdb ./manage.py check --deploy --settings=atdb.settings.prod -##################################################### -# Assume SSL is correctly set up. -SSL_ENABLED = False -if SSL_ENABLED: - # True: Django now checks that cookies are ONLY sent over SSL. - # https://docs.djangoproject.com/en/1.11/ref/settings/#session-cookie-secure - SESSION_COOKIE_SECURE = True - # True: Django now checks that csrf tokens are ONLY sent over SSL. - # https://docs.djangoproject.com/en/1.11/ref/settings/#csrf-cookie-secure - CSRF_COOKIE_SECURE = True - # True: Always redirect requests back to https (currently ignored as Nginx should enforces https). - # Alternatively, enable and add set SECURE_PROXY_SSL_HEADER. - SECURE_SSL_REDIRECT = False - # Setting this to a non-zero value, will default the client UA always to connect over https. - # Unclear how or if this possibly affects other *.astron.nl domains. Especially, if these do - # not support https whether this option then breaks those http-only locations. - # SECURE_HSTS_SECONDS = 31536000 - -# True: Enables a header that disables the UA from 'clever' automatic mime type sniffing. -# http://django-secure.readthedocs.io/en/latest/settings.html#secure-content-type-nosniff -# https://stackoverflow.com/questions/18337630/what-is-x-content-type-options-nosniff -SECURE_CONTENT_TYPE_NOSNIFF = True - -# True: Enables a header that tells the UA to switch on the XSS filter. -# http://django-secure.readthedocs.io/en/latest/middleware.html#x-xss-protection-1-mode-block -SECURE_BROWSER_XSS_FILTER = True - -# Prevents the site from being deployed within a iframe. -# This prevent click-jacking attacks. -# See; https://docs.djangoproject.com/en/1.11/ref/clickjacking/ -X_FRAME_OPTIONS = 'DENY' -##################################################### - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'USER': 'dbadmin', - 'PASSWORD': 'dbadmin123', - - # database runs locally in postgres - 'NAME': 'atdb', - 'HOST': 'dop457.astron.nl', - 'PORT': '5432', - - # database runs on a virtual machine - # 'HOST': 'alta-sys-db.astron.nl', - # 'PORT': '5432', - # 'NAME': 'altadb' - }, -} - -# Password validation -# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators - -AUTH_PASSWORD_VALIDATORS = [] - -ALTA_HOST = "http://dop457.astron.nl/altapi" -ALTA_USER = "atdb_write" -ALTA_PASS = "7VVJruVn8W1n" \ No newline at end of file diff --git a/atdb/atdb/wsgi_docker_dop457.py b/atdb/atdb/wsgi_docker_dop457.py deleted file mode 100644 index 193da2501b5f67e94d6be3a549b3495ee123aac2..0000000000000000000000000000000000000000 --- a/atdb/atdb/wsgi_docker_dop457.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -WSGI config for atdb project. - -It exposes the WSGI callable as a module-level variable named ``application``. - -For more information on this file, see -https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ -""" - -import os - -from django.core.wsgi import get_wsgi_application - -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "atdb.settings.docker_dop457") - -application = get_wsgi_application() diff --git a/atdb/docker/postgres/Dockerfile b/atdb/docker/postgres/Dockerfile index d08aa8825f77d7671aaa8b14507da0a5679fc3f9..f8e4904063f2f5da60c2fc0da7856cebac412869 100644 --- a/atdb/docker/postgres/Dockerfile +++ b/atdb/docker/postgres/Dockerfile @@ -9,18 +9,18 @@ FROM ubuntu:16.04 RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 # Add PostgreSQL's repository. It contains the most recent stable release -# of PostgreSQL, ``9.3``. +# of PostgreSQL, ``9.4``. RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list -# Install ``python-software-properties``, ``software-properties-common`` and PostgreSQL 9.3 +# Install ``python-software-properties``, ``software-properties-common`` and PostgreSQL 9.4 # There are some warnings (in red) that show up during the build. You can hide # them by prefixing each apt-get statement with DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y python-software-properties software-properties-common postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3 +RUN apt-get update && apt-get install -y python-software-properties software-properties-common postgresql-9.4 postgresql-client-9.4 postgresql-contrib-9.4 # Note: The official Debian and Ubuntu images automatically ``apt-get clean`` # after each ``apt-get`` -# Run the rest of the commands as the ``postgres`` user created by the ``postgres-9.3`` package when it was ``apt-get installed`` +# Run the rest of the commands as the ``postgres`` user created by the ``postgres-9.4`` package when it was ``apt-get installed`` USER postgres # Create a PostgreSQL role named ``dbadmin`` with ``dbadmin123`` as the password and @@ -43,7 +43,7 @@ RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"] # Set the default command to run when starting the container -CMD ["/usr/lib/postgresql/9.3/bin/postgres", "-D", "/var/lib/postgresql/9.3/main", "-c", "config_file=/etc/postgresql/9.3/main/postgresql.conf"] +CMD ["/usr/lib/postgresql/9.4/bin/postgres", "-D", "/var/lib/postgresql/9.4/main", "-c", "config_file=/etc/postgresql/9.4/main/postgresql.conf"] # build the image like this: # docker build -t atdb-ldv-postgres . diff --git a/atdb/taskdatabase/static/taskdatabase/LOFARlogo.png b/atdb/taskdatabase/static/taskdatabase/LOFARlogo.png deleted file mode 100644 index 9a9f861c95307bdf5355f1ff52875afa9d9f9f54..0000000000000000000000000000000000000000 Binary files a/atdb/taskdatabase/static/taskdatabase/LOFARlogo.png and /dev/null differ diff --git a/atdb/taskdatabase/static/taskdatabase/alta_logo.jpg b/atdb/taskdatabase/static/taskdatabase/alta_logo.jpg deleted file mode 100644 index e99572c661d5c9a857ff8339e990f6dce6645a79..0000000000000000000000000000000000000000 Binary files a/atdb/taskdatabase/static/taskdatabase/alta_logo.jpg and /dev/null differ diff --git a/atdb/taskdatabase/static/taskdatabase/apertif_logo_fancy.jpg b/atdb/taskdatabase/static/taskdatabase/apertif_logo_fancy.jpg deleted file mode 100644 index f56ddcde75fb606494c63b61248d345e5ba92dfd..0000000000000000000000000000000000000000 Binary files a/atdb/taskdatabase/static/taskdatabase/apertif_logo_fancy.jpg and /dev/null differ diff --git a/atdb/taskdatabase/static/taskdatabase/apertif_logo_small.jpg b/atdb/taskdatabase/static/taskdatabase/apertif_logo_small.jpg deleted file mode 100644 index 55d354877b53062db167a49402aaf03be47eab44..0000000000000000000000000000000000000000 Binary files a/atdb/taskdatabase/static/taskdatabase/apertif_logo_small.jpg and /dev/null differ diff --git a/atdb/taskdatabase/static/taskdatabase/atdb_logo.jpg b/atdb/taskdatabase/static/taskdatabase/atdb_logo.jpg deleted file mode 100644 index fe1d4f74cb342b2686bcae4729f883d64af100e6..0000000000000000000000000000000000000000 Binary files a/atdb/taskdatabase/static/taskdatabase/atdb_logo.jpg and /dev/null differ diff --git a/atdb/taskdatabase/templates/taskdatabase/index.html b/atdb/taskdatabase/templates/taskdatabase/index.html index cf720fddf1de5bf77d5d223f6b7a6743b2fe18bf..a417c062306cd8a68bab12a71c8124499ba9fa81 100644 --- a/atdb/taskdatabase/templates/taskdatabase/index.html +++ b/atdb/taskdatabase/templates/taskdatabase/index.html @@ -46,7 +46,7 @@ </div> {% include 'taskdatabase/pagination.html' %} </div> - <p class="footer"> Version 2.0.0 (17 dec 2020 - 11:30)</p> + <p class="footer"> Version 2.0.0 (18 dec 2020 - 8:00)</p> <script type="text/javascript"> (function(seconds) {