Closed kavemang closed 1 year ago
This is my docker compose which works for me.
version: "3"
services:
meilisearch:
image: getmeili/meilisearch
environment:
- MEILI_MASTER_KEY=$MEILI_MASTER_KEY
- MEILI_ENV=production
restart: unless-stopped
ports:
- 7700:7700
volumes:
- ba-meilidata:/meili_data
# Redis for session and file cache
redis2:
image: redis
environment:
- ALLOW_EMPTY_PASSWORD=yes
restart: unless-stopped
bar-assistant:
image: kmikus12/bar-assistant-server
depends_on:
- meilisearch
environment:
- APP_URL=$API_URL
- MEILISEARCH_KEY=$MEILI_MASTER_KEY
- MEILISEARCH_HOST=$MEILI_HOST
- REDIS_HOST=redis2
restart: unless-stopped
volumes:
- ba-storage:/var/www/cocktails/storage
ports:
- 8000:80
salt-rim:
image: kmikus12/salt-rim
depends_on:
- meilisearch
- bar-assistant
environment:
- API_URL=$API_URL
ports:
- 8083:8080
volumes:
ba-meilidata:
driver: local
driver_opts:
type: none
o: bind
device: /mnt/user/appdata/meilisearch
ba-storage:
driver: local
driver_opts:
type: none
o: bind
device: /mnt/user/appdata/ba-storage
Depending on the docker/compose version localhost may not work. Specify the container name and use that instead.
compose
services:
# Setup Meilisearch instance
meilisearch:
container_name: meilisearch
image: getmeili/meilisearch:v0.29
.env
API_URL=http://bar-assistant:8000
MEILI_HOST=http://meilisearch:7700
@zhdenny using your compose and premade volumes I got everything seeming to be connected with container names
no particular errors on any of the containers and I can see the server is connected to meilisearch, but when I try to log in on salt I still get "failed to fetch"
also unlike the api server which connected to meili after using the container name, salt reports "failed to connect" on the login page before trying to login
Bar Assistant server:
http://bar_assistant2-bar-assistant-1:8000
Status: Not available
You need to have access to your BA instance from your browser. So when you are finished setting up your container you should be able to visit your BA and meilisearch instance.
For the given example of https://github.com/bar-assistant/docker , if you visit localhost:8000
you should see your BA instance, and if you visit localhost:7700
you should see your meilisearch instance.
I've got a similar issue. I can hit the BA instance from the browser but it returns a 500 Internal Server Error from the console.
Can you check your container logs when you try to login
$ docker compose logs bar-assistant
Here is the full log after hitting the BA instance endpoint.
[Sun Jan 29 10:09:53.981674 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
Application .env file not found, creating a new .env file...
INFO Application key set successfully.
INFO The [public/storage] link has been connected to [storage/app/public].
INFO The [public/uploads] link has been connected to [storage/uploads].
Database already exists, running migrations...
INFO Nothing to migrate.
Updating search index settings...
Syncing cocktails and ingredients to meilisearch...
Adding routes and config to cache...
INFO Configuration cached successfully.
INFO Routes cached successfully.
Application ready!
localhost:80 192.168.86.8 - - [29/Jan/2023:12:32:12 -0600] "GET / HTTP/1.1" 500 211 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/110.0"
localhost:80 192.168.86.8 - - [29/Jan/2023:12:32:13 -0600] "GET /favicon.ico HTTP/1.1" 200 296 "http://192.168.86.4:8888/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/110.0"
It shows that I have hit the backend but nothing of note to my eye and I just get a blank white page.
It is worth noting that I have installed this on Unraid but in this case I'm not sure that would cause issue. It still is just running the container.
I'm on Unraid as well. Not sure why yours is not working. For what it's worth....all the URLs in my .env file are local URLs (192.168.1.111:7700 and 192.168.1.111:8000). That IP is the local IP of my Unraid server.
Your APP_URL env does it have a protocol in it? Or just local IP and port?
Do you have an unraid template?
To add to this, i see the same issue as james in my non unraid setup
As well i tried using LAN ips during my attempts
You must use Docker Compose, not the standard Unraid docker method...so there won't be any Unraid Template. I use the Unraid docker compose plugin in order to install apps which require compose
I'm on vacation but when I get back in a week I'll try to fire up a second instance of this whole thing from scratch just to make sure. Maybe it works for me just cuz I've had this setup from the beginning months ago. Dunno.
This is my docker compose which works for me.
version: "3" services: meilisearch: image: getmeili/meilisearch environment: - MEILI_MASTER_KEY=$MEILI_MASTER_KEY - MEILI_ENV=production restart: unless-stopped ports: - 7700:7700 volumes: - ba-meilidata:/meili_data # Redis for session and file cache redis2: image: redis environment: - ALLOW_EMPTY_PASSWORD=yes restart: unless-stopped bar-assistant: image: kmikus12/bar-assistant-server depends_on: - meilisearch environment: - APP_URL=$API_URL - MEILISEARCH_KEY=$MEILI_MASTER_KEY - MEILISEARCH_HOST=$MEILI_HOST - REDIS_HOST=redis2 restart: unless-stopped volumes: - ba-storage:/var/www/cocktails/storage ports: - 8000:80 salt-rim: image: kmikus12/salt-rim depends_on: - meilisearch - bar-assistant environment: - API_URL=$API_URL ports: - 8083:8080 volumes: ba-meilidata: driver: local driver_opts: type: none o: bind device: /mnt/user/appdata/meilisearch ba-storage: driver: local driver_opts: type: none o: bind device: /mnt/user/appdata/ba-storage
Running into similar issues. Running on ubuntu and using docker compose. Also tried the above mentioned docker-compose without succes.
Tried different methods (http://localhost:8000, http://192.168.1.161:8000, http://bar-assistant:800) without succes both in the docker-compose and in the .env. All containers seem to be up weirdly enough.
So at a loss of getting this going which i would love to!
Any tips are welcome :)
Can you post your docker compose file and .env variables.
Also you can check docker logs for errors.
Sure!
Docker compose:
# Setup Meilisearch instance
meilisearch:
image: getmeili/meilisearch:v0.29
container_name: bar_meilisearch
environment:
- MEILI_MASTER_KEY=$MEILI_MASTER_KEY
- MEILI_ENV=production
restart: unless-stopped
ports:
- 7700:7700
volumes:
- /home/wouter/docker/GLOBAL/barassistant/meili:/meili_data
# Redis for session and file cache
redis:
image: redis
container_name: bar_redis
environment:
- ALLOW_EMPTY_PASSWORD=yes
restart: unless-stopped
# Bar Assistant API
bar-assistant:
image: kmikus12/bar-assistant-server
container_name: bar_assistant
depends_on:
- meilisearch
- redis
environment:
- APP_URL=$API_URL
- MEILISEARCH_KEY=$MEILI_MASTER_KEY
- MEILISEARCH_HOST=$MEILI_HOST
- REDIS_HOST=redis
restart: unless-stopped
volumes:
- /home/wouter/docker/GLOBAL/barassistant/barassistant:/var/www/cocktails/storage
ports:
- 8000:80
# Bar Assistant Client
salt-rim:
image: kmikus12/salt-rim
container_name: bar_salt
depends_on:
- meilisearch
- bar-assistant
environment:
- API_URL=$API_URL
restart: unless-stopped
ports:
- 8090:8080
The .env is below. Thing i would like to add: I used it in my larger docker-compose for most of my services but also tried it separatly. Left the name of the file as .env but also added the variables of the .env manually in the docker-compose to verify (without change in results)
`API_URL=http://localhost:8000 MEILI_HOST=http://localhost:7700 MEILI_MASTER_KEY=X
Then regarding the bar assistant when i visit the webpage i get: "This is your Bar Assistant instance. Checkout /docs to see documentation." Logs:
Application .env file not found, creating a new .env file...
INFO Application key set successfully.
INFO The [public/storage] link has been connected to [storage/app/public].
INFO The [public/uploads] link has been connected to [storage/uploads].
Database not found, creating a new database...
touch: cannot touch '/var/www/cocktails/storage/database.sqlite': Permission denied
Updating search index settings...
In StreamHandler.php line 216:
There is no existing directory at "/var/www/cocktails/storage/logs" and it
could not be created: Permission denied
Adding routes and config to cache...
INFO Configuration cached successfully.
INFO Routes cached successfully.
Application ready!
[Tue Jan 31 09:01:18.069286 2023] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.14 configured -- resuming normal operations
[Tue Jan 31 09:01:18.069322 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
localhost:80 192.168.1.103 - - [31/Jan/2023:09:03:58 +0000] "GET / HTTP/1.1" 200 1336 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
localhost:80 192.168.1.103 - - [31/Jan/2023:09:03:58 +0000] "GET /favicon.ico HTTP/1.1" 304 246 "http://192.168.1.161:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
localhost:80 192.168.1.103 - - [31/Jan/2023:09:04:50 +0000] "-" 408 0 "-" "-"
With regars to meilisearch: "{"status":"Meilisearch is running"}" Logs:
Database path: "./data.ms"
Server listening on: "http://0.0.0.0:7700"
Environment: "production"
Commit SHA: "unknown"
Commit date: "unknown"
Package version: "0.29.3"
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: "2a6cd597-ab98-4b53-9a58-62ac1c09c714"
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-01-31T09:01:15Z INFO actix_server::builder] Starting 8 workers
[2023-01-31T09:01:15Z INFO actix_server::server] Actix runtime found; starting in Actix runtime
[2023-01-31T09:04:21Z INFO actix_web::middleware::logger] 192.168.1.103 "GET / HTTP/1.1" 200 35 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36" 0.001435
[2023-01-31T09:04:21Z INFO actix_web::middleware::logger] 192.168.1.103 "GET /favicon.ico HTTP/1.1" 404 0 "http://192.168.1.161:7700/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36" 0.000061
Oke; I think i narrowed down the issue to the following:
Problem seems to exist in the bar-assistant instance. In my docker-compose it seems to get the variables from the .env file. However it says two things i cant seem to resolve:
1) Application .env file not found, creating a new .env file... 2) Database not found, creating a new database... touch: cannot touch '/var/www/cocktails/storage/database.sqlite': Permission denied
When i check the folder i assigned as a volume; It shows a folder for meilisearch as expected but NOTHING for the barassistant container.
I guess if it CAN write the problem is resolved. Dont know why it doesnt write tough...
EDIT: Adding: PUID and PGID as environment didnt work either.
EDIT2: Changing the docker-compose to specify the ba-assistant: volume at the end and use the line "- ba-storage:/var/www/cocktails/storage" from the initial example docker-compose the second point seems to be gone.
Logs: `Application .env file not found, creating a new .env file...
INFO Application key set successfully.
INFO The [public/storage] link has been connected to [storage/app/public].
INFO The [public/uploads] link has been connected to [storage/uploads].
Database already exists, running migrations...
INFO Nothing to migrate.
Updating search index settings... Syncing cocktails and ingredients to meilisearch... Adding routes and config to cache...
INFO Configuration cached successfully.
INFO Routes cached successfully.
Application ready! [Tue Jan 31 10:45:44.883376 2023] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.14 configured -- resuming normal operations [Tue Jan 31 10:45:44.883477 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'`
Interestingly it seems to fix it though. I can login now. Although it still says:
Bar Assistant server: http://192.168.1.161:8000 Status: Not available
I can make cocktails though..
I did not realize that you must use docker compose
. That may not work for me at the moment but that is good information to know.
@wouterverduin @karlomikus @JamesTeague
In case this helps at all, I continue to have the exact same issues you guys are describing but I've already tried using an .env file and also tried (alternatively) plugging everything possible in manually with no .env file at all
I did not mean to close this at all ^ that button is way to easy to accidentally hit lol
@kavemang have you tried with docker-compose? I'm just curious.
Typically, chained containers like docker compose. That's what I used to get it working on Unraid.
Application .env file not found, creating a new .env file...
are related to BA .env file inside the container, it creates a new one if it doesn't exist, and that file is not persisted. That's not the issue.- /home/wouter/docker/GLOBAL/barassistant/meili:/meili_data
wont work.Hope that helps
@karlomikus @JamesTeague @kavemang
I think i got it sorted with karlomikus hints. The problem is in the docker volume mount pmerissions problem he linked. I finally got it working; Seeing other cocktails. Can addingredients so it looks like a go!
For references what i finally used to get it up:
first make a .env file:
API_URL=http://192.168.1.161:8000
MEILI_HOST=http://192.168.1.161:7700
MEILI_MASTER_KEY=something`
Then my docker-compose:
version: "3"
services:
# Setup Meilisearch instance
meilisearch:
image: getmeili/meilisearch:v0.29
container_name: bar_meili
environment:
- MEILI_MASTER_KEY=$MEILI_MASTER_KEY
- MEILI_ENV=production
restart: unless-stopped
ports:
- 7700:7700
volumes:
- bar-meilidata:/meili_data
# Redis for session and file cache
redis:
image: redis
container_name: bar_redis
environment:
- ALLOW_EMPTY_PASSWORD=yes
restart: unless-stopped
# Bar Assistant API. Bestanden in : /home/wouter/docker/bar/files
bar-assistant:
image: kmikus12/bar-assistant-server
container_name: bar_assistant
depends_on:
- meilisearch
- redis
environment:
- APP_URL=$API_URL
- MEILISEARCH_KEY=$MEILI_MASTER_KEY
- MEILISEARCH_HOST=$MEILI_HOST
- REDIS_HOST=redis
restart: unless-stopped
volumes:
- bar-storage:/var/www/cocktails/storage
ports:
- 8000:80
# Bar Assistant Client
salt-rim:
image: kmikus12/salt-rim
container_name: bar_salt
depends_on:
- meilisearch
- bar-assistant
environment:
- API_URL=$API_URL
restart: unless-stopped
ports:
- 8090:8080
volumes:
bar-storage:
bar-meilidata:`
I'm still getting 500 errors when hitting the API even when using docker compose following the documentation. I am not sure where that is coming from or what is happening. It is not showing up in the logs at all.
Edit: I am not even trying to use the client yet. Just trying to hit the backend. Regardless of the stack or running standalone with Meilisearch that has not worked for me.
Edit 2: The env file just doesn't look like it is right. It doesn't seem like it is pickup up the variables being passed in. Here is a cat output of the .env from the container.
APP_NAME="Bar Assistant API"
APP_ENV=production
APP_KEY=base64:7sMavB/1U54cE0hBeSJXxqrk75/JiNeSC4hUEZ2mzz8=
APP_DEBUG=false
APP_URL=
DB_CONNECTION=sqlite
BROADCAST_DRIVER=log
CACHE_DRIVER=redis
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=redis
SESSION_LIFETIME=120
RESPONSE_CACHE_ENABLED=false
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
SCOUT_DRIVER=meilisearch
MEILISEARCH_HOST=
MEILISEARCH_KEY=
SANCTUM_STATEFUL_DOMAINS=
This looks like you didn't setup .env correctly when making the container. Try stopping and removing the container and running it again. Or post your docker-compose.yml and .env you are using
docker-compose.yml
version: "3"
services:
# Setup Meilisearch instance
meilisearch:
image: getmeili/meilisearch:v0.29
environment:
- MEILI_MASTER_KEY=$MEILI_MASTER_KEY
- MEILI_ENV=production
restart: unless-stopped
ports:
- 7700:7700
volumes:
- ba-meilidata:/meili_data
# Bar Assistant API
bar-assistant:
image: kmikus12/bar-assistant-server
depends_on:
- meilisearch
environment:
- APP_URL=$API_URL
- MEILISEARCH_KEY=$MEILI_MASTER_KEY
- MEILISEARCH_HOST=$MEILI_HOST
- REDIS_HOST=$REDIS_HOST
restart: unless-stopped
volumes:
- ba-storage:/var/www/cocktails/storage
ports:
- 8888:80
# Bar Assistant Client
salt-rim:
image: kmikus12/salt-rim
depends_on:
- meilisearch
- bar-assistant
environment:
- API_URL=$API_URL
restart: unless-stopped
ports:
- 8980:8080
volumes:
ba-meilidata:
ba-storage:
.env
API_URL=http://192.168.86.4:8888
MEILI_HOST=http://192.168.86.4:7700
MEILI_MASTER_KEY=someMasterKeyForNow
REDIS_HOST=http://192.168.86.4:6379
That looks like it should work. Are you sure the BA can access that redis server? I don't think you can define redis host with port like that. You can add the following to your compose file for BA env variables if needed.
REDIS_HOST=http://192.168.86.4
REDIS_PASSWORD=null
REDIS_PORT=6379
I am not sure that it has access, although it should. It is all on the same machine. I did define the variables as you have stated though in the compose file directly. However, I am still seeing the same issue when hitting the BA. Is there anything else you can think of that I might need to investigate?
You could also check logs inside the container in /storage/logs/laravel.log
.
These are the logs from laravel.log at start up. I will try to look into these files to see what it is trying to tell me but unfortunately I do not know PHP.
#42 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#43 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#44 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#45 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#46 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#47 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(165): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#48 /var/www/cocktails/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(134): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#49 /var/www/cocktails/public/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#50 {main}
"}
There is some kind of error but this is only the part of it. Try using more lines:
tail -n 200 /var/www/cocktails/storage/logs/laravel.log
Oh good call! Found the problem. It could not connect to Redis. Got that fixed up and now I am up an running.
https://github.com/bar-assistant/docker
when spinning up the example compose the first issue is that the api server cannot see meilisearch
started making some modifications and experimenting here: https://github.com/karlomikus/bar-assistant/issues/60#issuecomment-1407478273