Closed shahram7 closed 9 months ago
Hi. I actually made a web interface recently. No dockerfile yet, but it's easy (you can add it yourself). I will try to document the steps to run it soon.
I added Dockerfile.
Default port for web app is 8357.
But to enable the web app, you must edit config (~/.config/ayandict/config.toml
) and set web_enable
and web_expose
to true
:
https://github.com/ilius/ayandict/blob/main/doc/config.rst#web_enable
For docker, we may need to copy the config file or mount a volume for it.
I added docker-compose.yml. Check it out.
Hi Saeed, you rock! I've deployed ayandict right now
[+] Building 38.9s (9/9) FINISHED
=> [ayandict-web internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [ayandict-web internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 153B 0.0s
=> [ayandict-web internal] load metadata for docker.io/library/golang:1.21-bookworm 0.9s
=> [ayandict-web 1/4] FROM docker.io/library/golang:1.21-bookworm@sha256:a44d05d5de3474f8135462903bbf74a0fdb761aec455ff557c467339dc0b729b 0.0s
=> [ayandict-web internal] load build context 0.0s
=> => transferring context: 9.05kB 0.0s
=> CACHED [ayandict-web 2/4] WORKDIR /app 0.0s
=> CACHED [ayandict-web 3/4] COPY . /app 0.0s
=> [ayandict-web 4/4] RUN go build -tags nogui 32.8s
=> [ayandict-web] exporting to image 5.1s
=> => exporting layers 5.1s
=> => writing image sha256:8ca19539394d942ed3213a8a2e0d6921dad3d238508f25618c17af3af683ea5d 0.0s
=> => naming to docker.io/library/ayandict-ayandict-web 0.0s
[+] Running 2/2
✔ Network ayandict_default Created 0.1s
✔ Container ayandict-ayandict-web-1 Started
I've just changed the $HOME/.stardict/dic:/root/.stardict/dic:ro
to where my stardict dictionaries are stored also:
- /path/to/stardict:/root/.stardict/dicro
and now when I call the web app i see this page and I dont know how should I index my dictionaries.
best regards, Shahram
Great.
What do you by index them? If you want to see a list of dictionaries and enable, disable or change their order, these are not implemented in web. Only in Qt application.
But each dictionary has it's own index file, and they are loaded into RAM on startup.
If search result is empty, your directory must be wrong
- /path/to/stardict:/root/.stardict/dicro
Missed a :
near the end?
Look at file docker-config.toml, you can edit it.
Hi @ilius ,
If search result is empty, your directory must be wrong
- /path/to/stardict:/root/.stardict/dicro
Missed a
:
near the end?
No i have just mistyped it here. In docker compose file its correct.
Look at file docker-config.toml, you can edit it.
I have already done that too. Are Subfolders allowed?
docker-config:
web_enable = true
web_expose = true
local_server_ports = ["8357"]
directory_list = ["/mnt/nvme/other/glossaries/ayandict/"]
search_worker_count = 8
search_timeout = "5s"
docker-compose:
version: '3.8'
services:
ayandict-web:
build:
context: .
environment:
CONFIG_FILE: /app/config.toml
GOPROXY: https://goproxy.io,direct
volumes:
- $PWD/docker-config.toml:/app/config.toml:ro
- /mnt/nvme/other/glossaries/ayandict:/root/.stardict/dic:ro
ports:
- 8357:8357
and the path to my dictionaries looks like this:
root@vmDocker:/mnt/nvme/other/glossaries/ayandict# ll
total 565456
-rw-r--r-- 1 shahram shahram 42230945 Feb 11 2021 Aryanpur.dict
-rw-r--r-- 1 shahram shahram 5471544 Feb 11 2021 Aryanpur.idx
-rw-r--r-- 1 shahram shahram 157 Feb 11 2021 Aryanpur.ifo
-rw-r--r-- 1 shahram shahram 59681677 Aug 15 2018 De-De-Duden-Big-10.dict
-rw-r--r-- 1 shahram shahram 4013782 Aug 15 2018 De-De-Duden-Big-10.idx
-rw-r--r-- 1 shahram shahram 1184 Aug 15 2018 De-De-Duden-Big-10.ifo
-rw-r--r-- 1 shahram shahram 12602462 Aug 15 2018 deu-deu_Langenscheidt-e-Woerterbuch-DaF_2_0.dict
-rw-r--r-- 1 shahram shahram 596201 Aug 15 2018 deu-deu_Langenscheidt-e-Woerterbuch-DaF_2_0.idx
-rw-r--r-- 1 shahram shahram 4311 Aug 15 2018 deu-deu_Langenscheidt-e-Woerterbuch-DaF_2_0.idx.oft
-rw-r--r-- 1 shahram shahram 1001 Aug 15 2018 deu-deu_Langenscheidt-e-Woerterbuch-DaF_2_0.ifo
-rw-r--r-- 1 shahram shahram 6951 Aug 15 2018 'deu-deu_PONS_Grosswoerterbuch_DaF_and_1_0(2).idx.oft'
-rw-r--r-- 1 shahram shahram 4100491 Aug 15 2018 deu-deu_PONS_Grosswoerterbuch_DaF_and_1_0.dict.dz
-rw-r--r-- 1 shahram shahram 1045490 Aug 15 2018 deu-deu_PONS_Grosswoerterbuch_DaF_and_1_0.idx
-rw-r--r-- 1 shahram shahram 6943 Aug 15 2018 deu-deu_PONS_Grosswoerterbuch_DaF_and_1_0.idx.oft
-rw-r--r-- 1 shahram shahram 1507 Aug 15 2018 deu-deu_PONS_Grosswoerterbuch_DaF_and_1_0.ifo
-rw-r--r-- 1 shahram shahram 448114327 Feb 11 2021 oald9.dict
-rw-r--r-- 1 shahram shahram 1094679 Feb 11 2021 oald9.idx
-rw-r--r-- 1 shahram shahram 198 Feb 11 2021 oald9.ifo
and still:
Great.
What do you by index them? If you want to see a list of dictionaries and enable, disable or change their order, these are not implemented in web. Only in Qt application.
But each dictionary has it's own index file, and they are loaded into RAM on startup.
Silly me, I just deployed the Docker! I should also install the app, right?
No install. You can compile and run it.
No install. You can compile and run it.
doesn't it mean it's already complied when I see the Web ui?
I've seen in docker file that there is a line with go build with no gui tag.
For docker, it is compiled without GUI support, hence the -tags nogui
flags.
it means It should be compiled again?
Yes, just run go build
outside docker.
hi Saeed,
I have done go build
and now i get an error when i ./ayandict
I've checked the errors with my buddy, chatgpt, and each he's told me to install this package and ./ayandict
again.
I've installed following packages but i still get this error
packages:
apt install libfontconfig1
apt install libxcb-glx0
apt install libx11-xcb1
apt install libxrender1
apt install libxkbcommon0
apt install libpulse0
an the last error message is:
root@vmDocker:/home/shahram/ayandict# ./ayandict
looking for qtbox in: /home/shahram/ayandict/qtbox
final qtbox location: /home/shahram/ayandict/qtbox
/home/shahram/ayandict/qtbox: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory
panic: interface conversion: interface {} is nil, not *core.QCoreApplication
goroutine 1 [running, locked to thread]:
github.com/ilius/qt/core.QCoreApplication_Instance(...)
/root/go/pkg/mod/github.com/ilius/qt@v0.0.0-20230422004322-c855bcf0151b/core/core.go:8455
github.com/ilius/qt/widgets.NewQApplication(0xc000179ee8?, {0x501d69?, 0x29c2580?, 0xc000012648?})
/root/go/pkg/mod/github.com/ilius/qt@v0.0.0-20230422004322-c855bcf0151b/widgets/widgets.go:4922 +0xd8
github.com/ilius/ayandict/v2/pkg/application.Run()
/home/shahram/ayandict/pkg/application/app.go:48 +0x2f
main.main()
/home/shahram/ayandict/main_gui.go:40 +0xb2
Try installing libgl1
and run it.
Hi Saeed, Salam, Have you ever thought about creating a web application out of ayandict? in order to be able to deploy it and use it as a self-hosted application? I have found a project for MDICT files (django-mdict), but the user interface is completely in Chinese. Best Regards, Shahram