Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notes and Issues running in a Docker container #3

Open
tenken opened this issue Jul 7, 2019 · 2 comments
Open

Notes and Issues running in a Docker container #3

tenken opened this issue Jul 7, 2019 · 2 comments

Comments

@tenken
Copy link

tenken commented Jul 7, 2019

Greetings --

Thanks for this great application. I'm not chess guru but I recenty found your repo in the last week or two when looking for a way to run a personal chess database on Linux. I am a web developer at UCSB so I went about attempting to run the application locally via a Docker container. At first I wasn't certain if this was a browser extension/plugin or if it was some sort of Electron based app; I primarily do PHP related work. But in any event eventually I deduced this was nodejs running via webkit -- and eventually looked into pre-existing Dockerfiles that would allow me to run the application via VNC ... and eventually I settled on running the application in a container while allowing my local Xserver to render the application.

In order to do so one would simply do something like:

xhost +local:root
sudo docker-compose up [-d]  # from directory with custom built Dockerfile for this app with docker-compose.yml as well.

The reason I went through the above looks is that while it's great you've attempted to self-contain running this application if the host OS has the necessary dependencies installed -- I've screwed up too many systems via python Virtual Environments or similar package management managed applications to faithfully rely on them or clutter my system this lots of applications dependencies I may only use sparingly -- so I've slowly started Dockerizing applications I find useful and simply mounting the application directory and data directories onto the Host OS someplace for permanency.

Issues

When running the app via Docker if you right click on a notation of a game loaded from the database the default ContextMenu for node-webkit displays and not any app-specific right-click menu as the readme describes. I had to un-comment the line that was preventing the default behavior:

// IN window.js
	// Hooks for the "contextmenu" event
	notationContainer.addEventListener('contextmenu', function(ev) {
	    // Prevent to showing default context menu event
	    ev.preventDefault();
	    // display Popup the native context menu at place you clicked
	    menu.popup(ev.x, ev.y)  
	})

With preventDefault() supressing the default NW context menu -- then the app specific context menu works, but oddly without themeing applied as in the README (I really dont care if it at least works, i'm sure Linux is in the minority in users :D ):

Screenshot from 2019-07-06 21-16-43

(For linux) the default Stockfish engine does not work out the box. The console outputs from uciWorker.js log output as (some added by me locally for testing):

ChessFriend-Fire | platform is: linux
ChessFriend-Fire | exec path is: /root/nwjsapp/src/bin/stockfish_10_x64
ChessFriend-Fire | Spawned engine pid: undefined

After the above debugging I downloaded the Git repo directly and inspected /src/bin directory:

/tmp/app $ git clone https://github.com/SFBrand1981/ChessFriend-Fire.git .
Cloning into '.'...
remote: Enumerating objects: 44, done.
remote: Counting objects: 100% (44/44), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 725 (delta 23), reused 19 (delta 10), pack-reused 681
Receiving objects: 100% (725/725), 12.22 MiB | 8.95 MiB/s, done.
Resolving deltas: 100% (399/399), done.
/tmp/app ⑂master $ ls
ChessFriend-Fire.bat     LICENSE            README.md
docs                     package.json       src
KingBaseLite2019-04.pgn  package-lock.json  tests
/tmp/app ⑂master $ cd src/bin/
/tmp/app/src/bin ⑂master $ ls -lah
total 2.7M
drwxr-xr-x 2 webdev webdev 4.0K Jul  6 20:48 .
drwxr-xr-x 9 webdev webdev 4.0K Jul  6 20:48 ..
-rwxr-xr-x 1 webdev webdev 350K Jul  6 20:48 stockfish-10-64
-rw-r--r-- 1 webdev webdev 1.3M Jul  6 20:48 stockfish_10_x64
-rwxr-xr-x 1 webdev webdev 1.2M Jul  6 20:48 stockfish_10_x64.exe

The Stockfish exectuable for Linux does not have the permission bit set so it will not successfully run as-is. By simply chmod a+x stockfish_10_x64 from within the Container then the Engine output appears in the app as expected. I suggest you update the permissions as needed in your next release.

Again I'm basically a chess novice but my own personal wishlist for an application such as this would inlcude:

  • the ability to clone an existing database game and rename the cloned game -- largely solely to include annotations not originally provided (basically to annotate my own games, while leaving the raw PGN file untouched as well).
  • integrate something like https://github.com/jbkunst/chessboardjs-themes to allow more custom board themes.
  • The ability to have arrows and stuff shown for piece moves from possible engine lines. Again largely for self taught exploration and study.
  • make import routine faster ?! I bought Chessbase13 off of Steam the other day and was eventually gonna convert the ~2 million games database into PGN format and import those ... the 10 minutes for 7,000 games of the demo content makes me think that would take .... weeks.

I'm terribly busy over the summer, but if there's any of the above items I start to look into I will let you know.

Thanks again, if requested I could share the Dockerfile + docker-compose file if you'd like but it's more for my personal use and I've not considered it of sufficient quality to release to the public.

@appletomato
Copy link
Collaborator

Hi, thank you for your comments! During the last week, I have worked on a new release which includes the following improvements:

  • Ability to clone an existing game
  • Ability to annotate games by drawing arrows and coloring squares
  • Faster import using the tool pgn-extract, which I have discovered only recently
  • The Stockfish engine has the executable-permission bit set on Linux

The new release will be uploaded as soon as possible. I would also like to include your Dockerfile in the new release if it helps other people to use the program.

@appletomato
Copy link
Collaborator

In the latest release, a new option "Import ChessFriend-Fire database" has been added to the app. By storing the FEN of the current board position in the comments of the pgn, the duration for parsing one game has been reduced by a factor of ten. On my laptop, I can now import more than 1 Million games in little more than one hour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants