What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Trying to connect to the docker postgres db ```❯ docker/sdk console --version --> DEVELOPMENT M

U01JBB8LNTE
U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet

Trying to connect to the docker postgres db

❯ docker/sdk console --version
-->  DEVELOPMENT MODE
Store: DE | Environment: docker.dev
Spryker 1

[1612223285034] INFO (ls): Connection instance created for spryker-db.
ns: "conn-manager"
[1612223285063] ERROR (ls): Connecting error: {"code":-32001,"data":{"driver":"PostgreSQL","driverOptions":{}},"name":"error"}
ns: "conn-manager"
[1612223285064] ERROR (ext): ERROR: Error opening connection role "spryker" does not exist, {"code":-32001,"data":{"driver":"PostgreSQL","driverOptions":{}}}
ns: "error-handler"
[1612223286760] INFO (ext): Connection explorer changed. Will be updated.
ns: "conn-man:explorer"
```

zed and yves are working, but I'd like to connect to the database so i can verify writing a record.

using a postgres client
with these creds

Host: localhost Port: 5432 Database: eu-docker User: spryker Password: secret

Comments

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Please check if you can connect from the cli using psql: psql -U spryker -d eu-docker -h localhost.

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    ❯ docker/sdk cli psql -U spryker -d eu-docker -h localhost
    -->  DEVELOPMENT MODE
    psql: error: could not connect to server: could not connect to server: Connection refused
        Is the server running on host "localhost" (127.0.0.1) and accepting
        TCP/IP connections on port 5432?
    could not connect to server: Address not available
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?
    

    with docker/sdk ^

    using psql locally ->

    ❯ psql -U spryker -d eu-docker -h localhost
    psql: error: FATAL:  role "spryker" does not exist
    
  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice
    edited February 2021
  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    version: "0.1"
    
    namespace: spryker_b2c_dev
    tag: 'dev'
    
    environment: docker.dev
    image:
        tag: spryker/php:7.3-alpine3.12
        php:
            enabled-extensions:
                - blackfire
    composer:
        mode: ''
        autoload: ''
    assets:
        mode: development
    
    regions:
        EU:
            services:
                database:
                    database: eu-docker
                    username: spryker <<<<< 
                    password: secret
    
            stores:
                DE:
                    services:
                        broker:
                            namespace: de-docker
                        key_value_store:
                            namespace: 1
                        search:
                            namespace: de_search
                AT:
                    services:
                        broker:
                            namespace: at-docker
                        key_value_store:
                            namespace: 2
                        search:
                            namespace: at_search
        US:
            services:
                database:
                    database: us-docker
                    username: spryker
                    password: secret
            stores:
                US:
                    services:
                        broker:
                            namespace: us-docker
                        key_value_store:
                            namespace: 3
                        search:
                            namespace: us_search
    groups:
        EU:
            region: EU
            applications:
                yves_eu:
                    application: yves
                    endpoints:
                        yves.de.spryker.local:
                            store: DE
                            services:
                                session:
                                    namespace: 1
                        yves.at.spryker.local:
                            store: AT
                            services:
                                session:
                                    namespace: 2
                glue_eu:
                    application: glue
                    endpoints:
                        glue.de.spryker.local:
                            store: DE
                        glue.at.spryker.local:
                            store: AT
                zed_eu:
                    application: zed
                    endpoints:
                        zed.de.spryker.local:
                            store: DE
                            services:
                                session:
                                    namespace: 3
                        zed.at.spryker.local:
                            store: AT
                            services:
                                session:
                                    namespace: 4
        US:
            region: US
            applications:
                yves_us:
                    application: yves
                    endpoints:
                        yves.us.spryker.local:
                            store: US
                            services:
                                session:
                                    namespace: 5
                glue_us:
                    application: glue
                    endpoints:
                        glue.us.spryker.local:
                            store: US
                zed_us:
                    application: zed
                    endpoints:
                        zed.us.spryker.local:
                            store: US
                            services:
                                session:
                                    namespace: 6
    services:
        database:
            engine: postgres
            root:
                username: "root"
                password: "secret"
            endpoints:
                localhost:5432:
                    protocol: tcp
        broker:
            engine: rabbitmq
            api:
                username: "spryker"
                password: "secret"
            endpoints:
                queue.spryker.local:
                localhost:5672:
                    protocol: tcp
        session:
            engine: redis
        key_value_store:
            engine: redis
            endpoints:
                localhost:16379:
                    protocol: tcp
        search:
            engine: elastic
            version: 6.8
            endpoints:
                localhost:9200:
                    protocol: tcp
        scheduler:
            engine: jenkins
            endpoints:
                scheduler.spryker.local:
        mail_catcher:
            engine: mailhog
            endpoints:
                mail.spryker.local:
        swagger:
            engine: swagger-ui
            endpoints:
                swagger.spryker.local:
        redis-gui:
            engine: redis-commander
            endpoints:
                redis-commander.spryker.local:
        dashboard:
            engine: dashboard
            endpoints:
                spryker.local:
    
    docker:
    
        ssl:
            enabled: false
            redirect: true
    
        testing:
            store: DE
    
        debug:
            enabled: true
            xdebug:
                enabled: true
    
        mount:
            native:
                platforms:
                    - linux
    
            docker-sync:
                platforms:
                    - macos
                    - windows
    
  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet

    ah but maybe the namespace is wrong?

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet

    nope looks the same

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    And the application works correctly? First docker/sdk up went completely without any problems?

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet

    ye

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet

    docker/sdk up -x end of ^

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Let me check if I can connect to DB using debug mode.

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Without any problems even in debug mode.

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    So sorry, I have no idea how is it possible. ¯_(ツ)_/¯

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet

    okee dokee 🤣

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    I would recommend to run docker/sdk reset and it will re-create volumes and others... with new import, with new install etc.

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
     2648  rm -rf b2c-demo-shop
     2649  mkdir spryker-b2c && cd spryker-b2c
     2650  ls
     2651  git clone <https://github.com/spryker-shop/b2c-demo-shop.git> ./
     2652  git clone git@github.com:spryker/docker-sdk.git docker\n
     2653  ls
     2654  docker/sdk boot deploy.dev.yml
     2655  docker/sdk up
     2656  psql -U spryker -d eu-docker -h localhost
    
    
      psql: error: FATAL:  role "spryker" does not exist
    
    
     2657  docker/sdk reset
     2658  psql -U spryker -d eu-docker -h localhost
    
    
      psql: error: FATAL:  role "spryker" does not exist
    
    
    

    gonna try switching to mutagen

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    What you've done doesn't recreate volumes, etc.
    If you are deleting the code, please prune everything.
    docker system prune -a && docker system prune --volumes.

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    It should have been created during install process.

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
     2670  docker system prune -a && docker system prune --volumes
     2671  docker/sdk boot deploy.dev.yml
     2672  docker/sdk up
     2674  psql -U spryker -d eu-docker -h localhost
    
    
      psql: error: FATAL:  role "spryker" does not exist
    
    
    

    Should I open an issue here?
    And is creating a user locally a possible workaround for now?

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    There is no issue in spryker, it's something wrong for you locally. Maybe @ULYHPR789 will help tomorrow.

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    @U01JBB8LNTE try to connect inside docker/sdk cli

    docker/sdk cli psql -U spryker -d eu-docker -h database

    And what about root user? Does it work?

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    ❯  docker/sdk cli psql -U spryker -d eu-docker -h database
    -->  DEVELOPMENT MODE
    Password for user spryker:
    psql (12.5, server 9.6.20)
    Type "help" for help.
    
    eu-docker=>
    
  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Does it mean there is another postgres running locally?

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    ❯ brew services
    Name       Status  User   Plist
    emacs      stopped
    mysql      started edward /Users/edward/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    php        stopped
    postgresql started edward /Users/edward/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
    unbound    stopped
    
  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet

    ❯ which psql /usr/local/bin/psql

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet

    do I need to stop the brew service?

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Yes, I would say.

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet

    Dope 🙏 thanks y'all

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    ❯ brew services stop postgresql
    Stopping `postgresql`... (might take a while)
    ==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
    ❯ psql -U spryker -d eu-docker -h localhost
    Password for user spryker:
    psql (13.1, server 9.6.20)
    Type "help" for help.
    
    eu-docker=>
    
  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Coolio.