Install with Docker on CentOS 8
Table of Contents
- 1. Install docker (optional)
- 2. Add user (optional)
- 3. Get the Dockerfile and basic structure
- 4. Configure the application using environment variables in the Dockerfile (optional)
- 5. Build the docker image
- 6. Run the docker container
- 7. Stop the docker container
- 8. Start the docker container
- 9. Log into the application
Install docker (optional)
This step is needed only when you don't have Docker installed yet.
sudo
dnf config-manager --add-repo=https:
//download
.docker.com
/linux/centos/docker-ce
.repo
sudo
dnf
install
docker-ce --nobest
sudo
systemctl
enable
--now docker
Add user (optional)
Create the user "graphlytic" and add it to the docker group. It is not recommended to create and run the Graphlytic docker container with the root user. It may cause problems with files created by the docker process.
sudo
useradd
-m -s
/bin/bash
graphlytic
sudo
usermod
-aG docker graphlytic
Switch the user to "graphlytic".
sudo
su
graphlytic
cd
~
Get the Dockerfile and basic structure
As a first step, you need to create a directory structure where the docker image will be built.
Go to the directory where you want to place the application files and run:
git clone https:
//github
.com
/demtec/graphlytic-docker
.git
cd
graphlytic-docker
If you haven't installed git, you can install it by running this command:
sudo
dnf
install
git
Configure the application using environment variables in the Dockerfile (optional)
Configure Neo4j connection
This is an optional step that can be used when you want to set some of the application configurations prior to running the container. It's used mainly in automated environments. For the list of all configurations that can be set this way please refer to Configuration.
For instance to set the Neo4j connection go to graphlytic-docker directory and edit the Dockerfile file (you can set the connection also later, in the application's Setting section). There are several properties regarding the Neo4j connection. Please change these values according to your Neo4j location:
ENV NEO4J_CONNECTOR_BOLT=bolt:
//localhost:7687
ENV NEO4J_CONNECTOR_USERNAME=neo4j
ENV NEO4J_CONNECTOR_PASSWORD=neo4j
ENV NEO4J_CONNECTOR_ENCRYPTED=
false
If the Neo4j database is running on your machine together with the Graphlytic docker container, try to set NEO4J_CONNECTOR_BOLT to:
- bolt://172.17.0.1:7687 on Linux
- bolt://host.docker.internal:7687 on Windows or Mac
Configure custom SSL keystore
Firstly make sure, you have a keystore file with the desired certificate (e.g. ./keystore/graphlytic-keystore.jks). More information about adding a certificate to a keystore can be found here: How to install HTTPS Certificate.
It is possible to configure SSL context with these environment variables (examples below):
ENV SERVER_SSL_KEYSTORE=/usr/share/graphlytic/keystore/graphlytic-keystore.jks
ENV SERVER_SSL_KEYSTOREPASSWORD=SomePass
ENV SERVER_SSL_KEYSTORETYPE=JKS
ENV SERVER_SSL_TRUSTSTORE=/usr/share/graphlytic/keystore/graphlytic-keystore.jks
ENV SERVER_SSL_TRUSTSTOREPASSWORD=SomePass
ENV SERVER_SSL_TRUSTSTORETYPE=JKS
ENV SERVER_SSL_CLIENTAUTH=none
In order to use a custom keystore, it needs to be mounted in a volume. To achieve this, use the docker command -v, for example:
docker run -tid --name graphlytic -v
"$(pwd)"
/keystore/:/usr/share/graphlytic/keystore -v
"$(pwd)"
/volume/:/usr/share/graphlytic/volume -p
8080
:
8080
-p
8443
:
8443
graphlytic
which mounts ./keystore folder into /usr/share/graphlytic/keystore, which contains our graphlytic-keystore.jks, mentioned in the environment variables above.
Build the docker image
Fetch latest GL version:
docker pull demtec/graphlytic:latest
Build your local image with this command:
docker build -t graphlytic .
Run the docker container
Create and run the docker container.
docker run -tid --user $(
id
-u):$(
id
-g) --restart=always --name graphlytic -
v
"$(pwd)"
/volume/
:
/usr/share/graphlytic/volume
-p 8080:8080 graphlytic
It can last up to several minutes for the docker container and the application to be fully ready.
Stop the docker container
docker stop graphlytic
Start the docker container
docker start graphlytic
Log into the application
When the application is fully started you should be able to log in using the Login with default user manual.