Fixes for ARM after container is up

This commit is contained in:
Calabro, Brandon
2025-10-10 13:45:19 -05:00
parent a688ae3f04
commit 2b520ccf1c
4 changed files with 48 additions and 22 deletions

View File

@@ -33,9 +33,6 @@ RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# === START: Oracle Client Local Copy ===
# Copy the Oracle Instant Client zip files from the local /downloads folder.
# Ensure you have downloaded these files manually and placed them in the same
# directory as this Dockerfile.
COPY downloads/instantclient-basic-linux-arm64.zip ./
COPY downloads/instantclient-sdk-linux-arm64.zip ./
COPY downloads/instantclient-sqlplus-linux-arm64.zip ./
@@ -51,6 +48,9 @@ RUN unzip -o instantclient-basic-linux-arm64.zip -d /usr/local/ && \
RUN INSTANTCLIENT_DIR=$(find /usr/local/ -name 'instantclient_*' -type d) && mv "${INSTANTCLIENT_DIR}" /usr/local/instantclient
RUN ln -s /usr/local/instantclient/sqlplus /usr/bin/sqlplus
# Make the Oracle JDBC driver available to Ant
RUN cp /usr/local/instantclient/ojdbc8.jar /usr/share/ant/lib/
# Remove the zip files
RUN rm -f instantclient-basic-linux-arm64.zip \
instantclient-sdk-linux-arm64.zip \

View File

@@ -8,9 +8,23 @@ This project sets up a development environment for SWG using Docker.
2. **(Optional)** To use a custom git repository for the server source, create a file named `.env` in this directory. See the "Custom Repository" section below for details.
3. Run `docker compose up -d --build` to build the images and start the services.
4. Run `docker exec -it swg bash` to log into a shell in the `swg` container.
5. Run `ant swg` to compile the game and the assets. You only need to run this once, the first time you build the docker image, or if you destroy the docker volumes.
6. Run `ant start &` to run the server.
7. Run `ant stop` to stop your server.
5. Update the `build.xml` file and fix the task for `set_ubuntu_cfg` so that it pulls the `ARM64` drivers rather than the `Intel` drivers.
Below is the correct configuration:
```build.xml
<target name="set_ubuntu_cfg" if="is_ubuntu18">
<replace dir="${exe}">
<include name="**/*.cfg"/>
<replacefilter token="environmentVariable=PATH+=/usr/java/bin:./" value="environmentVariable=PATH+=/usr/lib/jvm/java-11-openjdk-arm64/bin:./"/>
<replacefilter token="environmentVariable=LD_LIBRARY_PATH+=/usr/java/lib:/usr/java/lib/server:./" value="environmentVariable=LD_LIBRARY_PATH+=/usr/lib/jvm/java-11-openjdk-arm64/lib:/usr/lib/jvm/java-11-openjdk-arm64/lib/server:./"/>
</replace>
</target>
```
6. Run `ant swg` to compile the game and the assets. You only need to run this once, the first time you build the docker image, or if you destroy the docker volumes.
7. Run `ant start &` to run the server.
8. Run `ant stop` to stop your server.
## Connecting your client

View File

@@ -8,11 +8,12 @@ services:
ports:
- "1521:1521"
environment:
ORACLE_PASSWORD: swg
# Use the new complex password for SYS/SYSTEM users
ORACLE_PASSWORD: ${DB_USER_PASSWORD}
APP_USER: ${DB_USER:-swg}
APP_USER_PASSWORD: ${DB_USER_PASSWORD:-swg}
# Use the new complex password for the 'swg' user
APP_USER_PASSWORD: ${DB_USER_PASSWORD}
healthcheck:
# Updated healthcheck to use sqlplus, which exists in this image
test: ["CMD-SHELL", "sqlplus -S / as sysdba <<< \"select status from v\\$$instance;\" | grep -q \"OPEN\""]
interval: 10s
timeout: 30s
@@ -43,8 +44,9 @@ services:
DB_HOST: oracle
DB_PORT: 1521
DB_USER: ${DB_USER:-swg}
ORACLE_PASSWORD: swg
DB_PASSWORD: ${DB_USER_PASSWORD:-swg}
ORACLE_PASSWORD: ${DB_USER_PASSWORD}
# Use the new complex password here as well
DB_PASSWORD: ${DB_USER_PASSWORD}
tty: true
stdin_open: true
volumes:

View File

@@ -1,6 +1,15 @@
#!/bin/sh
# entrypoint.sh
# Create a build.properties file to pass Docker env vars to the Ant build
cat <<EOF > /swg-main/build.properties
# This file is auto-generated by entrypoint.sh
db_username=${DB_USER}
db_password=${DB_PASSWORD}
dbip=${DB_HOST}
db_service=${DB_SERVICE_NAME:-FREEPDB1}
EOF
# Get the container's own IP address at runtime
CONTAINER_IP=$(hostname -i)
@@ -12,24 +21,24 @@ START_MARKER="# BEGIN DOCKER-MANAGED CONFIG"
END_MARKER="# END DOCKER-MANAGED CONFIG"
# 1. Remove the entire block from the start marker to the end marker.
# The -i flag modifies the file in-place.
# On the first run, this command will do nothing if the markers don't exist, which is fine.
sed -i "/${START_MARKER}/,/${END_MARKER}/d" ${CONFIG_FILE}
# 2. Now, append the new, updated configuration block, including the markers.
cat <<EOF >> ${CONFIG_FILE}
${START_MARKER}
# This block is automatically managed by the container's entrypoint script.
# This block is automatically managed by the container's entrypoint.sh script.
# Do not edit it manually, as changes will be overwritten on container restart.
[dbProcess]
DSN=//oracle/FREEPDB1
databaseUID=DBUSERNAME
DSN=//${DB_HOST}/${DB_SERVICE_NAME:-FREEPDB1}
databaseUID=${DB_USER}
databasePWD=${DB_PASSWORD}
centralServerAddress=${CONTAINER_IP}
[LoginServer]
DSN=//oracle/FREEPDB1
databaseUID=DBUSERNAME
DSN=//${DB_HOST}/${DB_SERVICE_NAME:-FREEPDB1}
databaseUID=${DB_USER}
databasePWD=${DB_PASSWORD}
developmentMode=true
useExternalAuth=false
@@ -48,8 +57,8 @@ debugMode=1
[TaskManager]
loginServerAddress=${CONTAINER_IP}
node0=${CONTAINER_IP}
environmentVariable=PATH+=/usr/lib/jvm/java-11-openjdk-i386/bin:./
environmentVariable=LD_LIBRARY_PATH+=/usr/lib/jvm/java-11-openjdk-i386/lib:/usr/lib/jvm/java-11-openjdk-i386/lib/server:./
environmentVariable=PATH+=/usr/lib/jvm/java-11-openjdk-arm64/bin:./
environmentVariable=LD_LIBRARY_PATH+=/usr/lib/jvm/java-11-openjdk-arm64/lib:/usr/lib/jvm/java-11-openjdk-arm64/lib/server:./
${END_MARKER}
EOF
@@ -58,10 +67,11 @@ cd /swg-main
ant update_configs
# Update the cluster_list to use the local host IP address for connections.
/usr/lib/oracle/18.3/client/bin/sqlplus -S ${DB_USER}/${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/FREEPDB1 <<EOT
/usr/local/instantclient/sqlplus -S ${DB_USER}/${DB_PASSWORD}@//${DB_HOST}:${DB_PORT}/${DB_SERVICE_NAME:-FREEPDB1} <<EOT
UPDATE CLUSTER_LIST SET ADDRESS = '127.0.0.1';
COMMIT;
EXIT;
EOT
# This command executes the original CMD from the Dockerfile
exec "$@"
exec "$@"