Closed zeekaran closed 5 days ago
I believe I have somewhat properly set up everything (redis meili salt barass) minus the webserver/nginx part, as both bar assistant and salt rim have a UI. Bar assistant's URL gives me "This is your Bar Assistant instance. Checkout /docs to see documentation." and salt rim gives me a login screen. But, no register button, nor a login button, and BA's url/bar says not available from salt rim's login page. /search gives an api error with resource not found, though at both the local:7700 and my meili.\<domain>.com show "Meilisearch is running".
Also if I run docker compose exec bar-assistant php artisan bar:open
, I get:
Command "bar:open" is not defined.
.env:
MEILI_MASTER_KEY=secretpassword
BASE_URL=http://bar.<domain>.com
MEILISEARCH_URL=${BASE_URL}/search
API_URL=${BASE_URL}/bar
docker-compose.yml:
---
version: "3.1"
services:
meilisearch:
image: getmeili/meilisearch:v1.7
container_name: meili
environment:
- MEILI_MASTER_KEY=$MEILI_MASTER_KEY
- MEILI_ENV=production
restart: unless-stopped
volumes:
- /junk/docker-bar/data/meilisearch:/meili_data
ports:
- 7700:7700
redis:
image: redis
container_name: redis
environment:
- ALLOW_EMPTY_PASSWORD=yes
restart: unless-stopped
bar-assistant:
image: barassistant/server:v3
container_name: barassistant
depends_on:
- meilisearch
- redis
environment:
- APP_URL=$API_URL
- LOG_CHANNEL=stderr
- MEILISEARCH_KEY=$MEILI_MASTER_KEY
- MEILISEARCH_HOST=http://meilisearch:7700
- REDIS_HOST=redis
- ALLOW_REGISTRATION=true
ports:
- 3003:3000
restart: unless-stopped
volumes:
- /junk/docker-bar/data/bar-assistant:/var/www/cocktails/storage/bar-assistant
salt-rim:
image: barassistant/salt-rim:v2
container_name: saltrim
depends_on:
- bar-assistant
environment:
- API_URL=$API_URL
- MEILISEARCH_URL=$MEILISEARCH_URL
- BAR_NAME=Bar
- DESCRIPTION=Alsobar
- DEFAULT_LOCALE=en-US
restart: unless-stopped
ports:
- 3004:8080
BA logs end with:
[ENTRYPOINT] Application ready [ENTRYPOINT] Starting PHP-FPM and nginx [06-Jul-2024 06:02:29] NOTICE: fpm is running, pid 51 [06-Jul-2024 06:02:29] NOTICE: ready to handle connections
Hello
Meilisearch and Redis can't be removed, if they could be removed they would not be in docker compose.
Here's a simplified diagram how current compose works
flowchart LR
REQUEST[request] --> NGINX[nginx]
API[api] <-->|via container network| REDIS[redis]
API <-->|via container network| SEARCH[meilisearch]
NGINX -->|/| CLIENT[Salt Rim]
NGINX -->|/api| API
NGINX -->|/search| SEARCH
Browser client (SaltRim in this case) needs public access to Meilisearch endpoints and API endpoints to work correctly. This is handled by nginx. Nginx configures [url]/
, [url]/search
and [url]/api
endpoints that are used in salt-rim container via env variables.
If you have your nginx already running, then you need to configure proxies for Meilisearch and Bar Assistant containers, and define them in salt rim via environment variables.
For example, if you have configuration like the following:
search.example.com
-> proxy to container meilisearch:7700
bar-api.example.com
-> proxy to container bar-assistant:3000
Then you need to update your salt-rim container like so: salt-rim:
image: barassistant/salt-rim:v2
depends_on:
- bar-assistant
environment:
- API_URL=api.example.com
- MEILISEARCH_URL=search.example.com
- BAR_NAME=$BAR_NAME
- DESCRIPTION=$BAR_DESCRIPTION
- DEFAULT_LOCALE=en-US
restart: unless-stopped
The command docker compose exec bar-assistant php artisan bar:open
is old and unused since v3.
I'm just another user but I have an example setup on my GitHub.
Everything in the docker compose file is absolutely necessary. Including the webserver. It doesn't matter if you are already running a webserver container. This setup needs it's own webserver container like it has in the compose. Many people I know have tried to fold/merge their current webserver container configuration into this, it just makes things more complicated. Don't do it. Plus, it really isn't that big a deal anyway, these things are all relatively small containers/files with minimal overhead to run. Adjust host side ports as necessary if you have conflicts.
Also the nginx.conf file is necessary to. And adjust paths as necessary in the docker compose for your needs...just remember to reference the nginx.conf file and place it in the right spot.
The Readme on my GitHub is just instructions on how to import my revamped/customized database, if you want it. Not necessary.
Browser client (SaltRim in this case) needs public access to Meilisearch endpoints and API endpoints to work correctly. This is handled by nginx. Nginx configures
[url]/
,[url]/search
and[url]/api
endpoints that are used in salt-rim container via env variables.If you have your nginx already running, then you need to configure proxies for Meilisearch and Bar Assistant containers, and define them in salt rim via environment variables.
For example, if you have configuration like the following:
* `search.example.com` -> proxy to container `meilisearch:7700` * `bar-api.example.com` -> proxy to container `bar-assistant:3000` Then you need to update your salt-rim container like so:
salt-rim: image: barassistant/salt-rim:v2 depends_on: - bar-assistant environment: - API_URL=api.example.com - MEILISEARCH_URL=search.example.com - BAR_NAME=$BAR_NAME - DESCRIPTION=$BAR_DESCRIPTION - DEFAULT_LOCALE=en-US restart: unless-stopped
I re-read the above multiple times, but I'm not understanding. I've never messed with NPM's custom locations before. I think my only issues are in Nginx and not my compose yaml or envs. What I have, which I know is not entirely correct, is below. I think either some of this doesn't matter, or is just wrong:
Details: bar.example.com http 192.168.1.12 3003
meili.example.com http 192.168.1.12 7700
saltrim.example.com http 192.168.1.12 3004
Screenshot (actual domain name changed for example):
(all three URLs work, but of course they are not connected together properly because no sub folder forwarding has been setup)
What I need to do is set something on the "Custom locations" window, but I don't know what to set for each of barassistant, saltrim, and meilisearch.
And then once those are set correctly, if anything needs to change in compose:
salt-rim:
environment:
- API_URL=$API_URL #http://bar.example.com/bar
- MEILISEARCH_URL=$MEILISEARCH_URL #http://bar.example.com/search
If you have every service proxied with subdomain then you don't need to setup custom locations.
For your example:
Details: bar.example.com http 192.168.1.12 3003
meili.example.com http 192.168.1.12 7700
saltrim.example.com http 192.168.1.12 3004
You need to update env with the following
salt-rim:
environment:
- API_URL=http://bar.example.com
- MEILISEARCH_URL=http://meili.example.com
@karlomikus So simple! That did it, it's now up and running.
(Please let me know if I should open a separate issue for this:) When I make a public link, such as http://saltrim.guntz.top/e/cocktail/01J24CVXCD5G7RGSEHV9E9KC46/monkey-man-1, it loads a broken recipe and gives me an error:
Only issue so far. Imports default recipes, imports recipes by URL, other basic things seem to be working.
Can you press F12 and check for any errors in the console and network tab?
I have a feeling this is maybe an issue with CORS
I'm getting this:
But the link works on my phone, and on another person's phone. But not my computer in any browser, nor the server that is hosting this.
UPDATE: It's working now. I changed absolutely nothing.
I understand what bar assistant is, and what salt rim is. I do not understand what meilisearch or redis are for. Also, I have nginx running without docker compose and do not know how to make all this work given I plan on not including the webserver nginx portion of the example compose file.
Lastly, I think adding vars to env is unnecessarily messy compared to just setting the URLs and meili key directly in the compose yaml; I am currently hosting eight sites all set up in docker compose and managed by nginx and not a single one has the URL set via docker compose! All docker compose knows is ports, and nginx handles forwarding those ports to \.\.com.
creating vars for the env seems unnecessary and complicated, the ports should be forwarded to URLs through nginx and not variables in yamlEDIT: Apparently .env files are not global, making # 3 above much less relevant
EDIT2: I apologize for turning this issue into a tech support forum, but at least I got answers for 1 and 2!