Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: add dependency installation commands for RHEL based systems #2059

Merged
merged 9 commits into from
Dec 5, 2023

Conversation

Stef16Robbe
Copy link
Contributor

Changes

  • Adds local installation instructions for RHEL based machines in docs/source/technical_design/localinstall.rst
  • It also updates the NodeJS commands to not use the deprecated installation scripts (this should also be done for Debian systems but I have not spent the time on that yet)
  • Also fixes an issue with inproper URL link syntax towards Docker docs

Issue link

Closes 2058

Demo

N.A.

Code Checklist

  • All the commits in this PR are properly PGP-signed and verified;
  • This PR only contains functionality relevant to the issue; tickets have been created for newly discovered issues.
  • I have performed a self-review of my code and refactored it to the best of my abilities.

Communication

  • I have made corresponding changes to the documentation, if necessary.

Checklist for code reviewers:

Copy-paste the checklist from the docs/source/templates folder into your comment.


Checklist for QA:

Copy-paste the checklist from the docs/source/templates folder into your comment.

@Stef16Robbe Stef16Robbe requested a review from a team as a code owner November 26, 2023 00:03
@CLAassistant
Copy link

CLAassistant commented Nov 26, 2023

CLA assistant check
All committers have signed the CLA.

underdarknl
underdarknl previously approved these changes Nov 27, 2023
@underdarknl
Copy link
Contributor

@Stef16Robbe thank you! RHEL should be a first class citizen in the OpenKat ecosystem.
It looks like our precommit tool does not like the empty new line at the end of the docs though, could you remove that?

Co-authored-by: Rieven <rsnmartis@gmail.com>
ammar92
ammar92 previously approved these changes Nov 28, 2023
@stephanie0x00
Copy link
Contributor

@Stef16Robbe Thanks! This is a nice addition to our docs. I'm currently trying to get it to work on Fedora. During the build phase it has troubles connecting and building the Postgres database. Haven't figured out yet what is going wrong, so I'll continue debugging.

@Stef16Robbe
Copy link
Contributor Author

@Stef16Robbe Thanks! This is a nice addition to our docs. I'm currently trying to get it to work on Fedora. During the build phase it has troubles connecting and building the Postgres database. Haven't figured out yet what is going wrong, so I'll continue debugging.

@stephanie0x00 Good thing you double checked! On my current working install I also get some Postgres "Connection refused" logs, but it does work after a few tries:

while ! nc -vz $ROCKY_DB_HOST $ROCKY_DB_PORT; do sleep 0.1; done
nc: connect to postgres (172.20.0.2) port 5432 (tcp) failed: Connection refused
...
nc: connect to postgres (172.20.0.2) port 5432 (tcp) failed: Connection refused
Connection to postgres (172.20.0.2) 5432 port [tcp/postgresql] succeeded!

I did a sanity check on a completely clean install again, and I seem to run into the same issue as you are:

while ! nc -vz $ROCKY_DB_HOST $ROCKY_DB_PORT; do sleep 0.1; done
nc: connect to postgres (172.20.0.2) port 5432 (tcp) failed: Connection refused
nc: connect to postgres (172.20.0.2) port 5432 (tcp) failed: Connection refused
nc: connect to postgres (172.20.0.2) port 5432 (tcp) failed: Connection refused
nc: getaddrinfo for host "postgres" port 5432: Name or service not known
nc: getaddrinfo for host "postgres" port 5432: Name or service not known
nc: getaddrinfo for host "postgres" port 5432: Name or service not known
nc: getaddrinfo for host "postgres" port 5432: Name or service not known
nc: getaddrinfo for host "postgres" port 5432: Name or service not known
nc: getaddrinfo for host "postgres" port 5432: Name or service not known
nc: getaddrinfo for host "postgres" port 5432: Name or service not known
nc: getaddrinfo for host "postgres" port 5432: Name or service not known
nc: getaddrinfo for host "postgres" port 5432: Name or service not known
nc: getaddrinfo for host "postgres" port 5432: Name or service not known
nc: getaddrinfo for host "postgres" port 5432: Name or service not known
nc: getaddrinfo for host "postgres" port 5432: Name or service not known
nc: getaddrinfo for host "postgres" port 5432: Name or service not known
...

On my working system I haven't done any installs related to postgres (to my knowledge, I checked my dnf history), so I'm not sure where this is coming from.

First thoughts were installing postgresql, and initializing the database using sudo /usr/bin/postgresql-setup --initdb

nc is looking for the postgres server so I thought I should start it: sudo systemctl enable --now postgresql

But make kat didn't like that:

...
Creating nl-kat-coordination_postgres_1 ... 
Creating nl-kat-coordination_postgres_1 ... error

ERROR: for nl-kat-coordination_postgres_1  Cannot start service postgres: driver failed programming external connectivity on endpoint nl-kat-coordination_postgres_1 (7d1b99cc06624ead1877e2299978e00ca801ac15354bbfa2d4144c6d74d36a1a): Error starting userland proxy: listen tcp4 127.0.0.1:5432: bind: address already in use

ERROR: for postgres  Cannot start service postgres: driver failed programming external connectivity on endpoint nl-kat-coordination_postgres_1 (7d1b99cc06624ead1877e2299978e00ca801ac15354bbfa2d4144c6d74d36a1a): Error starting userland proxy: listen tcp4 127.0.0.1:5432: bind: address already in use
ERROR: Encountered errors while bringing up the project.
...

I'm not familiar enough yet with OpenKat's build process to solve this immediately but I'll look into it.

@Stef16Robbe Stef16Robbe marked this pull request as draft November 28, 2023 18:43
@Stef16Robbe
Copy link
Contributor Author

I think I've found the culprit. The nl-kat-coordination_postgres_1 container gets initialized but keeps restarting with the following error:

vm@fedora:~/nl-kat-coordination$ docker ps
CONTAINER ID   IMAGE                       COMMAND                  CREATED         STATUS                          PORTS     NAMES
849ba0280dd7   nl-kat-coordination_rocky   "/app/rocky/entrypoi…"   3 minutes ago   Up 3 minutes                              nl-kat-coordination_rocky_run_f213a3a57f42
8fce43ca8108   postgres:15                 "docker-entrypoint.s…"   3 minutes ago   Restarting (1) 17 seconds ago             nl-kat-coordination_postgres_1
vm@fedora:~/nl-kat-coordination$ docker container logs 8fce43ca8108
Error: Database is uninitialized and superuser password is not specified.
       You must specify POSTGRES_PASSWORD to a non-empty value for the
       superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".

       You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
       connections without a password. This is *not* recommended.

       See PostgreSQL documentation about "trust":
       https://www.postgresql.org/docs/current/auth-trust.html
...

docker inspect output:

[
    {
        "Id": "8fce43ca81084c2802f622576f5b0eb51ad9ce233e4f5945887e7a8fb69180a7",
        "Created": "2023-11-28T18:54:50.722449397Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "postgres"
        ],
        "State": {
            "Status": "restarting",
            "Running": true,
            "Paused": false,
            "Restarting": true,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 1,
            "Error": "",
            "StartedAt": "2023-11-28T19:05:43.225254661Z",
            "FinishedAt": "2023-11-28T19:05:43.497627847Z",
            "Health": {
                "Status": "unhealthy",
                "FailingStreak": 0,
                "Log": []
            }
        },
        "Image": "sha256:8cde386e2e85cce0eb684d0b27ddf6a8abbecd05d5af43bbbdf7be12c47c44e8",
        "ResolvConfPath": "/var/lib/docker/containers/8fce43ca81084c2802f622576f5b0eb51ad9ce233e4f5945887e7a8fb69180a7/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/8fce43ca81084c2802f622576f5b0eb51ad9ce233e4f5945887e7a8fb69180a7/hostname",
        "HostsPath": "/var/lib/docker/containers/8fce43ca81084c2802f622576f5b0eb51ad9ce233e4f5945887e7a8fb69180a7/hosts",
        "LogPath": "/var/lib/docker/containers/8fce43ca81084c2802f622576f5b0eb51ad9ce233e4f5945887e7a8fb69180a7/8fce43ca81084c2802f622576f5b0eb51ad9ce233e4f5945887e7a8fb69180a7-json.log",
        "Name": "/nl-kat-coordination_postgres_1",
        "RestartCount": 20,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "/home/vm/nl-kat-coordination/init-user-db.sh:/docker-entrypoint-initdb.d/init-user-db.sh:rw",
                "nl-kat-coordination_postgres-data:/var/lib/postgresql/data:rw"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "nl-kat-coordination_default",
            "PortBindings": {
                "5432/tcp": [
                    {
                        "HostIp": "127.0.0.1",
                        "HostPort": "5432"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "unless-stopped",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": [],
            "ConsoleSize": [
                0,
                0
            ],
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "private",
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 268435456,
            "Runtime": "runc",
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": null,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware",
                "/sys/devices/virtual/powercap"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/cf1cb3f8f161bbc01e214c3de0a99bab32fd27f23f5bdd0afcee67fcbcf8d8cc-init/diff:/var/lib/docker/overlay2/bf11b07e05c7804886f05b5c2899175e59e2a1746bf297b5346b2705dca200d8/diff:/var/lib/docker/overlay2/cc80e97863ae501c650527a801daf421c5da854becdadfeea450366f4530fe80/diff:/var/lib/docker/overlay2/bdf0410de364bdf60dd8faf79b8434a60849998b7463e2bc5140c81becb5c587/diff:/var/lib/docker/overlay2/85851aede087b2dbcb1cbe5a34baaac6a4d40d8859ba6a296c6bd74e2b89ba0d/diff:/var/lib/docker/overlay2/4329defb157d543487caecacea39a3bbb58cd36eedcf96bef634c6c8ccb52fd4/diff:/var/lib/docker/overlay2/bc841e2dffe9406e0e27049fa50b0e1de106838ad55f765d3466c66318fbf251/diff:/var/lib/docker/overlay2/b3a6a25854a677f1c3ef7c3f98d15becb71cf7a53ea4b16938499801696e9544/diff:/var/lib/docker/overlay2/5bcca77da300879d0a8e0ef010ad2054d8e746be443be4cbf24be6d31bb06a81/diff:/var/lib/docker/overlay2/0f68c186f48ae8b52cb2f588593a5c93ef48fe783abb6b9061551ad3ad1f5071/diff:/var/lib/docker/overlay2/c35617472e3b40877315b4c60fa2bb0dd9127e22f25f3366c3b45dbeb84c3c5f/diff:/var/lib/docker/overlay2/29465a8d0cc609b6910431eac602a97916f748c8f5e0587175f73805c73df380/diff:/var/lib/docker/overlay2/d688d1b0a16dcbb361b560201e06c7afa14d8d28ea8dd9456d2901413592c379/diff:/var/lib/docker/overlay2/328aa7e6f630e61da5cc8f6f31201669d08e1db97b99a268f79ccabd10d119c9/diff",
                "MergedDir": "/var/lib/docker/overlay2/cf1cb3f8f161bbc01e214c3de0a99bab32fd27f23f5bdd0afcee67fcbcf8d8cc/merged",
                "UpperDir": "/var/lib/docker/overlay2/cf1cb3f8f161bbc01e214c3de0a99bab32fd27f23f5bdd0afcee67fcbcf8d8cc/diff",
                "WorkDir": "/var/lib/docker/overlay2/cf1cb3f8f161bbc01e214c3de0a99bab32fd27f23f5bdd0afcee67fcbcf8d8cc/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/home/vm/nl-kat-coordination/init-user-db.sh",
                "Destination": "/docker-entrypoint-initdb.d/init-user-db.sh",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "volume",
                "Name": "nl-kat-coordination_postgres-data",
                "Source": "/var/lib/docker/volumes/nl-kat-coordination_postgres-data/_data",
                "Destination": "/var/lib/postgresql/data",
                "Driver": "local",
                "Mode": "rw",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "8fce43ca8108",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "5432/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "DATABASE_MIGRATION=true",
                "DEBUG=True",
                "TWOFACTOR_ENABLED=False",
                "OCTOPOES_API=http://octopoes_api:80",
                "SCHEDULER_API=http://scheduler:8000",
                "KEIKO_API=http://keiko:8000",
                "KATALOGUS_API=http://katalogus:8000",
                "XTDB_URI=http://crux:3000",
                "BOEFJE_API=http://boefje:8000",
                "BYTES_API=http://bytes:8000",
                "DJANGO_SUPERUSER_EMAIL=superuser@localhost",
                "DJANGO_SUPERUSER_FULL_NAME=KAT Superuser",
                "DJANGO_ALLOWED_HOSTS=127.0.0.1,localhost",
                "DJANGO_CSRF_TRUSTED_ORIGINS=http://localhost,http://127.0.0.1",
                "ROCKY_DB_USER_CREATEDB=CREATEDB",
                "POSTGRES_USER=postgres",
                "POSTGRES_PASSWORD=",
                "RABBITMQ_DEFAULT_VHOST=kat",
                "RABBITMQ_DEFAULT_USER=",
                "RABBITMQ_DEFAULT_PASS=",
                "QUEUE_URI=amqp://:@rabbitmq:5672/kat",
                "BYTES_USERNAME=",
                "BYTES_PASSWORD=",
                "DJANGO_SUPERUSER_PASSWORD=",
                "SECRET_KEY=",
                "ROCKY_DB=rocky",
                "ROCKY_DB_USER=rocky_app",
                "ROCKY_DB_HOST=postgres",
                "ROCKY_DB_PORT=5432",
                "ROCKY_DB_PASSWORD=",
                "KATALOGUS_DB=katalogus",
                "KATALOGUS_DB_USER=katalogus_app",
                "KATALOGUS_DB_PASSWORD=",
                "KATALOGUS_DB_URI=postgresql://katalogus_app:@postgres:5432/katalogus",
                "BYTES_SECRET=",
                "BYTES_DB=bytes",
                "BYTES_DB_USER=bytes_app",
                "BYTES_DB_PASSWORD=",
                "BYTES_DB_URI=postgresql://bytes_app:@postgres:5432/bytes",
                "SCHEDULER_DB=scheduler",
                "SCHEDULER_DB_USER=scheduler_app",
                "SCHEDULER_DB_PASSWORD=",
                "SCHEDULER_DB_URI=postgresql://scheduler_app:@postgres:5432/scheduler",
                "APPS=ROCKY BYTES KATALOGUS SCHEDULER",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/15/bin",
                "GOSU_VERSION=1.16",
                "LANG=en_US.utf8",
                "PG_MAJOR=15",
                "PG_VERSION=15.5-1.pgdg120+1",
                "PGDATA=/var/lib/postgresql/data"
            ],
            "Cmd": [
                "postgres"
            ],
            "Healthcheck": {
                "Test": [
                    "CMD",
                    "gosu",
                    "postgres",
                    "pg_isready"
                ],
                "Interval": 10000000000,
                "Retries": 10
            },
            "Image": "postgres:15",
            "Volumes": {
                "/docker-entrypoint-initdb.d/init-user-db.sh": {},
                "/var/lib/postgresql/data": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "com.docker.compose.config-hash": "0219337d410e4efac50465a3746714f2846b85d968cd16f0749a26bd1003d99c",
                "com.docker.compose.container-number": "1",
                "com.docker.compose.oneoff": "False",
                "com.docker.compose.project": "nl-kat-coordination",
                "com.docker.compose.project.config_files": "../docker-compose.yml",
                "com.docker.compose.project.working_dir": "/home/vm/nl-kat-coordination",
                "com.docker.compose.service": "postgres",
                "com.docker.compose.version": "1.29.2"
            },
            "StopSignal": "SIGINT"
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "9a022ccb9a8ba468571495441ac28549b167293fede232ca7a0c691a3b6f2a25",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/9a022ccb9a8b",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "nl-kat-coordination_default": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "8fce43ca8108",
                        "postgres"
                    ],
                    "NetworkID": "75a2e81d9e566d2696a2bb3ee96503ec09a0ec7cb41df00f6d202162558ddc19",
                    "EndpointID": "",
                    "Gateway": "",
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "",
                    "DriverOpts": null
                }
            }
        }
    }
]

@Stef16Robbe
Copy link
Contributor Author

Stef16Robbe commented Nov 28, 2023

The error says it all basically, and it can also be seen in the docker inspect output I shared. POSTGRES_PASSWORD and other secrets were empty because I hadn't ran make env yet. In order to run make env, openssl is required which is not available by default, so I'm adding that to the prereqs section.

After that everything ran smoothly and I was able to start OpenKat and walk through the onboarding.

make env is described in docs/source/technical_design/containers.md. Shouldn't that also be included here?

@Stef16Robbe Stef16Robbe marked this pull request as ready for review November 28, 2023 19:39
@stephanie0x00
Copy link
Contributor

@Stef16Robbe The installation of openssl seemed to be the trick indeed. I don't recall that running make env was necessary on Debian/Ubuntu. I'm in favour of adding this to the documentation for all systems.

What I also noticed was that our current installation steps are a bit confusing as to whether or not to install Docker from the repositories, as we mention that docker-compose should be installed. We advise to install via Docker directly, as the debian/ubuntu repos are offering an outdated docker which doesn't have some of the features that are being required for OpenKAT. This might also be the case for (certain) Fedora versions.

Stef16Robbe and others added 2 commits November 30, 2023 17:00
Make it more clear when to install from the Docker repositories, add the docker-compose symlink and add 'make env'.
stephanie0x00
stephanie0x00 previously approved these changes Dec 4, 2023
Copy link
Contributor

@stephanie0x00 stephanie0x00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA on Fedora with the install commands works. Ready for merge.

@underdarknl underdarknl merged commit 9f8ac09 into minvws:main Dec 5, 2023
5 of 6 checks passed
jpbruinsslot added a commit that referenced this pull request Dec 6, 2023
* main: (25 commits)
  Create object history API (#2074)
  Bump actions/github-script from 6 to 7 (#2076)
  Installation manual for Windows (2) (#2096)
  Update howdoesitwork.rst (#2091)
  Add benchmarking script to the scheduler (#2071)
  Add fix-poetry-merge-conflict makefile command (#2088)
  Bump sphinx-rtd-theme from 1.2.2 to 2.0.0 (#2080)
  Lower quality level so the CI check doesn't fail (#2086)
  Update xtdb version in octopoes CI docker compose and docker-compose.release-example.yml (#2085)
  Name test nodes by testname instead of uuid (#2087)
  Upgrade to Pydantic v2 (#1912)
  Docs: add dependency installation commands for RHEL based systems (#2059)
  Fix/2072 (#2082)
  Feature/service to systems reports rocky (#2073)
  Update scheduler python packages (#2062)
  Add uvicorn back as non-dev dependency (#2053)
  Bump `cryptography` (#2070)
  Filter tree objects with depth=1 for Findings  (#1982)
  Bump aiohttp from 3.8.6 to 3.9.0 in /boefjes (#2061)
  Translations update from Hosted Weblate (#2057)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add DNF/RHEL based instructions to local install doc
6 participants