Skip to content

Commit

Permalink
Merge pull request #238 from micromata/8.0-Release
Browse files Browse the repository at this point in the history
Docker images for 8.0 (amd64, arm64, Linux and macOS, including M1)
  • Loading branch information
kreinhard authored Dec 26, 2024
2 parents 3e0af0d + 9d6b4a0 commit 6265f31
Show file tree
Hide file tree
Showing 10 changed files with 144 additions and 132 deletions.
80 changes: 34 additions & 46 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,55 +1,43 @@
#FROM node:16.0.0-buster as buildreact
#RUN apt-get update && apt-get -y upgrade
#RUN mkdir /app
#WORKDIR /app
#RUN npm install -g [email protected]
#COPY ./projectforge-webapp /app
#RUN npm install
#RUN npm run build

FROM maven:3.8.1-jdk-15 AS build
RUN mkdir /app
COPY . /app
FROM openjdk:17-slim

# Argument for JAR file name to use in working directory:
ARG JAR_FILE

# Set working directory
WORKDIR /app
# http://whitfin.io/speeding-up-maven-docker-builds/
#RUN mvn dependency:go-offline -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
# -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B needed, otherwise log will be clipped (log limit reached)
# RUN mvn install -DskipTests -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
# For test only: COPY projectforge-application-7.1.1.jar /app
# mvn fails from time to time, so run mvn outside and copy projectforge-application/target/projectforge-application*.jar to current dir.
RUN mkdir /dist
WORKDIR /dist
# For test only: RUN unzip /app/projectforge-application*.jar
RUN unzip /app/projectforge-application-*.jar

FROM openjdk:15-buster

# See: https://spring.io/guides/gs/spring-boot-docker/

# This is a Debian system, update system packages (if needed)
RUN apt-get update && apt-get -y upgrade

RUN addgroup projectforge && adduser --ingroup projectforge projectforge
# ProjectForge's base dir: must be mounted on host file system:
RUN mkdir /ProjectForge
# Grant access for user projectforge:
RUN chown projectforge.projectforge /ProjectForge
VOLUME /ProjectForge

RUN mkdir -p /app

# Copy the specified JAR file into the container
COPY ${JAR_FILE} /app/application.jar
COPY docker/entrypoint.sh /app/entrypoint.sh

# Set permissions for the entrypoint script
RUN chmod +x /app/entrypoint.sh

# Expose application port
EXPOSE 8080

USER projectforge:projectforge
# Use a non-root user
RUN addgroup --system projectforge && adduser --system --ingroup projectforge projectforge

# Install findutils (xargs needed by gradle)
#RUN apt-get update && apt-get install -y findutils && rm -rf /var/lib/apt/lists/*
# pgrep needed by the entrypoint.sh
RUN apt-get update && apt-get install -y procps && rm -rf /var/lib/apt/lists/*

# Don't put fat jar files in docker images: https://phauer.com/2019/no-fat-jar-in-docker-image/
ARG DEPENDENCY=/dist
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app

#COPY --from=buildreact /app ${DEPENDENCY}/BOOT-INF/classes
# Expose the port and declare the volume
RUN mkdir -p /ProjectForge && chown -R projectforge:projectforge /ProjectForge
VOLUME /ProjectForge

COPY docker/environment.sh /ProjectForge

COPY --from=build --chown=projectforge:projectforge /app/docker/entrypoint.sh /app
RUN chmod 755 /app/entrypoint.sh
# Switch to the non-root user
USER projectforge:projectforge

# Run the Spring Boot application
ENTRYPOINT ["/app/entrypoint.sh"]
# ENTRYPOINT ["java", "-jar", "/app/application.jar"]

MAINTAINER Micromata
LABEL maintainer="Micromata"
23 changes: 18 additions & 5 deletions doc/deployment.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,28 @@ link:index{outfilesuffix}[Top]
5. If all tests are finished successfully and the test of the ProjectForge-Application works for new and existing databases), proceeed:
6. Copy executable jar file from `projectforge-application/build/libs/projectforge-application-\*.jar` to SourceForge and tag this file as default for all platforms
7. Building and pushing docker
a. `cp projectforge-application/build/libs/projectforge-application*.jar .`
b. `docker build -t micromata/projectforge:latest .`
c. `docker tag bc0459ed7d01 micromata/projectforge:$PF_NEW_VERSION` (use image id for tagging)
d. `docker push micromata/projectforge:$PF_NEW_VERSION`
e. `docker push micromata/projectforge:latest`
a. For testing docker images first, please refer `/dokcer/README.adoc`.
b. `export PF_VERSION=8.0`
c. `export DOCKER_USER=micromata`
d. `cp projectforge-application/build/libs/projectforge-application*.jar .`
e. `docker buildx build --platform linux/arm64,linux/amd64
--build-arg JAR_FILE=projectforge-application-$PF_VERSION.jar
-t $DOCKER_USER/projectforge:$PF_VERSION
-t $DOCKER_USER/projectforge:latest --push .`
f. Check docker images: https://hub.docker.com/r/micromata/projectforge/tags (both should be available: arm64 and amd64)
8. Merge the release branch into the master and develop branch (Git Flow: Finish release)
9. Tag master branch with version number
10. Change to develop branch
11. Create new SNAPSHOT-Release by increasing version number: +
`./build.gradle.kts: version = '8.0.1-SNAPSHOT'`
12. Commit everything to master and develop branch and push it to Github
13. Upload the saved jar files to Github (Create release from taged version) and SourceForge (e.g. as zip (see previous versions as example)).

Optional (if not done before):

[source]
----
docker buildx create --name mybuilder --use
docker buildx inspect mybuilder --bootstrap
----

32 changes: 0 additions & 32 deletions docker/Dockerfile-manually

This file was deleted.

31 changes: 22 additions & 9 deletions docker/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
ProjectForge is a web-based solution for project management including time tracking, team calendar, gantt-charting, financial administration, issue management,
controlling and managing work-break-down-structures (e. g. together with JIRA as issue management system).

== Documentation of Docker (in progress)
== Building and testing docker image locally

=== With built-in data base HsqlDB:
1. Checkout: +
https://github.com/micromata/projectforge.git
2. Build ProjectForge in main directory: +
`docker build -t micromata/projectforge:latest .`
3. Run ProjectForge and enjoy: +
`docker run -t -i -p 127.0.0.1:8080:8080 -v ~/ProjectForgeDocker:/ProjectForge --name projectforge micromata/projectforge`
1. `docker login`
2. `export PF_VERSION=8.0`
3. Build docker test image:
a. `docker buildx build --platform linux/arm64 --build-arg JAR_FILE=projectforge-application-$PF_VERSION.jar -t projectforge:latest-arm64-test \--load .`, or
b. 'docker buildx build --platform linux/amd64 --build-arg JAR_FILE=projectforge-application-$PF_VERSION.jar -t projectforge:latest-amd64-test \--load .'
4. Run: `docker run -t -i -p 127.0.0.1:8080:8080 -v ~/ProjectForgeDocker:/ProjectForge --name projectforge projectforge:latest-arm64-test`
5. Enter docker: `docker exec -it projectforge bash`
6. Restart: `docker start -ai projectforge`

Edit memory settings etc. in `ProjectForge/environment.sh`.

Deleting test container:
1. `docker stop projectforge`
2. `docker rm projectforge`
3. `docker images`
4. `docker rmi <image-id>`

=== With external PostgreSQL
tbd.
Expand All @@ -23,8 +32,12 @@ tbd.
tbd.


== Deploying docker images

Please refer /doc/deployment.adoc for detailed information.


=== FAQ
== FAQ

- *Can't access port 8080?* +
The built-in main `application.properties` defines `server.address=localhost`, therefore this port can't be exported to the host system. The Dockerfile of
Expand Down
23 changes: 0 additions & 23 deletions docker/buildDockerManually.sh

This file was deleted.

4 changes: 2 additions & 2 deletions docker/compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.7"
services:
projectforge-app:
image: kreinhard/projectforge
image: micromata/projectforge
container_name: projectforge-app
restart: always
ports:
Expand All @@ -14,7 +14,7 @@ services:
depends_on:
- projectforge-db
projectforge-db:
image: postgres:12.6
image: postgres:13.9
container_name: projectforge-db
restart: always
ports:
Expand Down
11 changes: 8 additions & 3 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

# https://stackoverflow.com/questions/41451159/how-to-execute-a-script-when-i-terminate-a-docker-container

JAVA_MAIN="org.projectforge.start.ProjectForgeApplication"
APP_NAME="ProjectForge"
JAR_FILE="/app/application.jar"

if ! command -v java &> /dev/null; then
echo "Error: java is not installed or not in PATH"
exit 1
fi

checkStopped() {
pid=$(pgrep -f $JAVA_MAIN)
pid=$(pgrep -f $JAR_FILE)
if [[ -z $pid ]]; then
echo "${APP_NAME} $1"
exit 0
Expand Down Expand Up @@ -66,7 +71,7 @@ if [ -z "$DOCKER_OPTS" ]; then
DOCKER_OPTS="-Ddocker=single"
fi

START="${JAVA_OPTS} -cp app:app/lib/*:/ProjectForge/plugins/* -Dprojectforge.plugins.dir=/ProjectForge/plugins ${DOCKER_OPTS} ${JAVA_MAIN} ${JAVA_ARGS}"
START="${JAVA_OPTS} ${DOCKER_OPTS} -jar $JAR_FILE ${JAVA_ARGS}"
# (projectforge.setup is defined in ProjectForgeApp.)

echo "Starting: java ${START}"
Expand Down
10 changes: 10 additions & 0 deletions docker/environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Set the java options and arguments here for Your docker installation only.

# Increase ProjectForge's memory settings:
#export JAVA_OPTS=-Xms1g -Xmx1g
export JAVA_OPTS=

# Define your optional program arguments here
export JAVA_ARGS=
38 changes: 38 additions & 0 deletions site/_changelogs/changelog-20241223--8-0.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: ProjectForge 8.0 released
date: 2024-12-23
---
:page-liquid:


++++
{% include tag.html tag="improved" %}
++++
- Own CardDav-Implementation for synchronization of contacts (tested with Apple contacts (macOS/iOS), Thunderbird).
- Sipgate interface implemented for synchronization of address.
- Calendar view improved.
- Excel-Export of vacations for all employees, teams and colleagues.
- Birthdaybutler for monthly birthday list.
- Export of timesheets as xlsx.
- Attachments to books added.
- lots of minor improvements.
++++
{% include tag.html tag="fixed" %}
++++
- several bugs fixed.
++++
{% include tag.html tag="admin" %}
++++

++++
{% include tag.html tag="security" %}
++++

++++
{% include tag.html tag="technology" %}
- New major versions: Java 17, Spring 6.1.15, Hibernate 6.6.3, Hibernate search 7.2.1, javax -> jakarta, React/Router, Wicket 10.2, ...
++++

++++
{% include download-link.html %}
++++
24 changes: 12 additions & 12 deletions site/_docs/installation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,28 @@ You may choose now between Docker based installation or normal installation.
Or, as a developer, you may also refer https://github.com/micromata/projectforge/[ProjectForge on GitHub].

=== Docker
You may install ProjectForge as docker image.
You may install ProjectForge as docker image. You may run ProjectForge as docker image since version 8.0
on Linux (amd64 and arm64) as well as on MacOS (Intel or Silicon).

We assume `/home/projectforge/ProjectForge` as ProjectForge's home in this documentation, but you may choose anything else (will be created or should be empty if already exists).

For test or small installations you may use the built-in data base (embedded).
For test or small installations you may use the built-in database (embedded).

==== Running single docker container

1. First start `docker run -t -i -p 127.0.0.1:8080:8080 -v $HOME/ProjectForge:/ProjectForge --name projectforge micromata/projectforge`
2. Follow setup wizard below.
3. Enjoy.
4. Stop ProjectForge by pressing `CTRL-C` or `docker stop projectforge`.

You may monitor the log file: `tail -f ~/ProjectForge/logs/ProjectForge.log`

To stop and start use `docker start/stop projectforge`.

For full functionality of all plugins, you should restart the docker container:

1. `docker stop projectforge`
2. `docker start projectforge`

==== Running as stack (docker-compose)

Expand All @@ -49,20 +55,14 @@ To stop and start user `docker-compose up/down`.

You may monitor the log file: `tail -f ~/ProjectForge/logs/ProjectForge.log`

==== Building docker container from source

1. `git clone [email protected]:micromata/projectforge.git`
2. `cd projectforge`
3. `docker build -t micromata/projectforge:latest .`

==== Increasing memory

Edit `~/ProjectForge/environment.sh` for customizing settings of ProjectForge as environment variables.
For configuring ProjectForge, go to ProjectForge base dir:
1. `projectforge.properties` for customizing settings of ProjectForge.
2. `environment.sh` for customizing settings of Java options (increasing memory size etc.).

=== Java-Installation (without docker)
If you don't want to use Docker, you're able to install ProjectForge from the executable jar file.

1. Install openjdk (java >8 should also work, if needed, 11+ recommended).
1. Install openjdk 17.
2. Get projectForge-application_version.jar
3. First start: java -jar projectForge-application_version.jar

Expand Down

0 comments on commit 6265f31

Please sign in to comment.