Skip to content

Commit d00b33d

Browse files
committed
Preserve search indexes from v5.0.2 in a volume
How to test: - Run the dev stack: $ make start - Copy songs in the /music volume. Sync them: $ make sync-music - Remove the dev stack containers: $ docker-compose -f docker-compose.dev.yml down - Recreate the dev stack $ make start - In the web UI, search for a song, album or artist. You should find some results. Before this commit, you would not find results, as the search indexes would be reset.
1 parent 7bc90dc commit d00b33d

File tree

6 files changed

+35
-9
lines changed

6 files changed

+35
-9
lines changed

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ RUN a2enmod rewrite
7575
# Copy the downloaded release
7676
COPY --from=release-downloader --chown=www-data:www-data /tmp/koel /var/www/html
7777

78-
# Music volume
79-
# This needs to be AFTER creating the folders and setting their permissions
78+
# Volumes for the music files and search index
79+
# This declaration must be AFTER creating the folders and setting their permissions
8080
# and AFTER changing to non-root user.
8181
# Otherwise, they are owned by root and the user cannot write to them.
82-
VOLUME ["/music"]
82+
VOLUME ["/music", "/var/www/html/storage/search-indexes"]
8383

8484
ENV FFMPEG_PATH=/usr/bin/ffmpeg \
8585
MEDIA_PATH=/music \

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all help start setup
1+
.PHONY: all help start
22

33
all: help
44

@@ -8,7 +8,7 @@ build-docker-image: ## Builds the production x86_64 Docker image
88
build-all-arch-docker-images: ## Builds the production Docker image for all supported processor architectures
99
docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64 . --file Dockerfile --tag hyzual/koel-dev:latest
1010

11-
setup: ## Init the DEV docker-compose stack
11+
koel-init: ## Create the APP_KEY for the DEV docker-compose stack
1212
docker exec -it koeldev php artisan koel:init
1313

1414
sync-music: ## Sync music from the /music volume with the database

README.md

+16-2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ docker run -d --name koel \
8181
--network=koel-net \
8282
-v music:/music \
8383
-v covers:/var/www/html/public/img/covers \
84+
-v search_index:/var/www/html/storage/search-indexes \
8485
hyzual/koel
8586
```
8687

@@ -140,6 +141,16 @@ Whenever the music in `/music` changes, you will need to manually scan it before
140141
docker exec koel php artisan koel:sync
141142
```
142143

144+
### Populate the search indexes
145+
146+
If you were running a version of Koel prior to v5.0.2, the search mechanism has changed and needs a step to index songs, albums and artists. Run the following command:
147+
148+
```bash
149+
docker exec koel php artisan koel:search:import
150+
```
151+
152+
For all new songs, the search index will be automatically populated by `php artisan koel:sync`. No need to run the `php artisan koel:search:import` again :).
153+
143154
## Useful environment variables
144155

145156
See [`.env.example`][koel-env-example] for reference.
@@ -158,8 +169,11 @@ See [`.env.example`][koel-env-example] for reference.
158169

159170
### /music
160171

161-
`/music` will contain the music library. Keep in mind that koel needs to
162-
scan music before it's able to play it.
172+
`/music` will contain the music library. Keep in mind that koel needs to scan music before it's able to play it.
173+
174+
### /var/www/html/storage/search-indexes
175+
176+
`/var/www/html/storage/search-indexes` will contain the search indexes. Searching songs, albums and artists leverages this to provide results.
163177

164178
## Ports
165179

docker-compose.dev.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3.7'
1+
version: '3'
22

33
services:
44
koel:
@@ -19,6 +19,7 @@ services:
1919
volumes:
2020
- music:/music
2121
- covers:/var/www/html/public/img/covers
22+
- search_index:/var/www/html/storage/search-indexes
2223
- ./.env.koel:/var/www/html/.env
2324

2425
database:
@@ -35,3 +36,4 @@ volumes:
3536
db:
3637
music:
3738
covers:
39+
search_index:

docker-compose.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3.7'
1+
version: '3'
22

33
services:
44
koel:
@@ -16,6 +16,7 @@ services:
1616
volumes:
1717
- music:/music
1818
- covers:/var/www/html/public/img/covers
19+
- search_index:/var/www/html/storage/search-indexes
1920

2021
database:
2122
image: mysql/mysql-server:5.7
@@ -34,3 +35,5 @@ volumes:
3435
driver: local
3536
covers:
3637
driver: local
38+
search_index:
39+
driver: local

goss.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ file:
107107
group: www-data
108108
filetype: directory
109109
contains: []
110+
/var/www/html/storage/search-indexes:
111+
exists: true
112+
mode: "0755"
113+
owner: www-data
114+
group: www-data
115+
filetype: directory
116+
contains: []
110117
/var/www/html/tests:
111118
exists: false
112119
contains: []

0 commit comments

Comments
 (0)