Scripts
    Preparing search index...

    Scripts

    [[TOC]]

    Howto

    This is brief help about Legito App development stack.

    Legito app is using docker and docker compose to manage containerized parts of application.

    • Use docker compose 2 (plugin). It is not executable but docker plugin.
    • Use WSL2 on Windows for dockers
    • Place your source code into WSL2 not on Windows disk.
    • Use Windows 11 - it has better WSL2 integration.

    You can find, how to install it here.

    Legito dockers needs loki plugin.

    docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions
    

    You should have docker compose v2 instead of old docker compose binary.

    Linux/WSL

    ./cli.sh
    

    Windows batch/powershell

    cli.bat
    

    Now, you are able to use the best UI ever.

    When you want to switch branch, just checkout it with Git and use Switching branch action in CLI Gui.

    Prepare configuration files

    cp .env.dist .env
    cp src/Services/LegitoApp/app/config/config.local.personal.neon.example src/Services/LegitoApp/app/config/config.local.personal.neon

    You have to change COMPOSE_PROJECT_NAME .env variable if you want to run multiple legito instances.

    docker compose pull
    # If you want to build instead of pulling image
    # docker compose build
    docker compose up -d
    # If you want to re-build and start only specific service
    # docker compose up -d --build $COMPOSE_SERVICE_NAME
    docker compose exec --user legito backend runMigrations

    If you want to clean up all legito data including database

    docker compose down -v 
    

    If you want to rebuild all services and containers use:

    docker compose up -d --build --force-recreate
    

    Profiles (docker-compose)

    In .env there is COMPOSE_PROFILE variable. docker compose will start only services, defined in profile. You can override this setting by --profile [name] argument

    Feel free to create deployment profiles per environment.

    all common devel prod pwc minimal_dev legitosign integrations integrationsdb jsonintegration jsonintegrationdb elasticsearch wopi cypress_tests playwright_tests pdffromfill pdfformfilldb documentprocessordb
    backend
    templateimport
    documentexport
    documentimport
    acl
    frontend
    websocket
    integrationsdb
    mariadb
    legito_import
    legitosign
    jsonintegration
    integrations
    documentprocessor
    documentprocessor_import
    translations
    pdfformfill
    legitosigndb
    jsonintegrationdb
    pdfformfilldb
    documentprocessordb
    phpmyadmin
    adminer
    legitotools
    nodeexporter
    logrotate
    cadvisor
    promtail
    rabbitmq
    redis
    elasticsearch
    loki
    apisix
    grafana
    prometheus
    wopi
    dev_openssl
    dev_ssl_proxy
    dev_maildev
    cypress_tests
    playwright_tests

    Containers and Micro-services

    Migrations:

    docker-compose exec jsonintegration runMigrations
    

    swagger available on /jsonintegration/swagger if DOTNET_ENVIRONMENT=Development .env variable set correctly.

    swagger available on /translations/swagger if DOTNET_ENVIRONMENT=Development .env variable set correctly.

    tools

    !! All legito tools are secured by basic auth .ENV - TOOLS_USER, TOOLS_PASSWORD !!*

    Grafana will be available on /__tools/grafana.

    All docker containers

    Phpmyadmin will be available on /__tools/phpmyadmin

    There is dev_openssl sidecar container. Executed as backend dependency. Certificatess will be located in ./dev_ssl/

    docker compose run integraton_tests cypress_junit --help
    

    More info

    In docker-compose version > 2.5 is "bug/feature" with ./ in volumes section. Please downgrade to older version.

    If you are using windows or mac, you should have checkbox in your docker desktop GUI. If not, update your docker desktop.

    Uninstall docker compose v1

    # Debian/Ubuntu based OS
    sudo apt remove docker-compose
    # Fedore/RHEL based OS
    sudo dnf remove docker-compose
    # Manual installation
    sudo rm /usr/local/bin/docker-compose

    Install docker compose v2

    # Debian/Ubuntu based OS
    sudo apt-get install docker-compose-plugin
    # Fedore/RHEL based OS
    sudo dnf install docker-compose-plugin
    # Manual installation
    DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
    mkdir -p $DOCKER_CONFIG/cli-plugins
    curl -SL https://github.com/docker/compose/releases/download/v2.6.0/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose

    Create "proxy script" with name docker-compose in /usr/local/bin

    #!/bin/bash
    docker compose $@