From c0c4e67ad1d02ea4c4c5dd5e03ce33c5aa7c6ec5 Mon Sep 17 00:00:00 2001 From: karnem <mikhail.karnevskiy@desy.de> Date: Tue, 11 Jul 2023 16:24:40 +0200 Subject: [PATCH] Add components to run standalone asapo service inside of build_env container. This should help to run integration tests. --- .gitlab-ci.yml | 5 +- deploy/build_env/services-linux/Dockerfile | 27 ++++--- .../build_env/services-linux/admin_token.key | 1 + .../build_env/services-linux/auth_secret.key | 1 + .../services-linux/auth_secret_admin.key | 1 + deploy/build_env/services-linux/run_asapo.sh | 19 +++++ .../build_env/services-linux/supervisord.conf | 79 +++++++++++++++++++ 7 files changed, 120 insertions(+), 13 deletions(-) create mode 100644 deploy/build_env/services-linux/admin_token.key create mode 100644 deploy/build_env/services-linux/auth_secret.key create mode 100644 deploy/build_env/services-linux/auth_secret_admin.key create mode 100644 deploy/build_env/services-linux/run_asapo.sh create mode 100644 deploy/build_env/services-linux/supervisord.conf diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 90ded2514..6df10acce 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -116,9 +116,8 @@ test-services-linux-debug: name: $CI_REGISTRY_IMAGE/asapo-services-linux-build-env:latest stage: test script: - - bash /services_start.sh - # - cd $CI_PROJECT_DIR/build/tests/automatic/common_scripts - # - bash start_services.sh + - cd $CI_PROJECT_DIR + - bash /run_asapo.sh - cd $CI_PROJECT_DIR/build - ctest --no-compress-output -T Test -L "unit|memcheck_unit|coverage" --output-on-failure --output-junit testResult.xml tags: diff --git a/deploy/build_env/services-linux/Dockerfile b/deploy/build_env/services-linux/Dockerfile index d86e0eb58..0f98bfa80 100644 --- a/deploy/build_env/services-linux/Dockerfile +++ b/deploy/build_env/services-linux/Dockerfile @@ -8,10 +8,19 @@ RUN echo "deb [signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg] http:/ RUN echo "deb http://deb.debian.org/debian bullseye-backports main" >> /etc/apt/sources.list +RUN curl -fsSL https://repos.influxdata.com/influxdata-archive_compat.key | gpg --dearmor > /usr/share/keyrings/influxdb.gpg +RUN echo "deb [signed-by=/usr/share/keyrings/influxdb.gpg] https://repos.influxdata.com/debian bullseye stable" > /etc/apt/sources.list.d/influxdb.list + RUN set -eux; \ apt-get update; \ - apt-get install -y --no-install-recommends \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + apt-utils + +RUN set -eux; \ + apt-get update; \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ cmake \ + supervisor \ libicu-dev \ libfabric-dev \ librdkafka-dev \ @@ -36,6 +45,9 @@ RUN set -eux; \ libgrpc++-dev \ libprotobuf-dev \ jq \ + influxdb \ + mongodb-org-shell \ + --option=Dpkg::Options::=--force-confdef \ ; \ pip install sphinx; \ apt-get install -y --no-install-recommends cmake/bullseye-backports; \ @@ -126,13 +138,8 @@ nisNetgroupTriple: (localhost,-,)\n\ nisNetgroupTriple: (blabla2,-,)\n\ " > /etc/ldap/record.ldif -RUN echo "\n\ -/usr/bin/nomad agent -config /etc/nomad.d &> /dev/null &\n\ -/usr/bin/consul agent -config-dir=/etc/consul.d/ &> /dev/null &\n\ -service slapd start\n\ -service mongod start\n\ -\n\ -ldapadd -x -D \"ou=rgy,o=desy,c=de\" -f /etc/ldap/record.ldif -h localhost\n\ -" > /services_start.sh +RUN mkdir -p /var/log/supervisord/ -CMD ["bash", "/services_start.sh"] +COPY *.key / +COPY supervisord.conf /etc/ +COPY run_asapo.sh / diff --git a/deploy/build_env/services-linux/admin_token.key b/deploy/build_env/services-linux/admin_token.key new file mode 100644 index 000000000..eaffcbbc6 --- /dev/null +++ b/deploy/build_env/services-linux/admin_token.key @@ -0,0 +1 @@ +eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJjMTkyc29qaXB0MzB1dGQ3bDdhZyIsInN1YiI6ImFkbWluIiwiRXh0cmFDbGFpbXMiOnsiQWNjZXNzVHlwZXMiOlsiY3JlYXRlIl19fQ.gVEFtqaAcP9HSzttWX2GrNBaM52np5k8k-7BqDAJ3xw \ No newline at end of file diff --git a/deploy/build_env/services-linux/auth_secret.key b/deploy/build_env/services-linux/auth_secret.key new file mode 100644 index 000000000..60ba53035 --- /dev/null +++ b/deploy/build_env/services-linux/auth_secret.key @@ -0,0 +1 @@ +12ljzgneasfd \ No newline at end of file diff --git a/deploy/build_env/services-linux/auth_secret_admin.key b/deploy/build_env/services-linux/auth_secret_admin.key new file mode 100644 index 000000000..3eb59062c --- /dev/null +++ b/deploy/build_env/services-linux/auth_secret_admin.key @@ -0,0 +1 @@ +12c2ljwewezgnea \ No newline at end of file diff --git a/deploy/build_env/services-linux/run_asapo.sh b/deploy/build_env/services-linux/run_asapo.sh new file mode 100644 index 000000000..3533e8955 --- /dev/null +++ b/deploy/build_env/services-linux/run_asapo.sh @@ -0,0 +1,19 @@ +cp build/authorizer/asapo-authorizer /asapo-authorizer +cp build/discovery/asapo-discovery /asapo-discovery +cp build/broker/asapo-broker /asapo-broker +cp build/file_transfer/asapo-file-transfer /asapo-file-transfer +cp build/receiver/receiver /receiver +cp build/monitoring/monitoring_server/asapo-monitoring-server /asapo-monitoring-server + + +cp deploy/asapo_services_light/*json / + +cp build/deploy/asapo_services_light/nginx.conf /etc/nginx/nginx.conf + +service slapd start +ldapadd -x -D "ou=rgy,o=desy,c=de" -f /etc/ldap/record.ldif -h localhost + +cd / && supervisord --configuration /etc/supervisord.conf & +sleep 10 +cd - + diff --git a/deploy/build_env/services-linux/supervisord.conf b/deploy/build_env/services-linux/supervisord.conf new file mode 100644 index 000000000..f8c9cffee --- /dev/null +++ b/deploy/build_env/services-linux/supervisord.conf @@ -0,0 +1,79 @@ +[supervisord] +nodaemon = true +logfile=/var/log/supervisord/supervisord.log ; supervisord log file +logfile_maxbytes=50MB ; maximum size of logfile before rotation +logfile_backups=10 ; number of backed up logfiles +loglevel=info ; info, debug, warn, trace +childlogdir=/var/log/supervisord/ ; where child log files will live +user=root + +[program:mongo] +command=/usr/bin/mongod --bind_ip_all --dbpath /var/lib/mongodb/ +stderr_logfile=/tmp/mongo_err.log +stderr_logfile_maxbytes = 0 +stdout_logfile=/tmp/mongo_out.log +stdout_logfile_maxbytes = 0 + +[program:influxdb] +command = /usr/bin/influxd -config /etc/influxdb/influxdb.conf +environment=INFLUXDB_HTTP_FLUX_ENABLED="true", PRE_CREATE_DB="asapo_receivers;asapo_brokers" +stderr_logfile=/tmp/influx_err.log +stderr_logfile_maxbytes = 0 +stdout_logfile=/tmp/influx_out.log +stdout_logfile_maxbytes = 0 + +[program:nginx] +command=/usr/sbin/nginx -g "daemon off;" +stderr_logfile=/tmp/nginx_err.log +stderr_logfile_maxbytes = 0 +stdout_logfile=/tmp/nginx_out.log +stdout_logfile_maxbytes = 0 + +[program:discovery] +command=/asapo-discovery -config discovery.json +stderr_logfile=/tmp/discovery_err.log +stderr_logfile_maxbytes = 0 +stdout_logfile=/tmp/discovery_out.log +stdout_logfile_maxbytes = 0 + +[program:authorizer] +command=/asapo-authorizer -config authorizer.json +stderr_logfile=/tmp/authorizer_err.log +stderr_logfile_maxbytes = 0 +stdout_logfile=/tmp/authorizer_out.log +stdout_logfile_maxbytes = 0 + +[program:broker] +command=/asapo-broker -config broker.json +stderr_logfile=/tmp/broker_err.log +stderr_logfile_maxbytes = 0 +stdout_logfile=/tmp/broker_out.log +stdout_logfile_maxbytes = 0 + +[program:fts] +command=/asapo-file-transfer -config file-transfer.json +stderr_logfile=/tmp/fts_err.log +stderr_logfile_maxbytes = 0 +stdout_logfile=/tmp/fts_out.log +stdout_logfile_maxbytes = 0 + +[program:receiver] +command=/receiver receiver.json +stderr_logfile=/tmp/receiver_err.log +stderr_logfile_maxbytes = 0 +stdout_logfile=/tmp/receiver_out.log +stdout_logfile_maxbytes = 0 + +[program:monitoring] +command=/asapo-monitoring-server -config monitoring.json +stderr_logfile=/tmp/monitoring_err.log +stderr_logfile_maxbytes = 0 +stdout_logfile=/tmp/monitoring_out.log +stdout_logfile_maxbytes = 0 + +[program:consul] +command=/usr/bin/consul agent -config-dir=/etc/consul.d/ +stderr_logfile=/tmp/consul_err.log +stderr_logfile_maxbytes = 0 +stdout_logfile=/tmp/consul_out.log +stdout_logfile_maxbytes = 0 -- GitLab