splitgraph / sgr

sgr (command line client for Splitgraph) and the splitgraph Python library
https://www.splitgraph.com
Other
325 stars 17 forks source link

Issue installing splitgraph while using csf #808

Closed MaraScott closed 1 year ago

MaraScott commented 1 year ago

Hi,

I m trying to run for first time $ bash -c "$(curl -sL https://github.com/splitgraph/sgr/releases/latest/download/install.sh)" on debian 11 but each time I have the same issue

Installing the sgr binary from https://github.com/splitgraph/sgr/releases/download/v0.3.12/sgr-linux-x86_64 into /root/.splitgraph
sgr, version 0.3.12
sgr binary installed.

Setting up a Splitgraph engine.
The engine will be set up with default credentials:

username: sgr
password: password
port: 6432

These credentials are just for this local Postgres installation
and can be changed after install.

Pulling image splitgraph/engine:0.3.12...
Extracting:   0%|                                                            | 0.00/1.00 [00:00<?, ?B/s]
Downloading:   0%|                                                           | 0.00/1.00 [00:00<?, ?B/s]
Creating container splitgraph_engine_default.
Data volume: splitgraph_engine_default_data.
Metadata volume: splitgraph_engine_default_metadata.
Container created, ID 5f71adb03a
Initializing engine PostgresEngine default (sgr@localhost:6432/splitgraph)...
Waiting for connection...............
Error connecting to the engine after 12 retries
Traceback (most recent call last):
  File "splitgraph/engine/postgres/psycopg.py", line 650, in _admin_conn
  File "psycopg2/__init__.py", line 122, in connect
  File "psycopg2/extras.py", line 762, in wait_select
psycopg2.OperationalError: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

error: psycopg2.OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
Fatal: Error setting up the engine. If an engine already exists, you can skip this step by setting $SKIP_ENGINE=1. In case of a port conflict, you can restart the installer with ENGINE_PORT set to some other port.

I can't find out where is my issue

Can you help ?

mildbyte commented 1 year ago

Looks like the engine crashes before the sgr client can connect to it. Can you paste the engine logs?

docker logs splitgraph_engine_default
MaraScott commented 1 year ago
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "C.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:
initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

    pg_ctl -D /var/lib/postgresql/data -l logfile start

waiting for server to start....2023-05-10 12:44:47.857 GMT [47] LOG:  starting PostgreSQL 12.11 (Debian 12.11-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2023-05-10 12:44:47.857 GMT [47] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-05-10 12:44:47.865 GMT [48] LOG:  database system was shut down at 2023-05-10 12:44:47 GMT
2023-05-10 12:44:47.869 GMT [47] LOG:  database system is ready to accept connections
 done
server started
CREATE DATABASE

/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/000_create_extensions.sql
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE SERVER

2023-05-10 12:44:48.207 GMT [47] LOG:  received fast shutdown request
waiting for server to shut down....2023-05-10 12:44:48.208 GMT [47] LOG:  aborting any active transactions
2023-05-10 12:44:48.211 GMT [47] LOG:  background worker "logical replication launcher" (PID 54) exited with exit code 1
2023-05-10 12:44:48.213 GMT [49] LOG:  shutting down
2023-05-10 12:44:48.231 GMT [47] LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

2023-05-10 12:44:48.324 GMT [1] LOG:  starting PostgreSQL 12.11 (Debian 12.11-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2023-05-10 12:44:48.324 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-05-10 12:44:48.324 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2023-05-10 12:44:48.326 GMT [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-05-10 12:44:48.336 GMT [74] LOG:  database system was shut down at 2023-05-10 12:44:48 GMT
2023-05-10 12:44:48.341 GMT [1] LOG:  database system is ready to accept connections
mildbyte commented 1 year ago

Weird, nothing suspicious here. Can you try initializing the engine manually by running

/root/.splitgraph/sgr --verbosity DEBUG init

and, if that doesn't work, paste the logs of the engine again, as well as the result of docker inspect splitgraph_engine_default?

MaraScott commented 1 year ago

/root/.splitgraph/sgr --verbosity DEBUG init gives

Initializing engine PostgresEngine LOCAL (sgr@localhost:6432/splitgraph)...
error: Error connecting to the engine (OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
error: ), sleeping 5.00s and retrying (1/12)...
error: Error connecting to the engine (OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
error: ), sleeping 5.00s and retrying (2/12)...
error: Error connecting to the engine (OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
error: ), sleeping 5.00s and retrying (3/12)...
error: Error connecting to the engine (OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
error: ), sleeping 5.00s and retrying (4/12)...
error: Error connecting to the engine (OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
error: ), sleeping 5.00s and retrying (5/12)...
error: Error connecting to the engine (OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
error: ), sleeping 5.00s and retrying (6/12)...
error: Error connecting to the engine (OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
error: ), sleeping 5.00s and retrying (7/12)...
error: Error connecting to the engine (OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
error: ), sleeping 5.00s and retrying (8/12)...
error: Error connecting to the engine (OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
error: ), sleeping 5.00s and retrying (9/12)...
error: Error connecting to the engine (OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
error: ), sleeping 5.00s and retrying (10/12)...
error: Error connecting to the engine (OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
error: ), sleeping 5.00s and retrying (11/12)...
error: Error connecting to the engine (OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
error: ), sleeping 5.00s and retrying (12/12)...
Error connecting to the engine after 12 retries
Traceback (most recent call last):
  File "splitgraph/engine/postgres/psycopg.py", line 650, in _admin_conn
  File "psycopg2/__init__.py", line 122, in connect
  File "psycopg2/extras.py", line 762, in wait_select
psycopg2.OperationalError: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

error: Traceback (most recent call last):
error:   File "splitgraph/commandline/__init__.py", line 128, in invoke
error:   File "click/core.py", line 1259, in invoke
error:   File "click/core.py", line 1066, in invoke
error:   File "click/core.py", line 610, in invoke
error:   File "splitgraph/commandline/misc.py", line 196, in init_c
error:   File "splitgraph/core/engine.py", line 55, in init_engine
error:   File "splitgraph/engine/postgres/psycopg.py", line 690, in initialize
error:   File "splitgraph/engine/postgres/psycopg.py", line 650, in _admin_conn
error:   File "psycopg2/__init__.py", line 122, in connect
error:   File "psycopg2/extras.py", line 762, in wait_select
error: psycopg2.OperationalError: server closed the connection unexpectedly
error:  This probably means the server terminated abnormally
error:  before or while processing the request.
error:

and this docker inspect splitgraph_engine_default gives

[
    {
        "Id": "0f1617a0823f2a3ff2aadf62974ea769a3fef489018bebb6cb2d1c91829bee19",
        "Created": "2023-05-10T14:03:44.703538745Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "postgres",
            "-c",
            "config_file=/etc/postgresql/postgresql.conf"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 17415,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2023-05-10T14:03:45.426604887Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:005f94f21e4657628ff7ce44ecc4da0baf6fe936e10199c3473f78761d38a4ee",
        "ResolvConfPath": "/var/lib/docker/containers/0f1617a0823f2a3ff2aadf62974ea769a3fef489018bebb6cb2d1c91829bee19/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/0f1617a0823f2a3ff2aadf62974ea769a3fef489018bebb6cb2d1c91829bee19/hostname",
        "HostsPath": "/var/lib/docker/containers/0f1617a0823f2a3ff2aadf62974ea769a3fef489018bebb6cb2d1c91829bee19/hosts",
        "LogPath": "/var/lib/docker/containers/0f1617a0823f2a3ff2aadf62974ea769a3fef489018bebb6cb2d1c91829bee19/0f1617a0823f2a3ff2aadf62974ea769a3fef489018bebb6cb2d1c91829bee19-json.log",
        "Name": "/splitgraph_engine_default",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "docker-default",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "5432/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "6432"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "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": 67108864,
            "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,
            "Mounts": [
                {
                    "Type": "volume",
                    "Source": "splitgraph_engine_default_data",
                    "Target": "/var/lib/splitgraph/objects"
                },
                {
                    "Type": "volume",
                    "Source": "splitgraph_engine_default_metadata",
                    "Target": "/var/lib/postgresql/data"
                }
            ],
            "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"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/c186e1eedeccf08d3cc7aa85441a01e54629733745a28aeb7eb7c78be5780141-init/diff:/var/lib/docker/overlay2/463a35f8add9170f6766306e3e49728477d9171a40053bb919853578aaa0c096/diff:/var/lib/docker/overlay2/104428419a593d73cc94d7fd2a3e35c123c887e96587f988793112147f53bb57/diff:/var/lib/docker/overlay2/7468b402246270c96816f291fb8cad12c5f3d14ce56367bf665193e2132296fc/diff:/var/lib/docker/overlay2/8ddcfe5e5b800627d588fe65c027d3294ef7a7cac3dd443c84d316b54dfdbb29/diff:/var/lib/docker/overlay2/b9f41dfd62dd815e6ac7641deb592f881b9d7611f4dae0afc25fbd3ab69f9d7f/diff:/var/lib/docker/overlay2/d5f238119bc8fc0729545e98514e8691a193f9c965c1fbcab78e7c83bd6e52fb/diff:/var/lib/docker/overlay2/080138b3df4e6330e999c1b4fb26900362ff0d6f06de9fd402c757226bc7bc1a/diff:/var/lib/docker/overlay2/a010d88a9d8ecb1d094e4d5fd418aace1f0eba89910c9c7f9742f7ff466e44fe/diff:/var/lib/docker/overlay2/79f1035fcdcfbbd52e651fff6d2650b27cd4f9e5e6c7bf199f8620e9640c82b3/diff:/var/lib/docker/overlay2/18689609c637c629d3ba0a2cd3ea3f151a2017283e14f6620829efeab3cf252d/diff:/var/lib/docker/overlay2/9c7cc6d5eeb613b2e3bbedab6ae4a64f87e6b87a7c9e391f0f4695daa9548151/diff:/var/lib/docker/overlay2/56e1350e9a8413bd1e4c7886854308531f99f0b2b08bf4f6418f540f3f068bec/diff:/var/lib/docker/overlay2/fb96cb41686387e6d2642e0e229a018a7fec92e1eb4161e985df831456cd3803/diff:/var/lib/docker/overlay2/89d7f16ad03ee7878668d99ea447711e4b6bee2027f58abc46afa132bc6546dd/diff:/var/lib/docker/overlay2/4c6a75db188be9c9f5366e994c240063e7bdd6f3ac1f76af123e928b47164878/diff:/var/lib/docker/overlay2/59082c254e6b7ec8cb00e7ad92d27cafe15ff8c688a17168d6ea6e49c6c0d051/diff:/var/lib/docker/overlay2/99d66bdf030420d3b2f1df2c22e0e961be4506dcad7c80f839fa23e7b13a9626/diff:/var/lib/docker/overlay2/6e58e5d624590d3e07c7563a05fc50b20840139376b1f7d2190f4f209d493d16/diff:/var/lib/docker/overlay2/2f4d99d0717015827211d99177c03d0023a76f4d05e6b69debd50286a4b78ae6/diff:/var/lib/docker/overlay2/5e63c6f01f38f497334aed8cca2be0b42121a22248e63a34dadbd1ad5eaa13d1/diff:/var/lib/docker/overlay2/2c54e17b4c8e6bbd50f79c89f6163d26e8f676609dfdba2101509e921558ee04/diff:/var/lib/docker/overlay2/935cfc4d66c1a4715f6afacca2fd198aa518d3beb9cb895c0f642f0a915e216f/diff:/var/lib/docker/overlay2/9ba2df6cb0ea187b22851a880c53f01054aa7a62f5e0ee4166b122c5e90d8fe8/diff:/var/lib/docker/overlay2/eb2740771fe64c861ff4e0fd3abb8700f400a8c3ad6b14e668be045258a65d5c/diff:/var/lib/docker/overlay2/2f4acb23a4be459b51593e51017a85339b3c841f3da9d9786efa6b056f9ca39e/diff:/var/lib/docker/overlay2/7dc10a2b6dc2f5bdfa0afc230018fb7b60417ca14e43338124ada387dd9f6c3b/diff:/var/lib/docker/overlay2/a461e99b3592b768b18b4e4f49c4873715c3163446d6098c5a9eeec6abb7baef/diff:/var/lib/docker/overlay2/fa637830a9db827f322c09c6d6afee37475ff42704b2e5210b4850642dab2028/diff:/var/lib/docker/overlay2/166b158b395aef456e5c2ee128291a0425be2c8ad43e7543c122bc28a67d22e0/diff:/var/lib/docker/overlay2/9a7601fed4733eff8c412ff1616c50387761791e48988f505441640121f32a46/diff:/var/lib/docker/overlay2/7aa8deeb27c266892656f92e9fa4de3227f4b07fc1318cf27ee197a56d974780/diff:/var/lib/docker/overlay2/e1850e7bb333e5ab75c94d22dca64b986152f5187fcdd0119c95f4a81fd9c864/diff:/var/lib/docker/overlay2/0312bb29eeec2e4d85681675f2674f2b1f54bfc3b02c6fd0a0d651669cf5e881/diff:/var/lib/docker/overlay2/70c894031f17a9629aff521058192e8757a8aaf3068d2b4d7464843cb8e9f117/diff:/var/lib/docker/overlay2/91bfb056976f22a8571c8d4c201696a962914090cfee5583d60d8ddb23cfea75/diff:/var/lib/docker/overlay2/8e38ea99f74dfc8d36d719973f7ecdf1f212afab9584307c8b3d02f944e84966/diff:/var/lib/docker/overlay2/bf7671d5e643123bf855e88ca44b56fe1e0047e0e815761f7d6423f232827384/diff:/var/lib/docker/overlay2/c3014c1db098ead064e49853dc179461e830d9f3e6adc507fa669422b1ac3fb9/diff",
                "MergedDir": "/var/lib/docker/overlay2/c186e1eedeccf08d3cc7aa85441a01e54629733745a28aeb7eb7c78be5780141/merged",
                "UpperDir": "/var/lib/docker/overlay2/c186e1eedeccf08d3cc7aa85441a01e54629733745a28aeb7eb7c78be5780141/diff",
                "WorkDir": "/var/lib/docker/overlay2/c186e1eedeccf08d3cc7aa85441a01e54629733745a28aeb7eb7c78be5780141/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "splitgraph_engine_default_data",
                "Source": "/var/lib/docker/volumes/splitgraph_engine_default_data/_data",
                "Destination": "/var/lib/splitgraph/objects",
                "Driver": "local",
                "Mode": "z",
                "RW": true,
                "Propagation": ""
            },
            {
                "Type": "volume",
                "Name": "splitgraph_engine_default_metadata",
                "Source": "/var/lib/docker/volumes/splitgraph_engine_default_metadata/_data",
                "Destination": "/var/lib/postgresql/data",
                "Driver": "local",
                "Mode": "z",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "0f1617a0823f",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "5432/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "POSTGRES_USER=sgr",
                "POSTGRES_PASSWORD=password",
                "POSTGRES_DB=splitgraph",
                "SG_CONFIG_FILE=/.sgconfig",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/12/bin:/splitgraph/bin",
                "GOSU_VERSION=1.12",
                "LANG=C.UTF-8",
                "PG_MAJOR=12",
                "PG_VERSION=12.3-1.pgdg100+1",
                "PGDATA=/var/lib/postgresql/data",
                "LC_ALL=C.UTF-8",
                "PYTHONPATH=:/splitgraph:/pg_es_fdw"
            ],
            "Cmd": [
                "postgres",
                "-c",
                "config_file=/etc/postgresql/postgresql.conf"
            ],
            "Image": "splitgraph/engine:0.3.12",
            "Volumes": {
                "/var/lib/postgresql/data": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "306d2aebf6d5918e1b8fe272333b575abc025f3bc3ca44cf95ecdf839e3f1ddd",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "5432/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "6432"
                    },
                    {
                        "HostIp": "::",
                        "HostPort": "6432"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/306d2aebf6d5",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "57fd9863ecf0010dd856982a0d3b2b22bac8e9b4d9dbcd085409ec54ba3402cf",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:02",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "6f19ee73981ee3ece70a050b09b732d040c42a2639853b20b41c3a4a5d79cf00",
                    "EndpointID": "57fd9863ecf0010dd856982a0d3b2b22bac8e9b4d9dbcd085409ec54ba3402cf",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02",
                    "DriverOpts": null
                }
            }
        }
    }
]
mildbyte commented 1 year ago

Thanks for all the logs! This is still a big mystery. It seems like the container starts successfully and the port gets correctly forwarded by Docker to your host:

            "Ports": {
                "5432/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "6432"
                    },

Is there anything strange about how you're running sgr? Are you running it on the host (which is the intended way) or inside of a Docker container as well (in which case it wouldn't be able to reach the engine without extra configuration)? Have you tried running it as an unprivileged user instead of root? Can you also paste the logs from the engine straight after sgr init fails (the logs you pasted originally don't show any connection attempts at all)?

MaraScott commented 1 year ago

Hi,

thanks for the follow up.

We use csf and this is causing some trouble

here the use case :

CSF DISABLED

if csf is disabled at the beginning of the process, running bash -c "$(curl -sL https://github.com/splitgraph/sgr/releases/latest/download/install.sh)" gives me that output

Installing the sgr binary from https://github.com/splitgraph/sgr/releases/download/v0.3.12/sgr-linux-x86_64 into /root/.splitgraph
sgr, version 0.3.12
sgr binary installed.

Setting up a Splitgraph engine.
The engine will be set up with default credentials:

username: sgr
password: password
port: 6432

These credentials are just for this local Postgres installation
and can be changed after install.

Pulling image splitgraph/engine:0.3.12...
Extracting:   0%|                                               | 0.00/1.00 [00:00<?, ?B/s]
Downloading:   0%|                                              | 0.00/1.00 [00:00<?, ?B/s]
Creating container splitgraph_engine_default.
Data volume: splitgraph_engine_default_data.
Metadata volume: splitgraph_engine_default_metadata.
error: docker.errors.APIError: 500 Server Error for http+docker://localhost/v1.42/containers/22f4fddfa3b92029168592d0cba6b9b708c47496632da629cde36049680fc10f/start: Internal Server Error ("driver failed programming external connectivity on endpoint splitgraph_engine_default (20584e5b413ff070f9df4a92d52c15050fdc12654df483601f3aef72253575bd):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 6432 -j DNAT --to-destination 172.17.0.2:5432 ! -i docker0: iptables: No chain/target/match by that name.
error:  (exit status 1))")
Fatal: Error setting up the engine. If an engine already exists, you can skip this step by setting $SKIP_ENGINE=1. In case of a port conflict, you can restart the installer with ENGINE_PORT set to some other port.

docker logs splitgraph_engine_default gives nothing & /root/.splitgraph/sgr --verbosity DEBUG init gives same as previous output

CSF ENABLED

if csf is enabled at the beginning of the process, running bash -c "$(curl -sL https://github.com/splitgraph/sgr/releases/latest/download/install.sh)" will gives same output as usual BUT

if csf is enabled at the beginning of the process, running bash -c "$(curl -sL https://github.com/splitgraph/sgr/releases/latest/download/install.sh)" the executing csf -x while sgr is attempting to connect gives me

Installing the sgr binary from https://github.com/splitgraph/sgr/releases/download/v0.3.12/sgr-linux-x86_64 into /root/.splitgraph
sgr, version 0.3.12
sgr binary installed.

Setting up a Splitgraph engine.
The engine will be set up with default credentials:

username: sgr
password: password
port: 6432

These credentials are just for this local Postgres installation
and can be changed after install.

Pulling image splitgraph/engine:0.3.12...
Extracting:   0%|                                               | 0.00/1.00 [00:00<?, ?B/s]
Downloading:   0%|                                              | 0.00/1.00 [00:00<?, ?B/s]
Creating container splitgraph_engine_default.
Data volume: splitgraph_engine_default_data.
Metadata volume: splitgraph_engine_default_metadata.
Container created, ID 939c90bc39
Initializing engine PostgresEngine default (sgr@localhost:6432/splitgraph)...
Waiting for connection.....

executing csf -x at this moment

Database splitgraph already exists, skipping
Ensuring the metadata schema at splitgraph_meta exists...
Schema splitgraph_meta already exists, version 0.0.4, installed on 2023-05-11 06:55:20.612098
Installing Splitgraph API functions...
Installing CStore management functions...
Skipping the audit trigger as it's already installed.
Engine initialized successfully.
Copying the config file at /root/.splitgraph/.sgconfig into all current engines
Config updated for container splitgraph_engine_default
Done.
Splitgraph Engine 0.3.12
Local repositories: 

Repository    Images    Tags    Size (T)    Size (A)    Checkout    Upstream
------------  --------  ------  ----------  ----------  ----------  ----------

Use sgr status REPOSITORY to get information about a given repository.
Use sgr show REPOSITORY:[HASH_OR_TAG] to get information about a given image.
Engine successfully set up.

You can now register on data.splitgraph.com (the registry).
This lets you push/pull datasets and use public data to build
your own datasets using Splitfiles.

If you do not wish to register now, you can do it later via
sgr cloud register or log in through sgr cloud login / GitHub OAuth.

Would you like to register now [y/N]? N

Installation complete!

sgr 0.3.12 has been installed to /root/.splitgraph/sgr.
Your configuration file is located at /root/.splitgraph/.sgconfig.
Make sure to add sgr to your $PATH, for example by doing:

    sudo ln -s /root/.splitgraph/sgr /usr/local/bin/sgr

Next steps: 

  Check out the example projects
    https://github.com/splitgraph/sgr/tree/v0.3.12/examples

  Try out the quickstart guide
    https://www.splitgraph.com/docs/getting-started/five_minute_demo

  Clone a dataset
    sgr clone splitgraph/domestic_us_flights

  Or inspect it without cloning it
    sgr table -r data.splitgraph.com splitgraph/domestic_us_flights:latest flights

  Build your own dataset using a Splitfile
    curl -sSL https://raw.githubusercontent.com/splitgraph/splitgraph/v0.3.12/examples/us-election/qoz_vote_fraction.splitfile \
     | sgr build - -o qoz_vote_fraction

Feedback is always welcome via GitHub issues (https://github.com/splitgraph/sgr/issues)
or email (support@splitgraph.com)!
MaraScott commented 1 year ago

To execute sgr command afterward I need csf to be disabled otherwise I can't connect

MaraScott commented 1 year ago

Hi, I finally found I need to modify csf to allow docker connection this way

# /etc/csf/csf.conf
# [...]
ETH_DEVICE_SKIP = "docker0"
# [...]

Thx for the help