Skip to content

Commit

Permalink
fix(docker): update location for entrypoint.sh (#754)
Browse files Browse the repository at this point in the history
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
  • Loading branch information
leninmehedy committed Feb 14, 2024
1 parent 167fb3c commit 7cf02f6
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ spec:
emptyDir: {}
- name: hgcapp-event-streams
emptyDir: {}
- name: hgcapp-services-hedera
- name: hgcapp-data-saved
emptyDir: {}
- name: hgcapp-data-stats
emptyDir: {}
{{- if $otelCollector.enabled }}
- name: otel-collector-volume
Expand All @@ -88,8 +90,10 @@ spec:
mountPath: /opt/hgcapp/recordStreams
- name: hgcapp-event-streams
mountPath: /opt/hgcapp/eventsStreams
- name: hgcapp-services-hedera
mountPath: opt/hgcapp/services-hedera
- name: hgcapp-data-saved
mountPath: opt/hgcapp/services-hedera/HapApp2.0/data/saved
- name: hgcapp-data-stats
mountPath: opt/hgcapp/services-hedera/HapApp2.0/data/stats
env:
{{- include "fullstack.defaultEnvVars" . | nindent 10 }}
{{- if $balanceUploader.enabled }}
Expand Down Expand Up @@ -284,9 +288,10 @@ spec:
securityContext:
{{- include "fullstack.hedera.security.context" . | nindent 10 }}
volumeMounts:
- name: hgcapp-services-hedera
mountPath: opt/hgcapp/services-hedera
subPath: data
- name: hgcapp-data-saved
mountPath: opt/hgcapp/services-hedera/HapiApp2.0/data/saved
- name: hgcapp-data-stats
mountPath: opt/hgcapp/services-hedera/HapiApp2.0/data/stats
env:
- name: BACKUP_UPLOADER_BUCKET_1
value: {{ default $defaults.sidecars.backupUploader.config.backupBucket ($backupUploader.config).backupBucket | quote }}
Expand Down
9 changes: 3 additions & 6 deletions docker/ubi8-init-java17/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,14 @@ RUN mkdir -p "/opt/hgcapp" && \
mkdir -p "/opt/hgcapp/services-hedera/HapiApp2.0/data/upgrade"

# Add the entrypoint script and systemd service file
ADD entrypoint.sh /etc/network-node/
ADD entrypoint.sh /opt/hgcapp/services-hedera/HapiApp2.0/
ADD network-node.service /usr/lib/systemd/system/

# Ensure proper file permissions
RUN chmod -R +x /etc/network-node/entrypoint.sh && \
RUN chmod -R +x /opt/hgcapp/services-hedera/HapiApp2.0/entrypoint.sh && \
touch /opt/hgcapp/services-hedera/HapiApp2.0/application.env && \
chown -R 2000:2000 /opt/hgcapp/

RUN mkdir -p /etc/network-node && \
touch /etc/network-node/application.env && \
chown -R 2000:2000 /etc/network-node

# Expose TCP/UDP Port Definitions
EXPOSE 50111/tcp 50211/tcp 50212/tcp

Expand Down
4 changes: 2 additions & 2 deletions docker/ubi8-init-java17/network-node.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ User=hedera
Group=hedera

PassEnvironment=JAVA_HOME JAVA_OPTS JAVA_HEAP_MIN JAVA_HEAP_MAX PATH APP_HOME
EnvironmentFile=/etc/network-node/application.env
EnvironmentFile=/opt/hgcapp/services-hedera/HapiApp2.0/application.env

WorkingDirectory=/opt/hgcapp/services-hedera/HapiApp2.0
ExecStart=/usr/bin/bash /etc/network-node/entrypoint.sh
ExecStart=/usr/bin/bash /opt/hgcapp/services-hedera/HapiApp2.0/entrypoint.sh

[Install]
WantedBy=multi-user.target
9 changes: 3 additions & 6 deletions docker/ubi8-init-java21/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,14 @@ RUN mkdir -p "/opt/hgcapp" && \
mkdir -p "/opt/hgcapp/services-hedera/HapiApp2.0/data/upgrade"

# Add the entrypoint script and systemd service file
ADD entrypoint.sh /etc/network-node/
ADD entrypoint.sh /opt/hgcapp/services-hedera/HapiApp2.0/
ADD network-node.service /usr/lib/systemd/system/

# Ensure proper file permissions
RUN chmod -R +x /etc/network-node/entrypoint.sh && \
RUN chmod -R +x /opt/hgcapp/services-hedera/HapiApp2.0/entrypoint.sh && \
touch /opt/hgcapp/services-hedera/HapiApp2.0/application.env && \
chown -R 2000:2000 /opt/hgcapp/

RUN mkdir -p /etc/network-node && \
touch /etc/network-node/application.env && \
chown -R 2000:2000 /etc/network-node

# Expose TCP/UDP Port Definitions
EXPOSE 50111/tcp 50211/tcp 50212/tcp

Expand Down
4 changes: 2 additions & 2 deletions docker/ubi8-init-java21/network-node.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ User=hedera
Group=hedera

PassEnvironment=JAVA_HOME JAVA_OPTS JAVA_HEAP_MIN JAVA_HEAP_MAX PATH APP_HOME
EnvironmentFile=/etc/network-node/application.env
EnvironmentFile=/opt/hgcapp/services-hedera/HapiApp2.0/application.env

WorkingDirectory=/opt/hgcapp/services-hedera/HapiApp2.0
ExecStart=/usr/bin/bash /etc/network-node/entrypoint.sh
ExecStart=/usr/bin/bash /opt/hgcapp/services-hedera/HapiApp2.0/entrypoint.sh

[Install]
WantedBy=multi-user.target
21 changes: 16 additions & 5 deletions solo/src/core/platform_installer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,32 @@ export class PlatformInstaller {
this.k8 = k8
}

/**
* Setup directories
* @param podName
* @param containerName
* @return {Promise<boolean>}
*/
async setupHapiDirectories (podName, containerName = constants.ROOT_CONTAINER) {
if (!podName) throw new MissingArgumentError('podName is required')

try {
// reset HAPI_PATH
await this.k8.execContainer(podName, containerName, `rm -rf ${constants.HEDERA_SERVICES_PATH}/HapiApp2.0`)
// reset data directory
await this.k8.execContainer(podName, containerName, `rm -rf ${constants.HEDERA_HAPI_PATH}/data`)

const paths = [
`${constants.HEDERA_HAPI_PATH}/data`,
`${constants.HEDERA_HAPI_PATH}/data/apps`,
`${constants.HEDERA_HAPI_PATH}/data/config`,
`${constants.HEDERA_HAPI_PATH}/data/keys`,
`${constants.HEDERA_HAPI_PATH}/data/config`
`${constants.HEDERA_HAPI_PATH}/data/lib`,
`${constants.HEDERA_HAPI_PATH}/data/stats`,
`${constants.HEDERA_HAPI_PATH}/data/saved`,
`${constants.HEDERA_HAPI_PATH}/data/upgrade`
]

for (const p of paths) {
await this.k8.execContainer(podName, containerName, `mkdir -p ${p}`)
await this.k8.execContainer(podName, containerName, `mkdir ${p}`)
}

await this.setPathPermission(podName, constants.HEDERA_SERVICES_PATH)
Expand Down Expand Up @@ -122,7 +134,6 @@ export class PlatformInstaller {
try {
await this.copyFiles(podName, [extractScriptSrc], constants.HEDERA_USER_HOME_DIR)
await this.k8.execContainer(podName, constants.ROOT_CONTAINER, `chmod +x ${extractScript}`)
await this.setupHapiDirectories(podName)
await this.k8.execContainer(podName, constants.ROOT_CONTAINER, [extractScript, buildZip, constants.HEDERA_HAPI_PATH])

return true
Expand Down

0 comments on commit 7cf02f6

Please sign in to comment.