Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/.git
/.devcontainer
/.vscode
/configs/*.override.y*ml
/var
/web/html

Expand All @@ -13,3 +14,4 @@

.DS_Store
*.log
*.override.yml
7 changes: 0 additions & 7 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@ GOSUMDB=off
GOOS=linux
GOARCH=amd64

# docker composer
DC_TARGETOS=linux
DC_TARGETARCH=amd64
DC_APP_IMG=fb2lib:local
DC_SERVER_PORT=8080

# app
BS_SERVER_PORT=8080
BS_SERVER_DEBUG=true
BS_LOGS_DEBUG=true
BS_LOGS_PRETTY=true
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/bin
/configs/*.override.y*ml
/fb2c-*.zip
/var
/.env
/docker-compose.override.yml
.DS_Store
*.log
*.log
*.override.yml
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"mode": "debug",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/cmd/indexer",
"args": ["-rewrite", "-hidebar"]
"args": ["-reset", "-hidebar"]
}
]
}
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ ENV GOOS=$TARGETOS
ENV GOARCH=$TARGETARCH
ENV GOPROXY https://proxy.golang.org,direct
ENV GOSUMDB off
RUN apk add -q tzdata make unzip
RUN apk add -q tzdata make unzip curl ca-certificates
WORKDIR /src
COPY . .
RUN make build BUILD_VERSION=$BUILD_VERSION
RUN mv bin/${GOOS}-${GOARCH} binaries
RUN mv bin/${GOOS}-${GOARCH} binaries && cp $(which curl) binaries
RUN mkdir tmp_dir

FROM scratch
WORKDIR /
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=build /src/tmp_dir /tmp
COPY --from=build /src/binaries bin
COPY configs configs
COPY web web
VOLUME ["/var/index"]
# HEALTHCHECK --interval=30s --timeout=4s CMD curl -f http://localhost:8080/live || exit 1 @TODO:
EXPOSE 8080
ENTRYPOINT ["server"]
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
This is a server for indexing and searching fb2-books at zip archives.

### Quick start:
1. Put your archives with books into ```library``` folder
1. Put your archives with books into ```books``` folder

2. Create index:
```bash
docker run --rm -t --entrypoint=indexer \
-v $(pwd)/index:/var/index \
-v $(pwd)/logs:/var/logs \
-v $(pwd)/library:/var/library \
egnd/fb2lib -workers=4 -batchsize=300
-v $(pwd)/books:/var/libs/default:ro \
-v $(pwd)/index:/var/index/default:rw \
-v $(pwd)/storage:/var/storage:rw \
-v $(pwd)/logs:/var/logs:rw \
egnd/fb2lib
```

3. Create ```docker-compose.yml```:
Expand All @@ -26,19 +27,20 @@ services:
app:
image: egnd/fb2lib
ports:
- 8080:8080
- 80:8080
volumes:
- ./cfg.yml:/configs/app.override.yml:ro
- ./libs/default:/var/libs/default:ro
- ./index:/var/index:rw
- ./library:/var/library:rw
- ./storage:/var/storage:rw
```

4. Run server with:
```bash
docker-compose up
```

5. Server is available at http://localhost:8080
5. Server is available at http://localhost

### Hints:
* Advanced query language - https://blevesearch.com/docs/Query-String-Query/
* Server is able to convert fb2 to epub "on-the-fly"
Loading