Hosting - emanzione/PATCH GitHub Wiki

You can host PATCH artifacts (builds and patches) on your favorite hosting service. It works with every service that can serve files over HTTP or HTTPS and that can expose a direct URL to the files. This is because PATCH dynamically builds URLs based on your builds/patches metadata and needs to concatenate file names to the target URL.

Some samples:

  • http://myCoolHostingService.com/patch/Builds/0.1.0/Game/myGame.exe => valid ✅
  • https://myCoolHostingService.com/folder/myfile.txt => valid ✅
  • http://myCoolHostingService.com/?file=jR2xl1D => NOT valid ❌
  • http://myCoolHostingService.com/file.php?id=d7q3y&cache=false&token=a8d79e9d01ff => NOT valid ❌

Additional info:

  • directory listing is not required
  • the PATCH's downloaders can follow redirects

Hosting on your local computer

While testing and developing your Updater, the suggested approach is to install a web server on your local computer and connect PATCH to it. Describing how to install and configure a local web server is beyond the scope of this documentation, however - for your convenience - here is a list of web servers that you may find useful while testing locally:

In a normal scenario, after the installation (and startup) of the local web server, you should be able to reach your files at http[s]://localhost[:<your-port>]/<your-file-path> through a normal web browser.

For example, let's assume your local web server listens on port 8000 and you want to check if the PATCH files are reachable by the Updater. Open your web browser and point it at http://localhost:8000/Builds/builds_index.json (the address may vary depending on where you put your files and how you configured the web server): you should be able to see the content of the builds_index.json file.

Hosting with the main cloud vendors

When you are done with testing and you want to go live with your Updater, the local web server you configured will not be enough anymore. You will need to put your updates on a remote server in order for your users to be able to download them.

To achieve this, you can:

  • install one of the previously mentioned web servers, but this time on a remote computer (you can rent one from one of the main vendors)
  • use an object storage service (from one of the main vendors)

Again, describing how these 3rd party services work is beyond the scope of this documentation. However, for your convenience, here is a list of the major vendors (some of them are marked with referral, this means that by using that host you will support PATCH indirectly):

Regardless the vendor, after the upload of your PATCH files on the service of choice, you should be able to reach your files at http[s]://<your-service-address>[:<your-port>]/<your-file-path> through a normal web browser.

For example, let's assume you rent a VPS and installed a web server on it. Let's say that your VPS has the address myCoolService.com, the web server listens on port 8000 and you want to check if the PATCH files you uploaded before in the root folder of the web server are reachable by the Updater. To do that, open your web browser and point it at http://myCoolService.com:8000/Builds/builds_index.json (the address may vary depending on where you put your files and how you configured the web server): you should be able to see the content of the builds_index.json file.

Using AWS S3

If you are hosting your files on AWS S3, remember to check the bucket's Amazon S3 Block Public Access settings and to grant Public Read Access to your files. Otherwise, your Launcher couldn't access your files.

Using Azure Blob Storage

If you are hosting your files on Azure Blob Storage and you are using the ChunkedDownloader contained in the Plus version, you may experience some difficulties in downloading files. If that's the case, make sure to use the latest API schema (by default, it doesn't use the latest). To do that, in https://portal.azure.com/ click on Cloud Shell and run this script (first change the account-name and the key to match your own credentials):

$ctx = New-AzureStorageContext -StorageAccountName <account-name> -StorageAccountKey <key>

Update-AzureStorageServiceProperty -ServiceType Blob -DefaultServiceVersion 2021-04-10 -Context $ctx

This enables ranged and partial downloads, required for ChunkedDownloader.

Using Cloudflare

If you are using Cloudflare, you need to apply cache-control: no-transform for you files (take a look here) to avoid compression.

If you are using Caching, you need to apply Cache Everything and for every file bigger than the maximum allowed size for your plan, you need to apply cache-control: no-store.

Using Cloudflare R2

If you are hosting on Cloudflare R2, your Cloudflare Worker will need to support ranged download if you plan to use ChunkedDownloader. You can use AWS CLI for uploading your files (it uses an S3-compatible API). You can't upload files bigger than 5GB, so keep that in mind when you build your game.

⚠️ Hosting on GitHub ⚠️

⚠️ WARNING: this method has been reported as not working in the majority of cases. Use it at your own risk. The reported set of problems includes: corrupted files, wrong-sized files, the Launcher and the PreGame just keep on restarting themselves in a loop, etc. This happens when your files' line endings pushed in the repository differ from what PATCH computed. This could be fixed by configuring Git to not modify the line endings on commit (for more info, search on Google or take a look here. If that's your case and you cannot fix it, please consider choosing a different host. ⚠️

If you think the previous warning does not affect your specific case, you can use a repository on GitHub to host builds and patches. However, before you start using it, we need to make some clarifications.

Let's assume that my files are hosted at https://github.com/emanzione/PATCH, on main branch. In this repository I have the classic PATCH folder structure, as explained previously in this doc:

https://github.com/emanzione/PATCH/Builds/ https://github.com/emanzione/PATCH/Patches/ https://github.com/emanzione/PATCH/Updater/

In the Launcher's settings you CANNOT simply set as Remote URL this address! Instead, you will need to set it as the raw GitHub address: https://raw.githubusercontent.com/emanzione/PATCH/main/. Normally you can obtain your URL by following this schema: https://raw.githubusercontent.com/Username/RepositoryName/BranchName/.

And here we go: you've set your Launcher for downloading from your GitHub repositories.

⚠️ **GitHub.com Fallback** ⚠️