Skip to content

Commit

Permalink
Merge pull request #360 from DependencyTrack/cleanup-bundled-leftovers
Browse files Browse the repository at this point in the history
Cleanup leftovers of bundled distribution and H2
  • Loading branch information
nscuro authored Oct 19, 2023
2 parents f06b808 + d77598c commit 6560d2e
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 245 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ jobs:
run: |-
pushd target
echo "# SHA1" >> checksums.txt
sha1sum dependency-track-apiserver.jar dependency-track-bundled.jar >> checksums.txt
sha1sum dependency-track-apiserver.jar >> checksums.txt
echo "# SHA256" >> checksums.txt
sha256sum dependency-track-apiserver.jar dependency-track-bundled.jar >> checksums.txt
sha256sum dependency-track-apiserver.jar >> checksums.txt
echo "# SHA512" >> checksums.txt
sha512sum dependency-track-apiserver.jar dependency-track-bundled.jar >> checksums.txt
sha512sum dependency-track-apiserver.jar >> checksums.txt
popd
- name: Update Release
Expand All @@ -82,6 +82,5 @@ jobs:
gh release upload ${{ needs.read-version.outputs.version }} \
--clobber \
target/dependency-track-apiserver.jar \
target/dependency-track-bundled.jar \
target/checksums.txt \
target/bom.json
5 changes: 0 additions & 5 deletions .lift.toml

This file was deleted.

23 changes: 0 additions & 23 deletions .run/Build Bundled Image.run.xml

This file was deleted.

35 changes: 0 additions & 35 deletions .run/Build Bundled.run.xml

This file was deleted.

31 changes: 0 additions & 31 deletions .run/Jetty with H2 Console.run.xml

This file was deleted.

56 changes: 4 additions & 52 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,10 @@ Build an executable JAR containing just the API server:
mvn clean package -P clean-exclude-wars -P enhance -P embedded-jetty -DskipTests -Dlogback.configuration.file=src/main/docker/logback.xml
```

Build an executable JAR that contains both API server and frontend (aka "bundled" distribution):

```shell
mvn clean package -P clean-exclude-wars -P enhance -P embedded-jetty -P bundle-ui -DskipTests -Dlogback.configuration.file=src/main/docker/logback.xml
```

> When using the `bundle-ui` profile, Maven will download
> a [`DependencyTrack/frontend`](https://github.com/DependencyTrack/frontend)
> release and include it in the JAR. The frontend version is specified via the `frontend.version` property
> in [`pom.xml`](./pom.xml).
The resulting files are placed in `./target` as `dependency-track-apiserver.jar` or `dependency-track-bundled.jar`
respectively.
Both JARs ship with
The resulting file is placed in `./target` as `dependency-track-apiserver.jar`.
The JAR ships with
an [embedded Jetty server](https://github.com/stevespringett/Alpine/tree/master/alpine-executable-war),
there's no need to deploy them in an application server like Tomcat or WildFly.
there's no need to deploy it in an application server like Tomcat or WildFly.

## Running

Expand Down Expand Up @@ -109,39 +97,9 @@ To build and run the API server in one go, invoke the Jetty Maven plugin as foll
mvn jetty:run -P enhance -Dlogback.configurationFile=src/main/docker/logback.xml
```

> Note that the `bundle-ui` profile has no effect using this method.
> It works only for the API server, not the bundled distribution.
The above command is also suitable for debugging. For IntelliJ, simply *Debug* the [Jetty](./.run/Jetty.run.xml) run
configuration.

### Skipping NVD mirroring

For local debugging and testing, it is sometimes desirable to skip the NVD mirroring process
that is executed a minute after Dependency-Track has started.

This can be achieved by tricking Dependency-Track into thinking that it already
mirrored the NVD data, so there's no need to re-download it again.

Prior to starting Dependency-Track, execute the `data-nist-generate-dummy.sh` script:

```shell
./scripts/data-nist-generate-dummy.sh
```

> **Note**
> The `modified` feed will still be downloaded. But that feed is so small that it
> doesn't really have an impact.
When testing containerized deployments, simply mount the local directory containing the prepared
NVD data into the container:

```shell
./scripts/data-nist-generate-dummy.sh
docker run -d --name dtrack \
-v "$HOME/.dependency-track:/data/.dependency-track" \
-p '127.0.0.1:8080:8080' dependencytrack/apiserver:snapshot
```

## Debugging with Frontend

Start the API server via the Jetty Maven plugin (see [Debugging](#debugging) above). The API server will listen on
Expand Down Expand Up @@ -206,20 +164,14 @@ Now just execute the test again, and it should just work.
## Building Container Images

Ensure you've built either API server or the bundled distribution, or both.
Ensure you've built the API server JAR.

To build the API server image:

```shell
docker build --build-arg WAR_FILENAME=dependency-track-apiserver.jar -t dependencytrack/apiserver:local -f ./src/main/docker/Dockerfile .
```

To build the bundled image:

```shell
docker build --build-arg WAR_FILENAME=dependency-track-bundled.jar -t dependencytrack/bundled:local -f ./src/main/docker/Dockerfile .
```

## Shedlock
Shedlock is being used to ensure that scheduled tasks are executed at most once at the same time.
If a task is being executed on one node, it acquires a lock which prevents execution of the same task from another node (or thread).
Expand Down
81 changes: 0 additions & 81 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -683,87 +683,6 @@
<war-embedded-finalname>${project.build.finalName}-apiserver</war-embedded-finalname>
</properties>
</profile>
<profile>
<id>h2-console</id>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${plugin.jetty.version}</version>
<configuration>
<webApp>
<contextPath>/</contextPath>
</webApp>
<contextXml>src/test/webapp/WEB-INF/h2-console-activation.xml</contextXml>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>bundle-ui</id>
<activation>
<property>
<name>env.ACTIVATE_BUNDLE_UI</name>
<value>true</value>
</property>
</activation>
<properties>
<war-embedded-finalname>${project.build.finalName}-bundled</war-embedded-finalname>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>frontend-download</id>
<phase>prepare-package</phase>
<configuration>
<target>
<get src="https://github.com/sahibamittal/dependency-track-frontend/files/9733406/dist.zip" dest="${project.build.directory}" verbose="true"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>frontend-extract</id>
<phase>prepare-package</phase>
<configuration>
<target>
<unzip src="${project.build.directory}/dist.zip" dest="${project.build.directory}/frontend">
</unzip>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>frontend-resource-deploy</id>
<phase>prepare-package</phase>
<configuration>
<target>
<copy todir="${project.build.directory}/${project.artifactId}">
<fileset dir="${project.build.directory}/frontend/dist">
<include name="**/*"/>
</fileset>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
14 changes: 0 additions & 14 deletions src/test/webapp/WEB-INF/h2-console-activation.xml

This file was deleted.

0 comments on commit 6560d2e

Please sign in to comment.