The idea is to interface with newCARTA through an Electron App where the CARTA c++ and CARTA Meteor client are running from a Docker container on the user's machine.
Test versions to try:
http://alma.asiaa.sinica.edu.tw/_downloads/newCARTAv3.dmg
http://alma.asiaa.sinica.edu.tw/_downloads/CARTA-Desktop-linux-v3.tar.gz
curl -fsSL https://get.docker.com/ | sh
(Need to enter root password).sudo systemctl start docker
sudo systemctl enable docker
for docker to start automatically on boot.sudo usermod -a -G docker $USER
so the normal user has permission to run docker.- Log out and in, or reboot system, to enable Step 4.
docker pull ajmasiaa/newcarta_meteor_v3
to download the docker image.xhost +
to allow x11 to work in the docker container (sudo setenforce 0
may also be necessary)
rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
to install EPEL repositories.yum -y install docker-io
service docker start && chkconfig docker on
groupadd docker
usermod -aG docker $USER
- Log out and in, or reboot.
- Install Docker from the dmg: https://download.docker.com/mac/stable/Docker.dmg
docker pull ajmasiaa/newcarta_meteor_v3
The docker image can be run directly for testing. The docker image itself is based on Ubuntu. The included start.sh
script simply executes the CARTA c++ and then starts the Meteor client. Once it is running, the user can open localhost:3000 in their webrowser.
Tested on CentOS7, Ubuntu 17.04, Fedora 24
xhost +
docker run -p 3000:3000 -p 9999:9999 -e DISPLAY=$DISPLAY -ti -v /tmp/.X11-unix:/tmp/.X11-unix ajmasiaa/newcarta_meteor_v3 /start.sh
- Open any web browser and go to the URL
localhost:3000
xhost +
docker run -p 3000:3000 -p 9999:9999 -e DISPLAY=docker.for.mac.host.internal:0 -ti -v /tmp/.X11-unix:/tmp/.X11-unix ajmasiaa/newcarta_meteor_v3 /start.sh
- Open any web browser and go to the URL
localhost:3000
A requirement for CARTA is to be a standalone desktop application. This can be achieved with newCARTA using Electron. Electron is effectively a very basic Chrome browser window which displays newCARTA running locally (localhost:3000) on the user's machine.
- Install Meteor on your system
curl https://install.meteor.com/ | sh
git clone https://github.com/CARTAvis/newCARTADesktop.git
cd newCARTADesktop
meteor npm install
meteor npm start
Note: On CentOS7 and Fedora (and probably RedHat), libXScrnSaver must be installed; sudo yum install libXScrnSaver
For Mac, an installable DMG is created (non-signed for now). For Linux, a directory is created that can be zipped later. The Linux version can be created on a Mac, plus the Linux version is universal between RedHat and Ubuntu based systems.
-
Install the electron-packager tool:
meteor npm install electron-packager -g
-
Create Mac App:
electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds
-
Install the electron DMG installer tool:
npm install electron-installer-dmg -g
-
Create Mac DMG:
electron-installer-dmg --icon=assets/icons/mac/icon.icns release-builds/CARTA-Desktop-darwin-x64/CARTA-Desktop.app newCARTA-Desktop
-
Create Linux App:
electron-packager . --overwrite --asar=true --platform=linux --arch=x64 --icon=carta_logo_v2.png --prune=true --out=release-builds
The packaged apps can be found in the newCARTADesktop/release-builds/
directory.
- Docker and x11 can be problematic, particularly on Linux. Sometimes there can be errors such as
QXcbConnection: Could not connect to display
. I think setting-e DISPLAY=$DISPLAY
and runningxhost +
at first helps in most cases, but I'm still investigating a guaranteed way for it to work everytime. On Mac, I think-e DISPLAY=docker.for.mac.host.internal:0
will work every time, but still need to do more testing. On Linux, it now queries the system for $DISPLAY and uses whatever that value is in the docker command. - If possible, get the app to install Docker and download the image if not already present.
- Currently there is a fixed pause (
child_process.execSync("sleep 5")
) after clicking Local Mode in order to give the docker image time to start up before the browser window opens and requests localhost:3000. Although startup is now quite fast, this could probably be improved by having it monitoring the output log and waiting untilwebsocket onopen done
comes up before continuing. - Reduce size of the docker image. It is currently quite large at 1.806GB (
ajmasiaa/newcarta_meteor_v3
) but I am working on reducing the size by a few hundred megabytes. - Currently some sample images are supplied in the docker image. Instead, it should mount a user's local directory so they can open their own images. This is easy to do in the docker run command with an extra -v flag;
-v <absolute path to local directory>:<absolute path to directory in docker image>
Your comments and suggestions are welcome.
https://github.com/CARTAvis