Installation Localhost

Requirements

  • Ubuntu 20.04

  • 4 Cores

  • 4 GB RAM

  • at least 30 GB HDD, 50 GB recommended

Docker und docker-compose installieren:

apt-get install -y docker.io docker-compose

create a folder on the Host Maschine and change to that dir:

mkdir /usr/share/t2core/

Create an Enviroment File /usr/share/t2core/.env:

PWD=./
DOCKER_REGISTRY=docker.io
DOCKER_PROJECT=tri2
DOCKER_TAG=latest
T2CORE_SECRET_KEY=dosiufzgd89f7gzjd8f7zgjSEFSfesEFEWFgHjk98dfzsj098dzfj
T2CORE_DATABASE_PASSWORD=sdlfihsmd9f8zgsDFSDfef8sdzgfsRGD8dzgfsz8df

Change the shown T2CORE_SECRET_KEY and T2CORE_DATABASE_PASSWORD as this are only the default Values.

Create a File /usr/share/t2core/docker-compose.yml:

version: "2.2"
services:

  t2_core:
    image: "${DOCKER_REGISTRY}/${DOCKER_PROJECT}/t2-core:${DOCKER_TAG}"
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ${PWD}/t2core_data:/data:rw
    environment:
      # enables debug mode in django. this is very insecure. __do__ __not__ enable it, when django runs on a public environment!
      DEBUG: "false"
      START_PAGE_APP_URL: 't2ldap.urls'
      SECRET_KEY: "${T2CORE_SECRET_KEY}"
      IMPORTER_NETWORK_NAME_PREFIX: "localhost_"
      DATABASE_HOST: "database"
      DATABASE_PORT: "5432"
      DATABASE_NAME: "t2_core"
      DATABASE_USERNAME: "t2core"
      DATABASE_PASSWORD: "${T2CORE_DATABASE_PASSWORD}"
      DOCKER_REGISTRY: "${DOCKER_REGISTRY}"
      DOCKER_PROJECT: "${DOCKER_PROJECT}"
      DOCKER_TAG: "${DOCKER_TAG}"

    networks:
      - internal
    links:
      - "t2_database:database"
    labels:
      traefik.enable: "true"
      traefik.docker.network: "t2core_router"
      traefik.frontend.passhostheader: "False"
      traefik.http.routers.t2_core.entrypoints: "web"
      traefik.http.routers.t2_core.rule: "PathPrefix(`/`)"
      traefik.http.routers.t2_core.service: "t2_core"

      traefik.http.routers.t2_core_s.entrypoints: "websecure"
      traefik.http.routers.t2_core_s.rule: "PathPrefix(`/`)"
      traefik.http.routers.t2_core_S.service: "t2_core"
      traefik.http.routers.t2_core_S.tls: ""

      traefik.http.services.t2_core.loadbalancer.server.port: "8000"
      traefik.http.services.t2_core.loadbalancer.server.scheme: "http"

      traefik.tcp.routers.t2_ldapproxy.entrypoints: "ldap"
      traefik.tcp.routers.t2_ldapproxy.rule: "HostSNI (`*`)"
      traefik.tcp.routers.t2_ldapproxy.service: "t2_ldapproxy"#
      traefik.tcp.routers.t2_ldapproxy_s.entrypoints: "ldapsecure"
      traefik.tcp.routers.t2_ldapproxy_s.rule: "HostSNI (`*`)"
      traefik.tcp.routers.t2_ldapproxy_s.service: "t2_ldapproxy"
      traefik.tcp.routers.t2_ldapproxy_s.tls: ""
      traefik.tcp.services.t2_ldapproxy.loadbalancer.server.port: "389"


  t2_database:
    image: postgres:13
    restart: always
    volumes:
      - t2core_database:/data:rw
    environment:
      POSTGRES_PASSWORD: "${T2CORE_DATABASE_PASSWORD}"
      POSTGRES_USER: "t2core"
      POSTGRES_DB: "t2_core"
      PGDATA: "/data"
    networks:
      - internal


volumes:
  t2core_database:

networks:
  # internal network between django and its database
  internal:

Bemerkung

Database version: the postgres database version must be set to a major version (postgres:12, postgres:13), because database files are not compatible between major versions. Currently this is version 13, installations can be migrated between versions, but this cannot be done automatically. See https://www.postgresql.org/docs/current/upgrading.html and https://github.com/docker-library/postgres/issues/766

to start the server in /usr/share/t2core/ execute the command:

docker-compose up -d

after a while the server starts, a admin account root is generated and its password is written to the container logs once:

docker-compose logs t2_core
t2_core_1      | new password of user "root" is:
t2_core_1      |
t2_core_1      |                5e425930-a8d2-4d71-bfe0-18a6df19c66c

Bemerkung

this is a random generated password. the one shown here will not work on your maschine.

with that credential you can login as admin on http://<ip-address>/.

if you like to create another admin account:

docker-compose exec t2_core ./manage.py createsuperuser

the install is done now if you are able to login and you can proceed to the configuration.