<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mindattic.com/wiki/docs/index.php?action=history&amp;feed=atom&amp;title=Unity.Multiplayer%2Farticles%2Fhosting%2Fgce</id>
	<title>Unity.Multiplayer/articles/hosting/gce - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mindattic.com/wiki/docs/index.php?action=history&amp;feed=atom&amp;title=Unity.Multiplayer%2Farticles%2Fhosting%2Fgce"/>
	<link rel="alternate" type="text/html" href="https://mindattic.com/wiki/docs/index.php?title=Unity.Multiplayer/articles/hosting/gce&amp;action=history"/>
	<updated>2026-12-05T13:13:58Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.3</generator>
	<entry>
		<id>https://mindattic.com/wiki/docs/index.php?title=Unity.Multiplayer/articles/hosting/gce&amp;diff=920&amp;oldid=prev</id>
		<title>Docs Sync: md2wiki: sync from MindAttic.Docs</title>
		<link rel="alternate" type="text/html" href="https://mindattic.com/wiki/docs/index.php?title=Unity.Multiplayer/articles/hosting/gce&amp;diff=920&amp;oldid=prev"/>
		<updated>2026-11-29T20:36:54Z</updated>

		<summary type="html">&lt;p&gt;md2wiki: sync from MindAttic.Docs&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Hosting on Google Compute Engine (Gce) =&lt;br /&gt;
&lt;br /&gt;
A big-cloud profile (UM-T27): &amp;lt;code&amp;gt;mp-host&amp;lt;/code&amp;gt; creates a firewall rule it owns plus a GCE instance running the same Docker image + rendezvous side-car compose stack as GenericVps, booted by a plain shell &amp;lt;code&amp;gt;startup-script&amp;lt;/code&amp;gt; (GCE&amp;#039;s guest agent runs this literally rather than parsing it as cloud-init, unlike the AWS and Azure profiles).&lt;br /&gt;
&lt;br /&gt;
== What &amp;lt;code&amp;gt;mp-host deploy&amp;lt;/code&amp;gt; does here ==&lt;br /&gt;
&lt;br /&gt;
# Builds (or reads an already-built) &amp;lt;strong&amp;gt;GenericVps-profile&amp;lt;/strong&amp;gt; server package and image, pushes it to GHCR.&lt;br /&gt;
# Renders the compose file + bootstrap script into a plain startup script and calls &amp;lt;code&amp;gt;instances.insert&amp;lt;/code&amp;gt; with it as the &amp;lt;code&amp;gt;startup-script&amp;lt;/code&amp;gt; metadata key, your chosen zone, machine type and source image, tagging the instance &amp;lt;code&amp;gt;mp-host-&amp;amp;lt;server name&amp;gt;&amp;lt;/code&amp;gt; for the firewall rule to target.&lt;br /&gt;
# Calls &amp;lt;code&amp;gt;firewalls.insert&amp;lt;/code&amp;gt; to create a rule (also named &amp;lt;code&amp;gt;mp-host-&amp;amp;lt;server name&amp;gt;&amp;lt;/code&amp;gt;) opening SSH (22/tcp), the rendezvous port (8080/tcp) and your declared game port to that tag.&lt;br /&gt;
# Polls &amp;lt;code&amp;gt;instances.get&amp;lt;/code&amp;gt; for a public (NAT) IP, then over SSH for &amp;lt;code&amp;gt;GET http&amp;amp;#58;//127.0.0.1:&amp;amp;lt;healthPort&amp;gt;/healthz&amp;lt;/code&amp;gt; once it&amp;#039;s up, exactly like GenericVps.&lt;br /&gt;
# Watches &amp;lt;code&amp;gt;docker compose logs game&amp;lt;/code&amp;gt; over SSH for the join-code line and prints it.&lt;br /&gt;
&lt;br /&gt;
== Before you deploy ==&lt;br /&gt;
&lt;br /&gt;
You need a GCP project and an SSH key pair locally. Unlike the AWS profiles, mp-host does not implement Google&amp;#039;s service-account JWT signing flow itself (it would mean shipping its own RSA signing code for a token you could otherwise mint in one command) -- it takes a short-lived OAuth2 access token directly, which you (or your CI) refresh before each deploy:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code&amp;quot;&amp;gt;gcloud auth application-default login&lt;br /&gt;
gcloud auth print-access-token&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code&amp;quot;&amp;gt;mp-host credentials set-gce --project my-gcp-project --access-token ya29.A0ARrdaM9...&lt;br /&gt;
mp-host credentials set-ghcr --username &amp;amp;lt;github-username&amp;gt; --token &amp;amp;lt;PAT with write:packages&amp;gt;&lt;br /&gt;
mp-host credentials set-cloud-options --profile Gce --name prod-gce \&lt;br /&gt;
  --opt sshUser=ubuntu --opt sshKeyPath=C:\Users\me\.ssh\id_ed25519 \&lt;br /&gt;
  --opt sshPublicKeyPath=C:\Users\me\.ssh\id_ed25519.pub&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Access tokens typically expire in about an hour -- re-run &amp;lt;code&amp;gt;credentials set-gce&amp;lt;/code&amp;gt; with a fresh one if a deploy fails with an authentication error. &amp;lt;code&amp;gt;sourceImage&amp;lt;/code&amp;gt; (default Ubuntu 22.04 LTS), &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;global/networks/default&amp;lt;/code&amp;gt;) and &amp;lt;code&amp;gt;machineType&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;e2-small&amp;lt;/code&amp;gt;) are optional overrides -- see &amp;lt;code&amp;gt;GceProvisioner&amp;lt;/code&amp;gt;&amp;#039;s class doc for the full list.&lt;br /&gt;
&lt;br /&gt;
Then deploy:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code&amp;quot;&amp;gt;mp-host deploy --profile Gce --name prod-gce --package ./build/GenericVps \&lt;br /&gt;
  --image myorg/mygame --tag v1 --region us-central1-a --size e2-small \&lt;br /&gt;
  --rendezvous-url https&amp;amp;#58;//rendezvous.example.com \&lt;br /&gt;
  --public-address prod-gce&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(&amp;lt;code&amp;gt;--region&amp;lt;/code&amp;gt; carries the GCE &amp;lt;em&amp;gt;zone&amp;lt;/em&amp;gt;, e.g. &amp;lt;code&amp;gt;us-central1-a&amp;lt;/code&amp;gt;, not a region -- GCE instances and firewall-rule scoping are zonal.) Add &amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt; first to see every Compute Engine call (&amp;lt;code&amp;gt;instances.insert&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;firewalls.insert&amp;lt;/code&amp;gt;, ...) mp-host would make, without creating anything.&lt;br /&gt;
&lt;br /&gt;
== Open ports ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Port&lt;br /&gt;
! Protocol&lt;br /&gt;
! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| your game port&lt;br /&gt;
| UDP (or TCP for WebSocket)&lt;br /&gt;
| Players connect here.&lt;br /&gt;
|-&lt;br /&gt;
| 8080&lt;br /&gt;
| TCP&lt;br /&gt;
| The rendezvous service.&lt;br /&gt;
|-&lt;br /&gt;
| 22&lt;br /&gt;
| TCP&lt;br /&gt;
| SSH -- the only way mp-host reaches the box after boot.&lt;br /&gt;
|-&lt;br /&gt;
| health port&lt;br /&gt;
| TCP, bound to 127.0.0.1&lt;br /&gt;
| Not reachable from the internet by design.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Updating and tearing down ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mp-host update&amp;lt;/code&amp;gt; restarts the compose stack in place over SSH, same as the other UM-T27 VM profiles. &amp;lt;code&amp;gt;mp-host destroy ... --yes&amp;lt;/code&amp;gt; stops the compose stack, deletes the instance, then deletes the firewall rule (mp-host warns rather than fails if the rule delete needs a moment -- delete it yourself if it&amp;#039;s still there afterwards and nothing else uses it).&lt;br /&gt;
&lt;br /&gt;
== Cost and data-transfer notes ==&lt;br /&gt;
&lt;br /&gt;
GCE bills internet egress separately from the instance&amp;#039;s own per-second billing, and the price depends on destination and the monthly tier you&amp;#039;re in -- check the [https://cloud.google.com/vpc/network-pricing Compute Engine network pricing page] for your region&amp;#039;s current rate (a commonly-cited starting rate for egress to the internet is roughly $0.12/GB as of this writing, dropping at higher monthly volumes). Using the same rule-of-thumb send rate as the AWS guides (roughly 20 KB/s per player -- replace with your own game&amp;#039;s actual figure), a player-hour is about 0.07 GB, which works out to on the order of &amp;lt;strong&amp;gt;$0.008 per player-hour&amp;lt;/strong&amp;gt; in data transfer at that rate, on top of the instance&amp;#039;s own hourly cost (&amp;lt;code&amp;gt;e2-small&amp;lt;/code&amp;gt; is a reasonable default for a small lobby). &amp;lt;code&amp;gt;mp-host destroy&amp;lt;/code&amp;gt; after each test run is the cheapest way to avoid paying for an idle instance between events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;md2wiki-crumb&amp;quot;&amp;gt;Part of [[Unity.Multiplayer]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;md2wiki-source&amp;quot;&amp;gt;From [https://github.com/mindattic/Unity.Multiplayer/blob/main/docs/articles/hosting/gce.md Unity.Multiplayer/docs/articles/hosting/gce.md] via MindAttic.Docs; synced automatically, so edit the repo, not this page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Unity.Multiplayer]]&lt;/div&gt;</summary>
		<author><name>Docs Sync</name></author>
	</entry>
</feed>