Build from source
Follow these steps to build from source.
1. Install the tools
Building from source requires the following:
- Maven (version 3.8.2 works)
- Java, at least version 11
- Relational Database System (Postgres preferred)
- Git client
- Optional: an IDE like Eclipse or IntelliJ
2. Clone the Git repo
$ git clone git@github.com:Marketcetera/marketcetera.git
Set up your desired database system
Marketcetera uses a relational database management system. Any ACID-compliant database that Hibernate supports probably works. Migration scripts exist for Postgres and HSQLDB. For the development environment, you must tell Maven how to find your database.
Postgres Setup
$ sudo su - postgres
$ psql
> create user metc with password 'pw4metc';
> create database metc with owner metc;
> \q
Note that you might need to adjust access permissions for your Postgres server to allow TCP/IP connections from localhost.
Edit or create a Maven settings file. For Unix-like systems, this will be in ~/.m2/settings.xml
. This is where you define what database system you'll use for the development environment.
<settings>
<profiles>
<profile>
<id>default</id>
<properties>
<!-- Common Settings -->
<metc.marketdata.exsim.sender.comp.id>your-name-here-md</metc.marketdata.exsim.sender.comp.id>
<metc.exsim.sendercompid>your-name-here-your-machine-here-dare</metc.exsim.sendercompid>
<!-- Postgres -->
<metc.jdbc.user>metc</metc.jdbc.user>
<metc.jdbc.password>pw4metc</metc.jdbc.password>
<metc.jdbc.driver>org.postgresql.Driver</metc.jdbc.driver>
<metc.jdbc.url>jdbc:postgresql://127.0.0.1/metc</metc.jdbc.url>
<metc.jdbc.testquery>select 1</metc.jdbc.testquery>
<metc.hibernate.dialect>org.hibernate.dialect.PostgreSQLDialect</metc.hibernate.dialect>
<metc.flyway.vendor>psql</metc.flyway.vendor>
</properties>
</profile>
</profiles>
</settings>
Set up HSQLDB
Do not use HSQLDB for production installations.
Edit your Maven settings file. For Unix-like systems, this will be in ~/.m2/settings.xml. This is where you define what database system you'll use for the development environment.
<settings>
<profiles>
<profile>
<id>default</id>
<properties>
<!-- Common Settings -->
<metc.marketdata.exsim.sender.comp.id>your-name-here-md</metc.marketdata.exsim.sender.comp.id>
<metc.exsim.sendercompid>your-name-here-your-machine-here-dare</metc.exsim.sendercompid>
<metc.jdbc.user>metc</metc.jdbc.user>
<metc.jdbc.password>pw4metc</metc.jdbc.password>
<metc.jdbc.driver>org.hsqldb.jdbc.JDBCDriver</metc.jdbc.driver>
<metc.jdbc.url>jdbc:hsqldb:file:./target/data/metc</metc.jdbc.url>
<metc.jdbc.testquery>CALL NOW()</metc.jdbc.testquery>
<metc.hibernate.dialect>org.hibernate.dialect.HSQLDialect</metc.hibernate.dialect>
<metc.flyway.vendor>hsqldb</metc.flyway.vendor>
</properties>
</profile>
</profiles>
</settings>
4. Build with Maven
$ cd marketcetera
$ java -version
openjdk version "11.0.18" 2023-01-17
OpenJDK Runtime Environment Temurin-11.0.18+10 (build 11.0.18+10)
OpenJDK 64-Bit Server VM Temurin-11.0.18+10 (build 11.0.18+10, mixed mode)
$ mvn -DskipTests install
5. Start DARE Server
You can start DARE directly from Maven on your command line. Alternatively, you can use the Docker container that Marketcetera provides.
Command line
$ cd packages/dare-package
$ mvn -Pexecute exec:java
Open a second terminal window to check the progress of the server startup.
$ cd packages/dare-package
$ tail -f target/logs/dare-instance1.log
Docker
The Docker package is automatically built and imported to your local Docker server.
To run the Docker image instead of running from the command line:
$ cd packages/docker-package
$ mvn -PexecuteDocker exec:exec
...
Docker enabled
15 Jan 2024 17:27:54,260 INFO [main] metc.startup (MultiInstanceApplicationContainer.java:468) - Launching instance 1 of 1
Open a second terminal window to check the progress of the Docker server startup.
The specific name of the Docker container might differ.
Replace <CONTAINER_NAME>
with the output from docker ps
.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d38890322aae org.marketcetera/docker-package:4.1.1 "sh -c /opt/Marketce…" About a minute ago Up About a minute 0.0.0.0:19000->9000/tcp, 0.0.0.0:19010->9010/tcp, 0.0.0.0:19020->9020/tcp zealous_cray
$ docker exec -it <CONTAINER_NAME> /bin/bash
marketcetera@c22f6872b1c9:/opt/Marketcetera$ tail -f dare/logs/dare-instance1.log
! Ports in Use !
+------------------------+
! Port ! Description !
+------+-----------------+
! 9000 ! DARE Web Server !
+------+-----------------+
! 9010 ! RPC Server !
+------+-----------------+
! 9020 ! DARE Acceptor !
+------+-----------------+
15 Jan 2024 17:37:36,891 INFO [pool-4-thread-1] marketcetera.core.HikariMonitor (HikariMonitor.java:137) - HikariPool: active: 0 idle: 100 total: 100 max: 100
To shut down the Docker instance when done:
$ docker kill <CONTAINER_NAME>
Your Docker server instance will connect to the database that you specified in the set up database section.
6. Start Photon UI Client
$ cd photon
$ mvn javafx:run