Installing Petals Cockpit
Requirements
Petals Cockpit needs Java 8 to run the backend. If you have more than one JRE available, set the environment variable JAVA_HOME with the path of the JRE you want to use.
The H2 Database used by the backend is automatically handled. It can be changed from configuration files but, for now, no other than H2 were tested.
The supported browsers are Chrome and chromium variants. While not officially supported, the frontend is highly compatible with Firefox.
Installing from .zip file
- Get latest compiled version from Petals Cockpit project page
- Unpack it and go into the directory
- On POSIX systems, if needed, set the execute bit on petals-cockpit.sh
- Run Petals Cockpit script and follow instructions :
$ ./petals-cockpit.sh
Building and running from docker
A pre-built Petals Cockpit docker image is hosted on its docker hub public repository.
Docker must be properly installed on your system for these commands to function.
- Download the image:
$ docker pull petals/petals-cockpit:latest
- Start in detached mode
$ docker run -d -p 8080:8080 --name petals-cockpit petals/petals-cockpit:latest
For exhaustive information about building and running a docker image of Petals Cockpit, see the Github docker-petals-cockpit project page.
Building and running from sources
- Build the frontend
$ cd frontend && yarn run build:product && cd ..
- Build Petals Cockpit (it will also build the backend)
$ mvn -s ci/settings.xml clean verify antrun:run@build-product-dist
- The final distribution directory (as found in the .zip version) will be in cockpit/target/dist. On POSIX systems, if needed, set the execute bit on petals-cockpit.sh
- From there, run the script:
$ ./petals-cockpit.sh
For exhaustive information about building and running Petals Cockpit from its sources, see the Gitlab Petals Cockpit project page.
Installation directory
The installation directory from ZIP archive and compiled sources contains :
- A conf directory which contains the config.yml server configuration file
- A db directory which contains the generated cockpit.mv.db and cockpit.trace.db data base files.
- A lib directory which contains the petals-cockpit-X.X.X-capsule.jar application jarfile.
- A logs directory which contains the log files generated at runtime.
- A petals-cockpit.sh run script.
- A README.txt helper file.
Configuring Petals Cockpit
Configuration file
The configuration file: ./conf/config.yml allows you to configure cockpit server.
The server based on Dropwizard, you should find more informations about configuration on their website.
Application connector
Here you can modify the port on which the frontend application will be served :
server: applicationConnectors: - type: http port: 8080
Database
This section allows you to choose which data base the backend will use.
You can specify the adress, driver and user/password to connect to the data base.
database:
driverClass: org.h2.Driver
user: petals
password: petals
url: jdbc:h2:./db/cockpit
validationQuery: "/* Health Check */ SELECT 1"
Petals Cockpit 0.22.0 has only been tested with H2 database. Be careful changing this.
Validation query may have to be adapted as well to the chosen DB. |
Logging
This section allows you to choose where and how logs are displayed and archived:
server:
requestLog:
appenders:
- type: file
currentLogFilename: ./logs/cockpit-access.log
archivedLogFilenamePattern: ./logs/cockpit-access-%d.log.gz
logging:
#Global logging setting
level: INFO
#Specific cockpit loggers settings
#(will bypass the console threshold & filter)
loggers:
"org.ow2.petals.cockpit.server":
level: INFO
appenders:
- type: console
#File logging uses global setting, console filters out global cockpit output
#(to avoid duplicates from previous specific logger)
appenders:
- type: file
currentLogFilename: ./logs/cockpit.log
archivedLogFilenamePattern: ./logs/cockpit-%d.log.gz
archivedFileCount: 5
- type: console
threshold: WARN
filterFactories:
- type: cockpit-server-filter-factory
server.requestLog.appenders allows to choose where to log all REST requests reaching the server.
logging.appenders allows to choose where to log the application output, you can filter it by logging level. Levels can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL.