Skip to content

Commit d1add33

Browse files
committed
feat: changed container work dir from app to opt (#684)
Signed-off-by: Alex Kehayov <[email protected]>
1 parent 0588067 commit d1add33

File tree

15 files changed

+49
-41
lines changed

15 files changed

+49
-41
lines changed

block-node/app/docker/Dockerfile

+7-7
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ RUN groupadd --gid 2000 hedera && \
7171
ARG VERSION
7272

7373
# Set the working directory inside the container
74-
WORKDIR /app
74+
WORKDIR /opt/hiero/block-node
7575

7676
# Copy Distribution TAR file
7777
# Ignore Codacy, the `distributions` context is set on command line and
@@ -82,15 +82,15 @@ COPY --from=distributions block-node-app-${VERSION}.tar .
8282
RUN tar -xvf block-node-app-${VERSION}.tar
8383

8484
# Create a log directory
85-
RUN mkdir -p /app/logs/config
85+
RUN mkdir -p /opt/hiero/block-node/logs/config
8686

8787
# Copy the logging properties file
88-
COPY logging.properties /app/logs/config/logging.properties
88+
COPY logging.properties /opt/hiero/block-node/logs/config/logging.properties
8989

9090
WORKDIR /
9191

9292
# Ensure proper file permissions
93-
RUN chown -R 2000:2000 /app /opt
93+
RUN chown -R 2000:2000 /opt/hiero/block-node
9494

9595
########################################
9696
#### Deterministic Build Hack ####
@@ -138,12 +138,12 @@ COPY --from=java-builder ${JAVA_HOME}/ ${JAVA_HOME}/
138138
EXPOSE 8080/tcp
139139

140140
USER hedera
141-
WORKDIR /app
141+
WORKDIR /opt/hiero/block-node
142142

143143
# HEALTHCHECK for liveness and readiness
144144
HEALTHCHECK --interval=30s --timeout=10s --start-period=3s --retries=3 \
145145
CMD curl -f http://localhost:8080/healthz/livez || exit 1 && \
146146
curl -f http://localhost:8080/healthz/readyz || exit 1
147147

148-
# RUN the bin script for starting the server app
149-
ENTRYPOINT ["/bin/bash", "-c", "/app/block-node-app-${VERSION}/bin/block-node-app"]
148+
# RUN the bin script for starting the server
149+
ENTRYPOINT ["/bin/bash", "-c", "/opt/hiero/block-node/block-node-app-${VERSION}/bin/block-node-app"]

block-node/app/docker/docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
container_name: block-node-server
44
image: block-node-server:${VERSION}
55
volumes:
6-
- ./logging.properties:/app/logs/config/logging.properties
6+
- ./logging.properties:/opt/hiero/block-node/logs/config/logging.properties
77
env_file:
88
- .env
99
ports:

block-node/app/docker/logging.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
6363
# FileHandler properties
6464
################################################################################
6565
# The pattern for the output file name.
66-
java.util.logging.FileHandler.pattern = /app/logs/blocknode-%g.log
66+
java.util.logging.FileHandler.pattern = /opt/hiero/block-node/logs/blocknode-%g.log
6767
# Set append to true if you want to keep appending to existing files
6868
java.util.logging.FileHandler.append = true
6969
# The limit in bytes before a new file is started.

block-node/app/docker/update-env.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ project_version=$1
1818
echo "VERSION=$project_version" > .env
1919
echo "REGISTRY_PREFIX=" >> .env
2020
# Storage root path, this is temporary until we have a proper .properties file for all configs
21-
echo "BLOCKNODE_STORAGE_ROOT_PATH=/app/storage" >> .env
21+
echo "BLOCKNODE_STORAGE_ROOT_PATH=/opt/hiero/block-node/storage" >> .env
2222

2323
if [ true = "$is_smoke_test" ]; then
2424
# add smoke test variables
@@ -33,11 +33,11 @@ fi
3333
if [ true = "$is_debug" ]; then
3434
# The server will wait for the debugger to attach on port 5005
3535
# JProfiler can attach on port 8849
36-
echo "JAVA_TOOL_OPTIONS='-Djava.util.logging.config.file=/app/logs/config/logging.properties -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005' -agentpath:/path/to/libjprofilerti.so=port=8849 " >> .env
36+
echo "JAVA_TOOL_OPTIONS='-Djava.util.logging.config.file=/opt/hiero/block-node/logs/config/logging.properties -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005' -agentpath:/path/to/libjprofilerti.so=port=8849 " >> .env
3737
else
3838
# we set normally the JAVA_TOOL_OPTIONS
3939
# file is mounted in the docker-compose.yml, changes to the file will be reflected in the container by simply restarting it
40-
echo "JAVA_TOOL_OPTIONS='-Djava.util.logging.config.file=/app/logs/config/logging.properties '" >> .env
40+
echo "JAVA_TOOL_OPTIONS='-Djava.util.logging.config.file=/opt/hiero/block-node/logs/config/logging.properties '" >> .env
4141
fi
4242
# Output the values
4343
echo ".env properties:"

block-node/block-providers/files.historic/src/main/java/org/hiero/block/node/blocks/files/historic/FilesHistoricConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
@ConfigData("files.historic")
2626
public record FilesHistoricConfig(
27-
@Loggable @ConfigProperty(defaultValue = "/opt/hashgraph/blocknode/data/historic") Path rootPath,
27+
@Loggable @ConfigProperty(defaultValue = "/opt/hiero/block-node/data/historic") Path rootPath,
2828
@Loggable @ConfigProperty(defaultValue = "ZSTD") CompressionType compression,
2929
@Loggable @ConfigProperty(defaultValue = "4") @Min(1) @Max(6) int powersOfTenPerZipFileContents) {
3030
/**

block-node/block-providers/files.historic/src/test/java/org/hiero/block/node/blocks/files/historic/FilesHistoricConfigTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class FilesHistoricConfigTest {
3939
@BeforeEach
4040
void setup() {
4141
jimfs = Jimfs.newFileSystem(Configuration.unix());
42-
defaultRootPath = jimfs.getPath("/opt/hashgraph/blocknode/data/historic");
42+
defaultRootPath = jimfs.getPath("/opt/hiero/block-node/data/historic");
4343
defaultCompression = CompressionType.ZSTD;
4444
powersOfTenPerZipFileContents = 4;
4545
}

block-node/block-providers/files.recent/src/main/java/org/hiero/block/node/blocks/files/recent/FilesRecentConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
@ConfigData("files.recent")
2222
public record FilesRecentConfig(
23-
@Loggable @ConfigProperty(defaultValue = "/opt/hashgraph/blocknode/data/live") Path liveRootPath,
23+
@Loggable @ConfigProperty(defaultValue = "/opt/hiero/block-node/data/live") Path liveRootPath,
2424
@Loggable @ConfigProperty(defaultValue = "ZSTD") CompressionType compression,
2525
@Loggable @ConfigProperty(defaultValue = "3") int maxFilesPerDir) {
2626
/**

charts/block-node-server/README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,15 @@ There are several ways to configure the Hiero Block Node. The following is the m
6565
1. Create an override values file, `values.yaml`:
6666
2. Add the necessary environment configuration variables to the following section:
6767

68-
```yaml
69-
blockNode:
70-
config:
71-
# Add any additional env configuration here
72-
# key: value
73-
BLOCKNODE_STORAGE_ROOT_PATH: "/app/storage"
68+
```yaml
69+
blockNode:
70+
config:
71+
# Add any additional env configuration here
72+
# key: value
73+
BLOCKNODE_STORAGE_ROOT_PATH: "/opt/hiero/block-node/storage"
74+
75+
```
7476

75-
```
7677
3. Secrets should be set at the following structure:
7778

7879
```yaml

charts/block-node-server/templates/deployment.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ spec:
3333
- name: logging-config
3434
configMap:
3535
name: {{ include "hiero-block-node.fullname" . }}-logging-config
36+
- name: logging-storage
3637
- name: archive-storage
3738
persistentVolumeClaim:
3839
claimName: {{ if .Values.blockNode.persistence.archive.create }}{{ include "hiero-block-node.fullname" . }}-archive{{ else }}{{ .Values.blockNode.persistence.archive.existingClaim }}{{ end }}
@@ -59,6 +60,8 @@ spec:
5960
mountPath: /live-pvc
6061
- name: archive-storage
6162
mountPath: /archive-pvc
63+
- name: logging-storage
64+
mountPath: /opt/hiero/block-node/logs
6265
containers:
6366
- name: {{ .Chart.Name }}
6467
securityContext:
@@ -79,8 +82,10 @@ spec:
7982
name: {{ include "hiero-block-node.fullname" . }}-secret
8083
volumeMounts:
8184
- name: logging-config
82-
mountPath: /app/logs/config
85+
mountPath: /opt/hiero/block-node/logs/config
8386
readOnly: true
87+
- name: logging-storage
88+
mountPath: /opt/hiero/block-node/logs
8489
- name: archive-storage
8590
mountPath: {{ .Values.blockNode.persistence.archive.mountPath }}
8691
subPath: {{ .Values.blockNode.persistence.archive.subPath }}

charts/block-node-server/values-overrides/mini.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ resources:
1111

1212
blockNode:
1313
config:
14-
JAVA_TOOL_OPTIONS: "-Djava.util.logging.config.file=/app/logs/config/logging.properties"
14+
JAVA_TOOL_OPTIONS: "-Djava.util.logging.config.file=/opt/hiero/block-node/logs/config/logging.properties"
1515
JAVA_OPTS: "-Xms5G -Xmx5G"
1616
MEDIATOR_RING_BUFFER_SIZE: "2048"
1717
persistence:

charts/block-node-server/values.yaml

+6-5
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ blockNode:
7373
config:
7474
# Add any additional env configuration here
7575
# key: value
76-
JAVA_TOOL_OPTIONS: "-Djava.util.logging.config.file=/app/logs/config/logging.properties"
76+
JAVA_TOOL_OPTIONS: "-Djava.util.logging.config.file=/opt/hiero/block-node/logs/config/logging.properties"
7777
JAVA_OPTS: "-Xms16G -Xmx16G"
7878
# PRODUCER_TYPE: "NO_OP"
7979
# PERSISTENCE_STORAGE_TYPE: "NO_OP"
@@ -90,7 +90,7 @@ blockNode:
9090
subPath: "archive-data"
9191
# If create is true, the following values are used to create the PVC
9292
# should match PERSISTENCE_STORAGE_ARCHIVE_ROOT_PATH, leave as is for default.
93-
mountPath: "/opt/hashgraph/blocknode/data/historic"
93+
mountPath: "/opt/hiero/block-node/data/historic"
9494
size: 800Gi
9595
# Optionally add a storage class name if needed
9696
# storageClass: "your-storage-class"
@@ -103,15 +103,15 @@ blockNode:
103103
subPath: "live-data"
104104
# If create is true, the following values are used to create the PVC
105105
# should match PERSISTENCE_STORAGE_LIVE_ROOT_PATH, leave as is for default.
106-
mountPath: "/opt/hashgraph/blocknode/data/live"
106+
mountPath: "/opt/hiero/block-node/data/live"
107107
size: 20Gi
108108
# Optionally add a storage class name if needed
109109
# storageClass: "your-storage-class"
110110
unverified:
111111
# unverified does a hard-coded emptyDir and is ephemeral, however needs to be mounted
112112
# this does not create a PVC.
113113
# should match PERSISTENCE_STORAGE_UNVERIFIED_ROOT_PATH, leave as is for default.
114-
mountPath: "/opt/hashgraph/blocknode/data/unverified"
114+
mountPath: "/opt/hiero/block-node/data/unverified"
115115
secret:
116116
PRIVATE_KEY: "fake_private_key"
117117
health:
@@ -135,7 +135,7 @@ blockNode:
135135
handlers: "java.util.logging.ConsoleHandler, java.util.logging.FileHandler"
136136
java.util.logging.ConsoleHandler.level: "FINE"
137137
java.util.logging.ConsoleHandler.formatter: "java.util.logging.SimpleFormatter"
138-
java.util.logging.FileHandler.pattern: "/app/logs/blocknode-%g.log"
138+
java.util.logging.FileHandler.pattern: "/opt/hiero/block-node/logs/blocknode-%g.log"
139139
java.util.logging.FileHandler.append: "true"
140140
java.util.logging.FileHandler.limit: "5_000_000"
141141
java.util.logging.FileHandler.count: "5"
@@ -153,6 +153,7 @@ blockNode:
153153
# %5$ - log message
154154
# %6$ - throwable trace
155155
java.util.logging.SimpleFormatter.format: "%TF %<TT.%<TL%<Tz %4$-7s [%2$s] %5$s%6$s%n"
156+
mountPath: "/opt/hiero/block-node/logs"
156157

157158
kubepromstack:
158159
enabled: true

simulator/docker/Dockerfile

+10-9
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ ARG UID=2000
66
ARG GID=2000
77
RUN groupadd --gid $GID $UNAME
88
RUN useradd --no-user-group --create-home --uid $UID --gid $GID --shell /bin/bash hedera
9-
WORKDIR /app
9+
WORKDIR /opt/hiero/block-node
1010

1111
# Copy the distribution and resources
1212
COPY simulator-*.tar ./simulator.tar
1313

14-
RUN mkdir -p /app/logs/config
15-
COPY logging.properties /app/logs/config/logging.properties
14+
RUN mkdir -p /opt/hiero/block-node/logs/config
15+
COPY logging.properties /opt/hiero/block-node/logs/config/logging.properties
1616

1717
# Create resources directory and copy block data
1818
RUN mkdir -p src/main/resources
@@ -24,17 +24,18 @@ RUN tar -xf simulator.tar && \
2424
cd src/main/resources && \
2525
tar -xzf block-0.0.3.tar.gz && \
2626
rm block-0.0.3.tar.gz && \
27-
cd /app
27+
cd /opt/hiero/block-node && \
28+
chown -R $UNAME:$UNAME /opt/hiero/block-node
2829

29-
RUN mkdir -p /opt/simulator/data
30-
RUN chown -R $UID:$GID /app /opt/simulator/data
30+
RUN mkdir -p /opt/hiero/block-node/simulator/data
31+
RUN chown -R $UID:$GID /opt/hiero/block-node/simulator/data
3132

3233
# Switch to non-root user
3334
USER $UNAME
3435

3536
# Run the simulator using the extracted directory name
3637
RUN SIMULATOR_DIR=$(ls -d simulator-*/) && \
37-
echo "#!/bin/bash\n/app/${SIMULATOR_DIR}bin/simulator" > /app/start.sh && \
38-
chmod +x /app/start.sh
38+
echo "#!/bin/bash\n/opt/hiero/block-node/${SIMULATOR_DIR}bin/simulator" > /opt/hiero/block-node/start.sh && \
39+
chmod +x /opt/hiero/block-node/start.sh
3940

40-
ENTRYPOINT ["/app/start.sh"]
41+
ENTRYPOINT ["/opt/hiero/block-node/start.sh"]

simulator/docker/update-env.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ CONSUMER_BLOCK_STREAM_SIMULATOR_MODE=CONSUMER
1919
CONSUMER_PROMETHEUS_ENDPOINT_PORT_NUMBER=9997
2020
EOL
2121

22-
logging_config_file_arg="-Djava.util.logging.config.file=/app/logs/config/logging.properties"
22+
logging_config_file_arg="-Djava.util.logging.config.file=/opt/hiero/block-node/logs/config/logging.properties"
2323
debug_arg="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5006"
2424
# determine if we should include debug opts
2525
[ "$1" = true ] && is_debug=true || is_debug=false

simulator/src/main/resources/logging.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
3636
# FileHandler properties
3737
################################################################################
3838
# The pattern for the output file name.
39-
java.util.logging.FileHandler.pattern = /app/logs/blocknode-%g.log
39+
java.util.logging.FileHandler.pattern = /opt/hiero/block-node/logs/blocknode-%g.log
4040
# Set append to true if you want to keep appending to existing files
4141
java.util.logging.FileHandler.append = true
4242
# The limit in bytes before a new file is started.

suites/src/main/java/org/hiero/block/suites/persistence/positive/PositiveDataPersistenceTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
@DisplayName("Positive Data Persistence Tests")
2424
public class PositiveDataPersistenceTests extends BaseSuite {
2525
private final String[] GET_BLOCKS_COMMAND =
26-
new String[] {"find", "../opt/hashgraph/blocknode/data/live", "-mindepth", "5", "-maxdepth", "7"};
26+
new String[] {"find", "/opt/hiero/block-node/data/live", "-mindepth", "5", "-maxdepth", "7"};
2727

2828
private Future<?> simulatorThread;
2929

0 commit comments

Comments
 (0)