This readme allows you to install a docker image of openCPU which contains a demo app and the latest version of phisWSClientR package.
Prerequisites
:
- Access to root account
- Able to use the 8004
Follow the Installation guide. (recommended)
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
# check GPG key
sudo apt-key fingerprint 0EBFCD88
pub 4096R/0EBFCD88 2017-02-22
Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid Docker Release (CE deb) <docker@docker.com>
sub 4096R/F273FCD8 2017-02-22
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
# create docker group it doesn't exist
sudo groupadd docker
# put phis user in docker group
user=phis
sudo usermod -aG docker $user
# $USER means the connected user
# if is different from phis user run the following commands
# sudo usermod -aG docker $USER
Log out and log back in so that your group membership is re-evaluated.
For more information go to https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user
sudo systemctl enable docker
Run the following command :
nmcli dev show | grep 'IP4.DNS'
The excepted result is above :
IP4.DNS[1]: 147.99.0.248
IP4.DNS[2]: 147.99.0.249
more /etc/resolv.conf
# Generated by NetworkManager
nameserver 138.102.210.7
nameserver 147.100.166.31
sudo su
echo "{\"dns\": [\"YOUR_DNS_1_IP_HERE\", \"YOUR_DNS_2_IP_HERE\"]}" > /etc/docker/daemon.json
- daemon.json file content example :
{
"dns": ["147.99.0.222", "147.99.0.223"]
}
service docker restart
docker build --no-cache https://github.com/OpenSILEX/opensilex-opencpu-docker.git -t opensilex/opencpu
##2.2 Run docker image
- example :
docker run -d -t -p 8004:8004 --name=opensilex-ocpu opensilex/opencpu:latest
# or
# if you want to link a host folder and container folder
# docker run -v {host_scripts_path}:/home/opencpu/scripts --name opencpu-server -t -p 8004:8004 opencpu/rstudio
By default, the docker file already contains "opensilex/opensilex-datavis-rapp-demo" application and "phisWSClientR" package.
#2.3 Test demo application
You can now go to : http://localhost:8004/ocpu/apps/opensilex/opensilex-datavis-rapp-demo/www/ .
You will able to try the demo R application.
#2.4 Stop docker container Run in terminal :
docker stop opensilex-ocpu
#2.5 Start docker container Run in terminal :
docker start opensilex-ocpu
#2.6 Remove docker container Run in terminal :
docker stop opensilex-ocpu
docker rm opensilex-ocpu
You can connect to the http://{serverIp}:8004/rstudio
your favorite R IDE
The default password is opencpu but it can be modified. (coming soon ...)
And run this command
opencpu::install_apps("opensilex/opensilex-datavis-rapp-demo")
or you can connect to the docker container :
docker exec -i -t container_name /bin/bash
# switch to non root user
su opencpu
# install package
R -e 'opencpu::install_apps("opensilex/opensilex-datavis-rapp-demo")'
You can connect to the http://{serverIp}:8004/rstudio
your favorite R IDE
The default password is opencpu but it can be modified. (coming soon ...)
And run this command
opencpu::install_github("opensilex/phisWSClientR")
or you can connect to the docker container :
docker exec -i -t container_name /bin/bash
# switch to non root user
su opencpu
# install package
R -e 'opencpu::install_apps("opensilex/phisWSClientR")'
If you have set a link between {host_scripts_path}
and /home/opencpu/scripts
.
You can move your R package archive (tar.gz) in {host_scripts_path}
in order to be able to access
it in the container.
Now can connect to the docker container and install your package from the source :
docker exec -i -t container_name /bin/bash
# switch to non root user
su opencpu
# install package
R -e 'install.packages("/home/opencpu/scripts/phisWSClientR_1.2.0.tar.gz",repos=NULL,type ="source")'
Follow instructions at :
https://docs.docker.com/install/linux/docker-ce/debian/#uninstall-docker-ce