karlomikus / bar-assistant

Bar assistant is a all-in-one solution for managing your home bar

Home Page:https://barassistant.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blank page after install

sgtsilver opened this issue · comments

Describe the bug
After running the Docker Containers like it is mentioned in the Documentation it starts all the containers but the page just stays blank (or Gray)

Versions:

  • Docker: Docker version 24.0.0, build 98fdcd7
  • Browser: Chrome, Firefox

docker-compose.yml

version: "3"

services:
  meilisearch:
    image: getmeili/meilisearch:v1.0 #


    environment:
      - MEILI_MASTER_KEY=$MEILI_MASTER_KEY
      - MEILI_ENV=production
    restart: unless-stopped
    volumes:
      - meilisearch_data:/meili_data

  redis:
    image: redis
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
    restart: unless-stopped

  bar-assistant:
    image: barassistant/server:latest
    depends_on:
      - meilisearch
      - redis
    environment:
      - APP_URL=$API_URL
      - LOG_CHANNEL=stderr #


      - MEILISEARCH_KEY=$MEILI_MASTER_KEY
      - MEILISEARCH_HOST=http://melisearch:7700 #


      - REDIS_HOST=redis #


      - ALLOW_REGISTRATION=true
    restart: unless-stopped
    volumes:
      - bar_data:/var/www/cocktails/storage/bar-assistant

  salt-rim:
    image: barassistant/salt-rim:latest
    depends_on:
      - bar-assistant
    environment:
      - API_URL=$API_URL
      - MEILISEARCH_URL=$MEILISEARCH_URL
      - BAR_NAME=$BAR_NAME
      - DESCRIPTION=$BAR_DESCRIPTION
      - DEFAULT_LOCALE="en-US"
    restart: unless-stopped

  webserver:
    image: nginx:alpine
    restart: unless-stopped
    ports:
      - 3000:3000 #


    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf #



volumes:
  bar_data:
  meilisearch_data:

the .env file

# Your Meilisearch master key
    # Find out more here: https://docs.meilisearch.com/learn/getting_started/quick_start.html#securing-meilisearch
    MEILI_MASTER_KEY=Keymumbojumbo
    
    # Base URL of the application
    # You should update this value to the one you are using (ex: http://192.168.100.100, https://my-personal-bar.com)
    # In this case it's the URL and port that is exposed in webserver service
    # The value MUST be without trailing slash
    BASE_URL=https://url:3000
    
    # Meilisearch server instance URL, change if you are using different host from base url, otherwise leave as default
    MEILISEARCH_URL=${BASE_URL}/search
    
    # Bar Assistant server instance URL, change if you are using different host from base url, otherwise leave as default
    API_URL=${BASE_URL}/bar
    
    # (Optional) Bar name
    BAR_NAME=
    
    # (Optional) Short bar description
    BAR_DESCRIPTION=

The nginx.conf

`      server {
    listen 3000 default_server;
    listen [::]:3000 default_server;
    server_name _;

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    client_max_body_size 100M;

    location /bar/ {
        proxy_pass http://bar-assistant:3000/;
    }

    location /search/ {
        proxy_pass http://melisearch:7700/;
    }

    location / {
        proxy_pass http://salt-rim:8080/;
    }
}

Logs of barassistant:

my-bar-data-bar-assistant-1  |
my-bar-data-bar-assistant-1  | In Client.php line 170:
my-bar-data-bar-assistant-1  |
my-bar-data-bar-assistant-1  |   Could not resolve host: melisearch for "http://melisearch:7700/indexes/cock
my-bar-data-bar-assistant-1  |   tails/settings".
my-bar-data-bar-assistant-1  |
my-bar-data-bar-assistant-1  |
my-bar-data-bar-assistant-1  | In Psr18Client.php line 135:
my-bar-data-bar-assistant-1  |
my-bar-data-bar-assistant-1  |   Could not resolve host: melisearch for "http://melisearch:7700/indexes/cock
my-bar-data-bar-assistant-1  |   tails/settings".
my-bar-data-bar-assistant-1  |
my-bar-data-bar-assistant-1  |
my-bar-data-bar-assistant-1  | In ErrorChunk.php line 56:
my-bar-data-bar-assistant-1  |
my-bar-data-bar-assistant-1  |   Could not resolve host: melisearch for "http://melisearch:7700/indexes/cock
my-bar-data-bar-assistant-1  |   tails/settings".
my-bar-data-bar-assistant-1  |
my-bar-data-bar-assistant-1  |
my-bar-data-bar-assistant-1  | In CurlResponse.php line 326:
my-bar-data-bar-assistant-1  |
my-bar-data-bar-assistant-1  |   Could not resolve host: melisearch for "http://melisearch:7700/indexes/cock
my-bar-data-bar-assistant-1  |   tails/settings".
my-bar-data-bar-assistant-1  |
my-bar-data-bar-assistant-1  |

and logs of salt-rim

WARN[0000] The "o6g" variable is not set. Defaulting to a blank string.
WARN[0000] The "o6g" variable is not set. Defaulting to a blank string.
WARN[0000] The "o6g" variable is not set. Defaulting to a blank string.`

Hello.

Can you post your Meilisearch container logs?

Hello.

Can you post your Meilisearch container logs?

Sure, here they are

Config file path:	"none"

Database path:		"./data.ms"

Server listening on:	"http://0.0.0.0:7700"

Environment:		"production"

Commit SHA:		"572608c121d960cdf48c2c289a6dfd3dc834873a"

Commit date:		"2023-02-23T13:52:56+00:00"

Package version:	"1.0.2"

Thank you for using Meilisearch!

We collect anonymized analytics to improve our product and your experience. To learn more, including how to turn off analytics, visit our dedicated documentation page: https://docs.meilisearch.com/learn/what_is_meilisearch/telemetry.html

Anonymous telemetry:	"Enabled"

Instance UID:		"2727d761-15ff-47f9-951b-63fca9638f03"

A master key has been set. Requests to Meilisearch won't be authorized unless you provide an authentication key.

Documentation:		https://docs.meilisearch.com

Source code:		https://github.com/meilisearch/meilisearch

Contact:		https://docs.meilisearch.com/resources/contact.html

[2023-05-20T10:03:03Z INFO  actix_server::builder] Starting 2 workers

[2023-05-20T10:03:03Z INFO  actix_server::server] Actix runtime found; starting in Actix runtime

Might've found something on the webserver:

/docker-entrypoint.sh: Configuration complete; ready for start up

2023/05/20 10:25:36 [emerg] 1#1: host not found in upstream "bar-assistant" in /etc/nginx/conf.d/default.conf:12

nginx: [emerg] host not found in upstream "bar-assistant" in /etc/nginx/conf.d/default.conf:12

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration

/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/

/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh

10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf

10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version

/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh

/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh

/docker-entrypoint.sh: Configuration complete; ready for start up

Seems like it's an issue with DEFAULT_LOCALE env parsing, try removing quotes in default locale variable. I'll update the docs in the mean time.

- DEFAULT_LOCALE=en-US

And then restart everything.

docker compose restart

Did that, didn't help. Still a blank page.
Edit: Did a full repull - took 2 minutes now the login shows up, give me a minute to test. Will edit this comment.

Edit 2: Okay login shows up but Says that http://IP:3000/bar is not available

edit 3: I bundled them all into a dedicated network on docker and the only container that dosen't get an IP is the bar-assist one. A bit of progress but not really huge progress. 😄

So what is you setup currently look like (.env, nginx and compose file)?

The .env file

# Your Meilisearch master key
# Find out more here: https://docs.meilisearch.com/learn/getting_started/quick_start.html#securing-meilisearch
MEILI_MASTER_KEY=keymumbojumbo

# Base URL of the application
# You should update this value to the one you are using (ex: http://192.168.100.100, https://my-personal-bar.com)
# In this case it's the URL and port that is exposed in webserver service
# The value MUST be without trailing slash
BASE_URL=http://serverip:3000

# Meilisearch server instance URL, change if you are using different host from base url, otherwise leave as default
MEILISEARCH_URL=${BASE_URL}/search

# Bar Assistant server instance URL, change if you are using different host from base url, otherwise leave as default
API_URL=${BASE_URL}/bar

# (Optional) Bar name
BAR_NAME=Name

# (Optional) Short bar description
BAR_DESCRIPTION=Description

the docker-compose.yml

version: "3"

services:
  meilisearch:
    image: getmeili/meilisearch:v1.0 #


    environment:
      - MEILI_MASTER_KEY=$MEILI_MASTER_KEY
      - MEILI_ENV=production
    restart: unless-stopped
    networks:
      - barassistant
    volumes:
      - meilisearch_data:/meili_data

  redis:
    image: redis
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
    restart: unless-stopped
    networks:
      - barassistant

  bar-assistant:
    image: barassistant/server:latest
    depends_on:
      - meilisearch
      - redis
    environment:
      - APP_URL=$API_URL
      - LOG_CHANNEL=stderr #
      - MEILISEARCH_KEY=$MEILI_MASTER_KEY
      - MEILISEARCH_HOST=http://melisearch:7700 #
      - REDIS_HOST=redis #
      - ALLOW_REGISTRATION=true
    restart: unless-stopped
    volumes:
      - bar_data:/var/www/cocktails/storage/bar-assistant
    networks:
      - barassistant


  salt-rim:
    image: barassistant/salt-rim:latest
    depends_on:
      - bar-assistant
    environment:
      - API_URL=$API_URL
      - MEILISEARCH_URL=$MEILISEARCH_URL
      - BAR_NAME=$BAR_NAME
      - DESCRIPTION=$BAR_DESCRIPTION
      - DEFAULT_LOCALE=en-US
    networks:
      - barassistant
    restart: unless-stopped

  webserver:
    image: nginx:alpine
    restart: unless-stopped
    ports:
      - 3000:3000 #
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf #
    networks:
      - barassistant

networks:
  barassistant:

volumes:
  bar_data:
  meilisearch_data:

and finally the nginx.conf

server {
    listen 3000 default_server;
    listen [::]:3000 default_server;
    server_name _;

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    client_max_body_size 100M;

    location /bar/ {
        proxy_pass http://bar-assistant:3000/;
    }

    location /search/ {
        proxy_pass http://meilisearch:7700/;
    }

    location / {
        proxy_pass http://salt-rim:8080/;
    }
}

As you can see, nothing super fancy.

This all looks fine so it should work, when you open check bar-assistant container logs do you see the message: "Application ready".
Also you can try to curl the bar assistant api endpoint to see it's status:

$ curl https://your-url.com/bar/api/

Should return something like: {"status":"available"}

It returned:

<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.23.4</center>
</body>
</html>

also it seems that the barassitant container restarts every minute


e19802ee5829   barassistant/salt-rim:latest      "/docker-entrypoint.…"   10 hours ago   Up 10 hours                     80/tcp, 8080/tcp
                                      my-bar-data-salt-rim-1
93f37790bf3f   barassistant/server:latest        "entrypoint /bin/bas…"   10 hours ago   Restarting (1) 45 seconds ago
                                      my-bar-data-bar-assistant-1
fb73295d4f6d   getmeili/meilisearch:v1.0         "tini -- /bin/sh -c …"   10 hours ago   Up 10 hours                     7700/tcp
                                      my-bar-data-meilisearch-1
b2f6abdb6d6b   nginx:alpine                      "/docker-entrypoint.…"   10 hours ago   Up 10 hours                     80/tcp, 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp
                                      my-bar-data-webserver-1
3af563224060   redis                             "docker-entrypoint.s…"   10 hours ago   Up 10 hours                     6379/tcp
                                      my-bar-data-redis-1

[previous exception] [object] (Symfony\\Component\\HttpClient\\Exception\\TransportException(code: 0): Could not resolve host: melisearch for \"http://melisearch:7700/health\". at /var/www/cocktails/vendor/symfony/http-client/Response/CurlResponse.php:326)
�      
[stacktrace]
#0 /var/www/cocktails/vendor/symfony/http-client/Response/TransportResponseTrait.php(167): Symfony\\Component\\HttpClient\\Response\\CurlResponse::perform()
#1 /var/www/cocktails/vendor/symfony/http-client/Response/CommonResponseTrait.php(140): Symfony\\Component\\HttpClient\\Response\\CurlResponse::stream()
#2 /var/www/cocktails/vendor/symfony/http-client/Response/TransportResponseTrait.php(52): Symfony\\Component\\HttpClient\\Response\\CurlResponse::initialize()
#3 /var/www/cocktails/vendor/symfony/http-client/Psr18Client.php(110): Symfony\\Component\\HttpClient\\Response\\CurlResponse->getStatusCode()
#4 /var/www/cocktails/vendor/meilisearch/meilisearch-php/src/Http/Client.php(168): Symfony\\Component\\HttpClient\\Psr18Client->sendRequest()
#5 /var/www/cocktails/vendor/meilisearch/meilisearch-php/src/Http/Client.php(74): Meilisearch\\Http\\Client->execute()
#6 /var/www/cocktails/vendor/meilisearch/meilisearch-php/src/Contracts/Endpoint.php(21): Meilisearch\\Http\\Client->get()
#7 /var/www/cocktails/vendor/meilisearch/meilisearch-php/src/Endpoints/Delegates/HandlesSystem.php(11): Meilisearch\\Contracts\\Endpoint->show()
#8 /var/www/cocktails/vendor/laravel/scout/src/Engines/MeiliSearchEngine.php(413): Meilisearch\\Client->health()
#9 /var/www/cocktails/app/SearchActions.php(50): Laravel\\Scout\\Engines\\MeiliSearchEngine->__call()
#10 /var/www/cocktails/app/Console/Commands/BarOpen.php(55): Kami\\Cocktail\\SearchActions::checkHealth()
#11 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Kami\\Cocktail\\Console\\Commands\\BarOpen->handle()
#12 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#13 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#14 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#15 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#16 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Console/Command.php(194): Illuminate\\Container\\Container->call()
#17 /var/www/cocktails/vendor/symfony/console/Command/Command.php(312): Illuminate\\Console\\Command->execute()
#18 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Console/Command.php(163): Symfony\\Component\\Console\\Command\\Command->run()
#19 /var/www/cocktails/vendor/symfony/console/Application.php(1040): Illuminate\\Console\\Command->run()
#20 /var/www/cocktails/vendor/symfony/console/Application.php(314): Symfony\\Component\\Console\\Application->doRunCommand()
#21 /var/www/cocktails/vendor/symfony/console/Application.php(168): Symfony\\Component\\Console\\Application->doRun()
#22 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(200): Symfony\\Component\\Console\\Application->run()
#23 /var/www/cocktails/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#24 {main}
"} 
In Client.php line 170:
                                                                           
  Could not resolve host: melisearch for "http://melisearch:7700/health".  
                                                                           
In Psr18Client.php line 135:
                                                                           
  Could not resolve host: melisearch for "http://melisearch:7700/health".  
                                                                           
In ErrorChunk.php line 56:
                                                                           
  Could not resolve host: melisearch for "http://melisearch:7700/health".  
                                                                           
In CurlResponse.php line 326:
                                                                           
  Could not resolve host: melisearch for "http://melisearch:7700/health".  

found the problem:
the bar assistant container trys to access a container named "melisearch" - but there is none

so I did the following in the docker-compose.yml

services:
  meilisearch:
    hostname: melisearch

and it instantly worked.

Weird, it should work like that without the need to define hostname, since that is how networking in compose works.

But I'm glad you got it working