diff --git a/.github/workflows/build-beta.yml b/.github/workflows/build-beta.yml new file mode 100644 index 0000000..b4136fe --- /dev/null +++ b/.github/workflows/build-beta.yml @@ -0,0 +1,34 @@ +name: Build Beta Container + +on: + push: + branches: + - main + paths: + - "beta/**" + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Codebase + uses: actions/checkout@v2 + + - name: Login to ghcr.io + run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u soup-bowl --password-stdin + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Build Container + uses: docker/build-push-action@v2 + with: + push: true + context: "{{defaultContext}}:build/main" + tags: ghcr.io/soup-bowl/opensimulator-docker:alpine-beta + platforms: linux/amd64 diff --git a/.github/workflows/build.yml b/.github/workflows/build-main.yml similarity index 72% rename from .github/workflows/build.yml rename to .github/workflows/build-main.yml index f41a8ca..fd317c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-main.yml @@ -1,11 +1,11 @@ -name: Build Container +name: Build Main Container on: push: branches: - main paths: - - "opensim/**" + - "build/**" workflow_dispatch: jobs: @@ -35,6 +35,10 @@ jobs: uses: docker/build-push-action@v2 with: push: true - context: "{{defaultContext}}:opensim" - tags: soupbowl/opensimulator:edge,ghcr.io/soup-bowl/opensimulator-docker:edge + context: "{{defaultContext}}:build/main" + tags: > + soupbowl/opensimulator:latest, + soupbowl/opensimulator:edge, + ghcr.io/soup-bowl/opensimulator-docker:latest, + ghcr.io/soup-bowl/opensimulator-docker:edge platforms: linux/amd64,linux/arm64 diff --git a/beta/alpine/Dockerfile b/beta/alpine/Dockerfile new file mode 100644 index 0000000..e22301b --- /dev/null +++ b/beta/alpine/Dockerfile @@ -0,0 +1,30 @@ +FROM alpine:3.16 + +LABEL org.opencontainers.image.title="OpenSimulator (unofficial)" +LABEL org.opencontainers.image.authors="code@soupbowl.io" +LABEL org.opencontainers.image.source="https://github.com/soup-bowl/opensimulator-docker" +LABEL org.opencontainers.image.licenses="MIT" + +RUN apk add --no-cache curl uuidgen screen +RUN apk add --no-cache mono --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing + +RUN mkdir /opt/opensim-tmp \ + && curl http://opensimulator.org/dist/opensim-0.9.2.1.tar.gz | tar xzf - -C /opt/opensim-tmp \ + && rm /opt/opensim-tmp/opensim*/bin/OpenSim.ini \ + && rm /opt/opensim-tmp/opensim*/bin/config-include/StandaloneCommon.ini \ + && mkdir /opt/opensim \ + && mv /opt/opensim-tmp/opensim*/* /opt/opensim + +COPY defaults /opt/opensim/bin/defaults + +EXPOSE 9000 + +# Down the bottom here while dependencies are an ongoing investigation. +RUN apk add --no-cache libgdiplus sqlite sqlite-libs + +WORKDIR /opt/opensim/bin + +COPY docker-entrypoint.sh /usr/local/bin/ + +ENTRYPOINT ["docker-entrypoint.sh"] +CMD [ "mono", "./OpenSim.exe" ] diff --git a/opensim/defaults/OpenSim.ini b/beta/alpine/defaults/OpenSim.ini similarity index 100% rename from opensim/defaults/OpenSim.ini rename to beta/alpine/defaults/OpenSim.ini diff --git a/opensim/defaults/StandaloneCommon.ini b/beta/alpine/defaults/StandaloneCommon.ini similarity index 100% rename from opensim/defaults/StandaloneCommon.ini rename to beta/alpine/defaults/StandaloneCommon.ini diff --git a/beta/alpine/docker-compose.yml b/beta/alpine/docker-compose.yml new file mode 100644 index 0000000..6e907e8 --- /dev/null +++ b/beta/alpine/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3.6' +services: + db: + image: docker.io/library/mariadb:10.5 + volumes: + - "database_store:/var/lib/mysql" + environment: + MYSQL_DATABASE: metaverse + MYSQL_ROOT_PASSWORD: password + metaverse: + build: + context: . + depends_on: + - db + ports: + - "9000:9000" + - "9000:9000/udp" + environment: + DATABASE_ENGINE: mysql + MYSQL_SERVER: db + MYSQL_DATABASE: metaverse + MYSQL_USER: root + MYSQL_PASSWORD: password + +volumes: + database_store: diff --git a/beta/alpine/docker-entrypoint.sh b/beta/alpine/docker-entrypoint.sh new file mode 100755 index 0000000..6e3e555 --- /dev/null +++ b/beta/alpine/docker-entrypoint.sh @@ -0,0 +1,62 @@ +#!/bin/sh +set -Eeo pipefail + +chown -R $(id -u):$(id -g) defaults + +if [ ! -e OpenSim.ini ]; then + echo >&2 "INFO: No OpenSim configuration found, pulling one together." + cp defaults/OpenSim.ini OpenSim.ini + + echo -e "\n[Estates] + DefaultEstateName = ${ESTATE_NAME:-Default Estate} + DefaultEstateOwnerName = ${ESTATE_OWNER_NAME:-Foo Bar} + DefaultEstateOwnerUUID = ${ESTATE_OWNER_UUID:-00000000-0000-0000-0000-000000000000} + DefaultEstateOwnerEMail = ${ESTATE_OWNER_EMAIL:-user@example.com} + DefaultEstateOwnerPassword = ${ESTATE_OWNER_PASSWORD:-password}" >> OpenSim.ini + + if [[ "${DATABASE_ENGINE}" == "mysql" ]]; then + echo -e "\n[Messaging] + StorageProvider = \"OpenSim.Data.MySQL.dll\" + ConectionString = \"Data Source=${MYSQL_SERVER:-db};Database=${MYSQL_DATABASE:-opensim};User ID=${MYSQL_USER:-root};Password=${MYSQL_PASSWORD};Old Guids=true;\"" >> OpenSim.ini + fi +fi + +if [ ! -e config-include/StandaloneCommon.ini ]; then + echo >&2 "INFO: No Grid Common configuration found, pulling one together." + cp defaults/StandaloneCommon.ini config-include/StandaloneCommon.ini + + echo "[DatabaseService]" >> config-include/StandaloneCommon.ini + if [[ "${DATABASE_ENGINE}" == "mysql" ]]; then + echo " StorageProvider = \"OpenSim.Data.MySQL.dll\"" >> config-include/StandaloneCommon.ini + echo " ConnectionString = \"Data Source=${MYSQL_SERVER:-db};Database=${MYSQL_DATABASE:-opensim};User ID=${MYSQL_USER:-root};Password=${MYSQL_PASSWORD};Old Guids=true;\"" >> config-include/StandaloneCommon.ini + else + echo " Include-Storage = \"config-include/storage/SQLiteStandalone.ini\"" >> config-include/StandaloneCommon.ini + fi + + echo "[GridService] + StorageProvider = \"OpenSim.Data.Null.dll:NullRegionData\" + Region_${REGION_NAME:-Region} = \"DefaultRegion, FallbackRegion\" + ExportSupported = true" >> config-include/StandaloneCommon.ini + + if [ -n "${GRID_WELCOME}" ]; then + sed -i -e "s/OpenSimulator is running!/${GRID_WELCOME}/g" config-include/StandaloneCommon.ini + fi + + if [ -n "${GRID_NAME}" ]; then + sed -i -e "s/OpenSimulator Instance/${GRID_NAME}/g" config-include/StandaloneCommon.ini + fi +fi + +if [ `find Regions -maxdepth 1 -name '*.ini' | wc -l` -eq 0 ]; then + echo >&2 "INFO: No region details found, pulling one together." + + echo "[${REGION_NAME:-Region}] + RegionUUID = $(uuidgen) + Location = 1000,1000 + InternalAddress = 0.0.0.0 + InternalPort = 9000 + AllowAlternatePorts = False + ExternalHostName = localhost" >> Regions/Regions.ini +fi + +exec "$@" diff --git a/beta/alpine/readme.md b/beta/alpine/readme.md new file mode 100644 index 0000000..3acc4c0 --- /dev/null +++ b/beta/alpine/readme.md @@ -0,0 +1,46 @@ +# OpenSimulator Alpine Test + +This is a test of the OpenSimulator Docker image [running on an Alpine base](https://hub.docker.com/_/alpine/). + +## For Graduation + +### Pass Verification + +* :heavy_check_mark: - Able to build successfully. +* :x: - Able to run successfully like or close to the main build. +* :x: - Does not depend on beta/alpha packages. + +### Steps for Pass + +* :x: - Mono library leaves testing on the [Alpine package registry](https://pkgs.alpinelinux.org/package/edge/testing/x86_64/mono). +* :x: - Fatal error occurs when SQLite engine is used. + - MySQL engine works fine. + +``` +================================================================= + Native Crash Reporting +================================================================= +Got a SIGSEGV while executing native code. This usually indicates +a fatal error in the mono runtime or one of the native libraries +used by your application. +================================================================= + +================================================================= + Basic Fault Address Reporting +================================================================= +instruction pointer is NULL, skip dumping +================================================================= + Managed Stacktrace: +================================================================= + at <0xffffffff> + at Mono.Data.SqliteClient.Sqlite:sqlite3_open16 <0x000b7> + at Mono.Data.SqliteClient.SqliteConnection:Open <0x001e3> + at OpenSim.Region.UserStatistics.WebStatsModule:PostInitialise <0x000ad> + at OpenSim.ApplicationPlugins.RegionModulesController.RegionModulesControllerPlugin:PostInitialise <0x000c6> + at OpenSim.OpenSimBase:StartupSpecific <0x00806> + at OpenSim.OpenSim:StartupSpecific <0x00387> + at OpenSim.Framework.Servers.BaseOpenSimServer:Startup <0x00212> + at OpenSim.Application:Main <0x01078> + at :runtime_invoke_void_object <0x00091> +================================================================= +``` diff --git a/opensim/Dockerfile b/build/main/Dockerfile similarity index 100% rename from opensim/Dockerfile rename to build/main/Dockerfile diff --git a/build/main/defaults/OpenSim.ini b/build/main/defaults/OpenSim.ini new file mode 100644 index 0000000..06e02e1 --- /dev/null +++ b/build/main/defaults/OpenSim.ini @@ -0,0 +1,39 @@ + +[Const] + BaseHostname = "localhost" + BaseURL = http://${Const|BaseHostname} + PublicPort = "9000" + PrivURL = ${Const|BaseURL} + PrivatePort = "8003" + +[Permissions] + automatic_gods = false + implicit_gods = false + allow_grid_gods = true + +[Network] + http_listener_port = 9000 + ExternalHostNameForLSL = ${Const|BaseHostname} + shard = "OpenSim" + +[ClientStack.LindenCaps] + Cap_GetTexture = "localhost" + Cap_GetMesh = "localhost" + Cap_AvatarPickerSearch = "localhost" + Cap_GetDisplayNames = "localhost" + +[BulletSim] + AvatarToAvatarCollisionsByDefault = true + +[XEngine] + AppDomainLoading = false + DeleteScriptsOnStartup = false + +[OSSL] + Include-osslDefaultEnable = "config-include/osslDefaultEnable.ini" + +[Architecture] + Include-Architecture = "config-include/Standalone.ini" + +[WebStats] + enabled = true diff --git a/build/main/defaults/StandaloneCommon.ini b/build/main/defaults/StandaloneCommon.ini new file mode 100644 index 0000000..b9e9fc5 --- /dev/null +++ b/build/main/defaults/StandaloneCommon.ini @@ -0,0 +1,43 @@ +; This is the main configuration file for an instance of OpenSim running in standalone mode + +[Hypergrid] + HomeURI = "${Const|BaseURL}:${Const|PublicPort}" + +[Modules] + AssetCaching = "FlotsamAssetCache" + Include-FlotsamCache = "config-include/FlotsamCache.ini" + +[AssetService] + DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" + AssetLoaderArgs = "assets/AssetSets.xml" + +[LibraryModule] + LibraryName = "Library" + +[LoginService] + WelcomeMessage = "OpenSimulator is running!" + SRV_HomeURI = "${Hypergrid|HomeURI}" + SRV_InventoryServerURI = "${Const|BaseURL}:${Const|PublicPort}" + SRV_AssetServerURI = "${Const|BaseURL}:${Const|PublicPort}" + SRV_ProfileServerURI = "${Const|BaseURL}:${Const|PublicPort}" + SRV_FriendsServerURI = "${Const|BaseURL}:${Const|PublicPort}" + SRV_IMServerURI = "${Const|BaseURL}:${Const|PublicPort}" + MapTileURL = "${Const|BaseURL}:${Const|PublicPort}/" + +[GridInfoService] + login = ${Const|BaseURL}:${Const|PublicPort}/ + gridname = "OpenSimulator Instance" + gridnick = "osss" + welcome = ${Const|BaseURL}:8080 + +[GatekeeperService] + AllowTeleportsToAnyRegion = true + +[EntityTransfer] + AccountForAppearance = "Test User, Astronaut Smith" + +[UserProfilesService] + Enabled = false + LocalServiceModule = "OpenSim.Services.UserProfilesService.dll:UserProfilesService" + UserAccountService = OpenSim.Services.UserAccountService.dll:UserAccountService + AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" diff --git a/opensim/docker-entrypoint.sh b/build/main/docker-entrypoint.sh similarity index 100% rename from opensim/docker-entrypoint.sh rename to build/main/docker-entrypoint.sh