Skip to content

Commit

Permalink
Rework packaging (#1307)
Browse files Browse the repository at this point in the history
* Replace maven-capsule-plugin with maven-assembly-plugin in eclair-node and eclair-node-gui:
 The new packaging produces a zip file containing a launcher script and all the artifacts and dependencies in lib/.

* Add bash launcher scripts for eclair-node and eclair-node-gui, inspired by https://github.com/sbt/sbt-native-packager/blob/master/src/main/resources/com/typesafe/sbt/packager/archetypes/scripts/bash-template

* Add windows launcher scripts, inspired by https://github.com/sbt/sbt-native-packager/blob/master/src/main/resources/com/typesafe/sbt/packager/archetypes/scripts/bat-template

* Add option to start kanela agent with eclair-node launcher scripts

* Force unix file ending in launcher scripts

* Add eclair-cli in the bin folder of packaged eclair-node and eclair-node-gui
  • Loading branch information
araspitzu committed Feb 24, 2020
1 parent cc4a4ab commit a028645
Show file tree
Hide file tree
Showing 12 changed files with 1,258 additions and 58 deletions.
13 changes: 6 additions & 7 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,28 @@

## Build

Eclair supports deterministic builds for the eclair-core submodule, this is the 'core' of the eclair application
and its artifact can be deterministically built achieving byte-to-byte equality for each build. To build the exact
same artifacts that we release, you must use the build environment (OS, JDK, maven...) that we specify in our
release notes.
Eclair is packaged as a compressed archive with a launcher script, the archives are built deterministically
so it's possible to reproduce the build and verify its equality byte-by-byte. To build the exact same artifacts
that we release, you must use the build environment (OS, JDK, maven...) that we specify in our release notes.

To build the project and run the tests, simply run:

```shell
mvn install
mvn package
```

### Other build options

To skip all tests, run:

```shell
mvn install -DskipTests
mvn package -DskipTests
```

To only build the `eclair-node` module, run:

```shell
mvn install -pl eclair-node -am -DskipTests
mvn package -pl eclair-node -am -DskipTests
```

To run the tests, run:
Expand Down
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ COPY pom.xml pom.xml
COPY eclair-core/pom.xml eclair-core/pom.xml
COPY eclair-node/pom.xml eclair-node/pom.xml
COPY eclair-node-gui/pom.xml eclair-node-gui/pom.xml
COPY eclair-node/modules/eclair-node.xml eclair-node/modules/eclair-node.xml
COPY eclair-node-gui/modules/eclair-node-gui.xml eclair-node-gui/modules/eclair-node-gui.xml
RUN mkdir -p eclair-core/src/main/scala && touch eclair-core/src/main/scala/empty.scala
# Blank build. We only care about eclair-node, and we use install because eclair-node depends on eclair-core
RUN mvn install -pl eclair-node -am
Expand All @@ -45,20 +47,20 @@ FROM openjdk:11.0.4-jre-slim
WORKDIR /app

# install jq for eclair-cli
RUN apt-get update && apt-get install -y bash jq curl
RUN apt-get update && apt-get install -y bash jq curl unzip

# copy and install eclair-cli executable
COPY --from=BUILD /usr/src/eclair-core/eclair-cli .
RUN chmod +x eclair-cli && mv eclair-cli /sbin/eclair-cli

# Eclair only needs the eclair-node-*.jar to run
COPY --from=BUILD /usr/src/eclair-node/target/eclair-node-*.jar .
RUN ln `ls` eclair-node.jar
# we only need the eclair-node.zip to run
COPY --from=BUILD /usr/src/eclair-node/target/eclair-node-*.zip ./eclair-node.zip
RUN unzip eclair-node.zip && mv eclair-node-* eclair-node

ENV ECLAIR_DATADIR=/data
ENV JAVA_OPTS=

RUN mkdir -p "$ECLAIR_DATADIR"
VOLUME [ "/data" ]

ENTRYPOINT java $JAVA_OPTS -Declair.datadir=$ECLAIR_DATADIR -jar eclair-node.jar
ENTRYPOINT $JAVA_OPTS eclair-node/bin/eclair-node.sh -Declair.datadir=$ECLAIR_DATADIR
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,25 @@ zmqpubrawtx=tcp://127.0.0.1:29000

### Installing Eclair

Eclair is developed in [Scala](https://www.scala-lang.org/), a powerful functional language that runs on the JVM, and is packaged as a JAR (Java Archive) file. We provide 2 different packages, which internally use the same core libraries:
Eclair is developed in [Scala](https://www.scala-lang.org/), a powerful functional language that runs on the JVM, and is packaged as a ZIP archive. We provide 2 different packages, which internally use the same core libraries:

* eclair-node, which is a headless application that you can run on servers and desktops, and control from the command line
* eclair-node-gui, which also includes a JavaFX GUI

To run Eclair, you first need to install Java, we recommend that you use [OpenJDK 11](https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot). Other runtimes also work but we don't recommend using them.

Then download our latest [release](https://github.com/ACINQ/eclair/releases) and depending on whether or not you want a GUI run the following command:
Then download our latest [release](https://github.com/ACINQ/eclair/releases), unzip the archive and depending on whether or not you want a GUI run the following command:

* with GUI:

```shell
java -jar eclair-node-gui-<version>-<commit_id>.jar
eclair-node-gui-<version>-<commit_id>/bin/eclair-node-gui.sh
```

* without GUI:

```shell
java -jar eclair-node-<version>-<commit_id>.jar
eclair-node-<version>-<commit_id>/bin/eclair-node.sh
```

### Configuring Eclair
Expand Down Expand Up @@ -133,15 +133,15 @@ eclair.printToConsole | Log to stdout (in addition to eclair.log) |
For example, to specify a different data directory you would run the following command:

```shell
java -Declair.datadir=/tmp/node1 -jar eclair-node-gui-<version>-<commit_id>.jar
eclair-node-<version>-<commit_id>/bin/eclair-node.sh -Declair.datadir=/tmp/node1
```

#### Logging

Eclair uses [`logback`](https://logback.qos.ch) for logging. To use a different configuration, and override the internal logback.xml, run:

```shell
java -Dlogback.configurationFile=/path/to/logback-custom.xml -jar eclair-node-gui-<version>-<commit_id>.jar
eclair-node-<version>-<commit_id>/bin/eclair-node.sh -Dlogback.configurationFile=/path/to/logback-custom.xml
```

#### Backup
Expand Down Expand Up @@ -197,7 +197,7 @@ A valid plugin is a jar that contains an implementation of the [Plugin](eclair-n
Here is how to run Eclair with plugins:

```shell
java -jar eclair-node-<version>-<commit_id>.jar <plugin1.jar> <plugin2.jar> <...>
eclair-node-<version>-<commit_id>/bin/eclair-node.sh <plugin1.jar> <plugin2.jar> <...>
```

## Testnet usage
Expand Down
44 changes: 44 additions & 0 deletions eclair-node-gui/modules/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<dependencySets> <!-- include dependencies -->
<dependencySet>
<outputDirectory>lib</outputDirectory>
<useProjectArtifact>true</useProjectArtifact> <!-- include eclair-core and eclair node -->
<unpack>false</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<fileSets> <!-- Include readme and license -->
<fileSet>
<directory>../</directory>
<includes>
<include>README.md</include>
<include>LICENSE*</include>
</includes>
</fileSet>
<fileSet> <!-- Include the launcher scripts -->
<directory>${project.basedir}/src/main/resources</directory>
<outputDirectory>bin</outputDirectory>
<includes>
<include>eclair-node-gui.sh</include>
<include>eclair-node-gui.bat</include>
</includes>
<fileMode>0755</fileMode>
<lineEnding>unix</lineEnding>
</fileSet>
<fileSet> <!-- Include eclair-cli -->
<directory>../eclair-core/</directory>
<outputDirectory>bin</outputDirectory>
<includes>
<include>eclair-cli</include>
</includes>
<fileMode>0755</fileMode>
<lineEnding>unix</lineEnding>
</fileSet>
</fileSets>
</assembly>
24 changes: 15 additions & 9 deletions eclair-node-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,25 @@
</configuration>
</plugin>
<plugin>
<groupId>com.github.chrisdchristo</groupId>
<artifactId>capsule-maven-plugin</artifactId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<finalName>${project.name}-${project.version}-${git.commit.id.abbrev}</finalName>
<descriptors>
<descriptor>modules/assembly.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>fr.acinq.eclair.JavafxBoot</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
<goal>single</goal>
</goals>
<configuration>
<appClass>fr.acinq.eclair.JavafxBoot</appClass>
<type>fat</type>
<fileName>${project.name}-${project.version}</fileName>
<fileDesc>-${git.commit.id.abbrev}</fileDesc>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
Loading

0 comments on commit a028645

Please sign in to comment.