Skip to content

Commit

Permalink
Merge pull request #1859 from tgstation/DeploymentsTelemetry
Browse files Browse the repository at this point in the history
Version Telemetry, Update Webpanel
  • Loading branch information
Cyberboss authored Aug 16, 2024
2 parents 7a66748 + 182d0f5 commit bfe28ca
Show file tree
Hide file tree
Showing 29 changed files with 769 additions and 80 deletions.
2 changes: 2 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ You can of course, as always, ask for help at [#coderbus](irc://irc.rizon.net/co

You need the .NET 8.0 SDK, node>=v20, and npm>=v5.7 (in your PATH) to compile the server. On Linux, you also need the `libgdiplus` package installed to generate icons.

You need to run `corepack enable` to configure node to correctly build the webpanel.

The recommended IDE is Visual Studio 2022 or VSCode.

In order to build the service version and/or the Windows installer you need a to run on Windows.
Expand Down
160 changes: 150 additions & 10 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ env:
OD_MIN_COMPAT_DOTNET_VERSION: 7
OD_DOTNET_VERSION: 8
TGS_DOTNET_QUALITY: ga
TGS_WEBPANEL_NODE_VERSION: 20.x
TGS_TEST_GITHUB_TOKEN: ${{ secrets.LIVE_TESTS_TOKEN }}
TGS_RELEASE_NOTES_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
PACKAGING_PRIVATE_KEY_PASSPHRASE: ${{ secrets.PACKAGING_PRIVATE_KEY_PASSPHRASE }}
Expand All @@ -52,6 +53,8 @@ jobs:
permissions:
security-events: write
actions: read
env:
TGS_TELEMETRY_KEY_FILE: /tmp/tgs_telemetry_key.txt
steps:
- name: Setup dotnet
uses: actions/setup-dotnet@v4
Expand All @@ -74,9 +77,16 @@ jobs:
with:
languages: csharp

- name: Setup Telemetry Key File
run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Build
run: dotnet build -c ReleaseNoWindows -p:TGS_HOST_NO_WEBPANEL=true

- name: Delete Telemetry Key File
if: always()
run: rm ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
Expand Down Expand Up @@ -356,6 +366,8 @@ jobs:
docker-build:
name: Build Docker Image
runs-on: ubuntu-latest
env:
TGS_TELEMETRY_KEY_FILE: tgs_telemetry_key.txt
steps:
- name: Checkout (Branch)
uses: actions/checkout@v4
Expand All @@ -367,8 +379,16 @@ jobs:
with:
ref: "refs/pull/${{ github.event.inputs.pull_request_number }}/merge"

- name: Setup Telemetry Key File
shell: bash
run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Build Docker Image
run: docker build . -f build/Dockerfile
run: docker build . -f build/Dockerfile --build-arg TGS_TELEMETRY_KEY_FILE=${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Delete Telemetry Key File
if: always()
run: rm ${{ env.TGS_TELEMETRY_KEY_FILE }}

linux-unit-tests:
name: Linux Tests
Expand All @@ -379,6 +399,7 @@ jobs:
env:
TGS_TEST_DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
TGS_TEST_IRC_CONNECTION_STRING: ${{ secrets.IRC_CONNECTION_STRING }}
TGS_TELEMETRY_KEY_FILE: /tmp/tgs_telemetry_key.txt
runs-on: ubuntu-latest
steps:
- name: Install x86 libc Dependencies
Expand All @@ -393,6 +414,11 @@ jobs:
dotnet-version: '${{ env.TGS_DOTNET_VERSION }}.0.x'
dotnet-quality: ${{ env.TGS_DOTNET_QUALITY }}

- name: Setup Node.JS
uses: actions/setup-node@v4
with:
node-version: ${{ env.TGS_WEBPANEL_NODE_VERSION }}

- name: Checkout (Branch)
uses: actions/checkout@v4
if: github.event_name == 'push' || github.event_name == 'schedule'
Expand All @@ -406,9 +432,19 @@ jobs:
- name: Restore
run: dotnet restore

- name: Enable Corepack
run: corepack enable

- name: Setup Telemetry Key File
run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Build
run: dotnet build -c ${{ matrix.configuration }}NoWindows

- name: Delete Telemetry Key File
if: always()
run: rm ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Cache BYOND .zips
uses: actions/cache@v4
id: cache-byond
Expand All @@ -434,6 +470,7 @@ jobs:
env:
TGS_TEST_DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
TGS_TEST_IRC_CONNECTION_STRING: ${{ secrets.IRC_CONNECTION_STRING }}
TGS_TELEMETRY_KEY_FILE: C:/tgs_telemetry_key.txt
runs-on: windows-latest
steps:
- name: Setup dotnet
Expand All @@ -442,6 +479,11 @@ jobs:
dotnet-version: '${{ env.TGS_DOTNET_VERSION }}.0.x'
dotnet-quality: ${{ env.TGS_DOTNET_QUALITY }}

- name: Setup Node.JS
uses: actions/setup-node@v4
with:
node-version: ${{ env.TGS_WEBPANEL_NODE_VERSION }}

- name: Checkout (Branch)
uses: actions/checkout@v4
if: github.event_name == 'push' || github.event_name == 'schedule'
Expand All @@ -455,9 +497,21 @@ jobs:
- name: Restore
run: dotnet restore

- name: Enable Corepack
run: corepack enable

- name: Setup Telemetry Key File
shell: bash
run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Build
run: dotnet build -c ${{ matrix.configuration }}NoWix

- name: Delete Telemetry Key File
shell: bash
if: always()
run: rm ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Cache BYOND .zips
uses: actions/cache@v4
id: cache-byond
Expand All @@ -483,6 +537,8 @@ jobs:
database-type: [ 'SqlServer', 'Sqlite', 'PostgresSql', 'MariaDB', 'MySql' ]
watchdog-type: [ 'Basic', 'Advanced' ]
configuration: [ 'Debug', 'Release' ]
env:
TGS_TELEMETRY_KEY_FILE: C:/tgs_telemetry_key.txt
runs-on: windows-latest
steps:
- name: Wait for LocalDB Connection # Do this first because we don't want to find out it's failing later
Expand All @@ -501,6 +557,11 @@ jobs:
${{ env.OD_MIN_COMPAT_DOTNET_VERSION }}.0.x
dotnet-quality: ${{ env.TGS_DOTNET_QUALITY }}

- name: Setup Node.JS
uses: actions/setup-node@v4
with:
node-version: ${{ env.TGS_WEBPANEL_NODE_VERSION }}

- name: Set TGS_TEST_DUMP_API_SPEC
if: ${{ matrix.configuration == 'Release' && matrix.watchdog-type == 'Advanced' && matrix.database-type == 'SqlServer' }}
run: echo "TGS_TEST_DUMP_API_SPEC=yes" >> $Env:GITHUB_ENV
Expand Down Expand Up @@ -570,9 +631,21 @@ jobs:
- name: Restore
run: dotnet restore

- name: Enable Corepack
run: corepack enable

- name: Setup Telemetry Key File
shell: bash
run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Build
run: dotnet build -c ${{ matrix.configuration }} tests/Tgstation.Server.Tests/Tgstation.Server.Tests.csproj

- name: Delete Telemetry Key File
shell: bash
if: always()
run: rm ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Cache BYOND .zips
uses: actions/cache@v4
id: cache-byond
Expand Down Expand Up @@ -713,6 +786,8 @@ jobs:
database-type: [ 'Sqlite', 'PostgresSql', 'MariaDB', 'MySql' ]
watchdog-type: [ 'Basic', 'Advanced' ]
configuration: [ 'Debug', 'Release' ]
env:
TGS_TELEMETRY_KEY_FILE: /tmp/tgs_telemetry_key.txt
runs-on: ubuntu-latest
steps:
- name: Disable ptrace_scope
Expand All @@ -733,6 +808,11 @@ jobs:
${{ env.OD_MIN_COMPAT_DOTNET_VERSION }}.0.x
dotnet-quality: ${{ env.TGS_DOTNET_QUALITY }}

- name: Setup Node.JS
uses: actions/setup-node@v4
with:
node-version: ${{ env.TGS_WEBPANEL_NODE_VERSION }}

- name: Set Sqlite Connection Info
if: ${{ matrix.database-type == 'Sqlite' }}
run: |
Expand Down Expand Up @@ -775,9 +855,19 @@ jobs:
- name: Restore
run: dotnet restore

- name: Enable Corepack
run: corepack enable

- name: Setup Telemetry Key File
run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Build
run: dotnet build -c ${{ matrix.configuration }}NoWindows tests/Tgstation.Server.Tests/Tgstation.Server.Tests.csproj

- name: Delete Telemetry Key File
if: always()
run: rm ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Cache BYOND .zips
uses: actions/cache@v4
id: cache-byond
Expand Down Expand Up @@ -1117,12 +1207,14 @@ jobs:
build-deb:
name: Build .deb Package # Can't do i386 due to https://github.com/dotnet/core/issues/4595
runs-on: ubuntu-latest
env:
TGS_TELEMETRY_KEY_FILE: /tmp/tgs_telemetry_key.txt
steps:
- name: Install Native Dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y -o APT::Immediate-Configure=0 libstdc++6:i386 libgcc-s1:i386 gnupg2 xmlstarlet libgdiplus
sudo apt-get install -y -o APT::Immediate-Configure=0 libstdc++6:i386 libgcc-s1:i386
- name: Import GPG Key
if: (github.event_name == 'push' && contains(github.event.head_commit.message, '[TGSDeploy]') && (github.event.ref == 'refs/heads/master' || github.event.ref == 'refs/heads/dev'))
Expand Down Expand Up @@ -1160,27 +1252,37 @@ jobs:
with:
ref: "refs/pull/${{ github.event.inputs.pull_request_number }}/merge"

- name: Parse TGS version
run: |
echo "TGS_VERSION=$(xmlstarlet sel -N X="http://schemas.microsoft.com/developer/msbuild/2003" --template --value-of /X:Project/X:PropertyGroup/X:TgsCoreVersion build/Version.props)" >> $GITHUB_ENV
- name: Grab Most Recent Changelog
run: curl -L https://raw.githubusercontent.com/tgstation/tgstation-server/gh-pages/changelog.yml -o changelog.yml

- name: Setup Telemetry Key File
run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Execute Build Script (Unsigned)
if: (!(github.event_name == 'push' && contains(github.event.head_commit.message, '[TGSDeploy]') && (github.event.ref == 'refs/heads/master' || github.event.ref == 'refs/heads/dev')))
if: (!(github.event_name == 'push' && contains(github.event.head_commit.message, '[TGSDeploy]') && github.event.ref == 'refs/heads/master'))
run: sudo -E build/package/deb/build_package.sh

- name: Execute Build Script (Signed)
if: (github.event_name == 'push' && contains(github.event.head_commit.message, '[TGSDeploy]') && (github.event.ref == 'refs/heads/master' || github.event.ref == 'refs/heads/dev'))
if: (github.event_name == 'push' && contains(github.event.head_commit.message, '[TGSDeploy]') && github.event.ref == 'refs/heads/master')
env:
PACKAGING_KEYGRIP: ${{ vars.PACKAGING_KEYGRIP }}
run: sudo -E build/package/deb/build_package.sh

- name: Parse TGS version
run: |
sudo -E build/package/deb/build_package.sh
echo "TGS_VERSION=$(xmlstarlet sel -N X="http://schemas.microsoft.com/developer/msbuild/2003" --template --value-of /X:Project/X:PropertyGroup/X:TgsCoreVersion build/Version.props)" >> $GITHUB_ENV
- name: Verify Package Files are Signed
if: (github.event_name == 'push' && contains(github.event.head_commit.message, '[TGSDeploy]') && github.event.ref == 'refs/heads/master')
run:
gpg --verify tgstation-server_${{ env.TGS_VERSION }}-1.dsc
gpg --verify tgstation-server_${{ env.TGS_VERSION }}-1_amd64.changes
gpg --verify tgstation-server_${{ env.TGS_VERSION }}-1_amd64.buildinfo

- name: Delete Telemetry Key File
if: always()
run: rm ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Test Install
run: |
sudo mkdir /etc/tgstation-server
Expand Down Expand Up @@ -1219,6 +1321,8 @@ jobs:
build-msi:
name: Build Windows Installer .exe
runs-on: windows-latest
env:
TGS_TELEMETRY_KEY_FILE: C:/tgs_telemetry_key.txt
steps:
- name: Install winget
uses: Cyberboss/install-winget@v1
Expand All @@ -1231,6 +1335,11 @@ jobs:
dotnet-version: '${{ env.TGS_DOTNET_VERSION }}.0.x'
dotnet-quality: ${{ env.TGS_DOTNET_QUALITY }}

- name: Setup Node.JS
uses: actions/setup-node@v4
with:
node-version: ${{ env.TGS_WEBPANEL_NODE_VERSION }}

- name: Checkout (Branch)
uses: actions/checkout@v4
if: github.event_name == 'push' || github.event_name == 'schedule'
Expand All @@ -1252,9 +1361,21 @@ jobs:
- name: Restore
run: dotnet restore

- name: Enable Corepack
run: corepack enable

- name: Setup Telemetry Key File
shell: bash
run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Build Host
run: dotnet build -c Release src/Tgstation.Server.Host/Tgstation.Server.Host.csproj

- name: Delete Telemetry Key File
shell: bash
if: always()
run: rm ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Build Service
run: dotnet build -c Release src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj

Expand Down Expand Up @@ -1620,13 +1741,20 @@ jobs:
needs: [deploy-dm, deploy-http, deployment-gate]
runs-on: windows-latest
if: github.event.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[TGSDeploy]')
env:
TGS_TELEMETRY_KEY_FILE: C:/tgs_telemetry_key.txt
steps:
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '${{ env.TGS_DOTNET_VERSION }}.0.x'
dotnet-quality: ${{ env.TGS_DOTNET_QUALITY }}

- name: Setup Node.JS
uses: actions/setup-node@v4
with:
node-version: ${{ env.TGS_WEBPANEL_NODE_VERSION }}

- name: Checkout
uses: actions/checkout@v4

Expand All @@ -1638,9 +1766,21 @@ jobs:
cd build/package/winget
dotnet tool restore
- name: Build Host # We need to rebuild the installer.exe so it can be properly signed
- name: Enable Corepack
run: corepack enable

- name: Setup Telemetry Key File
shell: bash
run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Build Host # We need to rebuild the installer.exe so it can be properly signed
run: dotnet build -c Release src/Tgstation.Server.Host/Tgstation.Server.Host.csproj

- name: Delete Telemetry Key File
shell: bash
if: always()
run: rm ${{ env.TGS_TELEMETRY_KEY_FILE }}

- name: Build Service
run: dotnet build -c Release src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@ The following providers use the `ServerUrl` setting:
- Keycloak
- InvisionCommunity

- `Telemetry:DisableVersionReporting`: Prevents you installation and the version you're using from being reported on the source repository's deployments list

- `Telemetry:ServerFriendlyName`: Prevents anonymous TGS version usage statistics from being sent to be displayed on the repository.

- `Telemetry:VersionReportingRepositoryId`: The repository telemetry is sent to. For security reasons, this is not the main TGS repo. See the [tgstation-server-deployments](https://github.com/tgstation/tgstation-server-deployments) repository for more information.

### Database Configuration

If using a MariaDB/MySQL server, our client library [recommends you set 'utf8mb4' as your default charset](https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql#1-recommended-server-charset) disregard at your own risk.
Expand Down
Loading

0 comments on commit bfe28ca

Please sign in to comment.