Go to file
VirtuBrick fcf92829e8 Initial commit 2024-02-22 11:59:13 -05:00
app Initial commit 2024-02-22 11:59:13 -05:00
download_cache Initial commit 2024-02-22 11:59:13 -05:00
logs Initial commit 2024-02-22 11:59:13 -05:00
tools Initial commit 2024-02-22 11:59:13 -05:00
.gitignore Initial commit 2024-02-22 11:59:13 -05:00
README.md Initial commit 2024-02-22 11:59:13 -05:00
config.example.py Initial commit 2024-02-22 11:59:13 -05:00
debug.sh Initial commit 2024-02-22 11:59:13 -05:00
requirements.txt Initial commit 2024-02-22 11:59:13 -05:00
start.sh Initial commit 2024-02-22 11:59:13 -05:00

README.md

Syntax Backend

Last Updated: 20/2/2024

What you need

Requirements

  • Linux Server ( For Production environment )
  • PostgreSQL Server
  • Redis Server
  • NGINX
  • Cloudflare Account
  • Domain with Cloudflare protection
  • Python 3.12+
  • FFmpeg
  • Gunicorn

Note: These are the bare minimum needed for Syntax Backend to run, please do not attempt to host a publicly accessible version of Syntax if you do not know what you are doing

Optional Services

  • Syntax Gameserver running on Windows Server ( Needed for rendering and games )
  • Syntax Discord Bot
  • Ko-Fi ( Please modify code if you are not going to use this )
  • Cryptomus
  • MailJet ( Email Vericiation, modification to the code is needed as email templates are not included )
  • HTTP Proxies for faster asset migration ( webshare.io is recommended )
  • Amazon S3 Bucket ( USE_LOCAL_STORAGE must be enabled if you are not planning to use a S3 Bucket )

Configuration

Copy config.example.py and name it as config.py then place it in the same directory as this readme file

  1. FLASK_SESSION_KEY - Used for salting passwords and 2FA Secret Generation, please change to a random long string and never change it ever again! 2. AuthorizationKey - Added for debugging and bypassing ratelimits, please also change to a random long string Removed from codebase
  2. SQLALCHEMY_DATABASE_URI - URI for connecting to the postgres database, refer to Documentation for creating a database URI
  3. FLASK_LIMITED_STORAGE_URI - Redis Server URI, can leave as default if your redis server is hosted locally and does not require authorization
  4. BaseDomain - Change to your domain (eg. roblox.com), please do not host on a subdomain as it is not supported!
  5. CloudflareTurnstileSiteKey - Please setup turnstile on the domain you are hosting and then grab the turnstile site key from there
  6. CloudflareTurnstileSecretKey - Read above
  7. DISCORD_CLIENT_ID - Go to the Discord Developer Portal and go to the Discord Application you are going to use, then place its ClientID here
  8. DiscordBotToken - Use your Discord Bot Token
  9. DISCORD_CLIENT_SECRET - Discord Application Client Secret
  10. DISCORD_BOT_AUTHTOKEN - Authorization Token for Syntax Discord Bot, use random long string
  11. DISCORD_BOT_AUTHORISED_IPS - List of IPs which are allowed to access Discord Bot internal APIs
  12. DISCORD_ADMIN_LOGS_WEBHOOK - Discord Webhook for logging Moderation Actions
  13. MAILJET - You will have to modify the code and the config for this as your email template will be different
  14. KOFI_VERIFICATION_TOKEN - Used for verifying requests from Ko-Fi to automate donations processing, please change to a random long string if you do not plan on using this. If you do you can find the verification token in your Ko-Fi API Panel.
  15. VERIFIED_EMAIL_REWARD_ASSET - The AssetId the user is rewarded with once they verify their email, you can change this after setting up everything
  16. ASSETMIGRATOR_ROBLOSECURITY - Used for private audio migration
  17. ASSETMIGRATOR_USE_PROXIES - If you want to use proxies for Asset Migration ( Which you should as it speeds up everything )
  18. ASSETMIGRATOR_PROXY_LIST_LOCATION - The path to the file which contains the proxies
  19. RSA_PRIVATE_KEY_PATH - The path to the private key, expects a 1024 Bit RSA private key used for signing JoinScripts and everyting else This is required!!
  20. RSA_PRIVATE_KEY_PATH2 - Same thing for above but expects a 2048 Bit RSA private key
  21. USE_LOCAL_STORAGE - Uses local storage for storing and reading files, bypasses S3 and uses AWS_S3_DOWNLOAD_CACHE_DIR as its storage directory ( SHOULD ONLY BE USED IN A DEVELOPMENT ENVIRONMENT )
  22. AWS_ACCESS_KEY - Your AWS Access Key, please create one in your AWS IAM Manager
  23. AWS_SECRET_KEY - The Secret Key for the access key
  24. AWS_S3_BUCKET_NAME - The bucket name assets and images will be uploaded to
  25. AWS_S3_DOWNLOAD_CACHE_DIR - Where files downloaded from S3 will be cached
  26. AWS_REGION_NAME - The region of the bucket
  27. CDN_URL - Change to where the CDN is
  28. DISCOURSE_SSO_ENABLED - Allows authentication with Syntax for Discourse Forums
  29. DISCOURSE_FORUM_BASEURL - The location of the forum
  30. DISCOURSE_SECRET_KEY - The secret key for signing
  31. ADMIN_GROUP_ID - The GroupId where admins are in, used for showing the admin badges ingame
  32. ITEMRELEASER_DISCORD_WEBHOOK - The Discord Webhook to use for announcing an item release
  33. ITEMRELEASER_ITEM_PING_ROLE_ID - The Discord Role ID to ping for announcing an item release
  34. PROMETHEUS_ENABLED - If the Prometheus endpoint is enabled
  35. PROMETHEUS_ALLOWED_IPS - IPs which are allowed to query the Prometheus endpoint
  36. CHEATER_REPORTS_DISCORD_WEBHOOK - The Discord webhook to use for cheater reports from RCCService
  37. ROLIMONS_API_ENABLED - Used for Synmons
  38. ROLIMONS_API_KEY - Used for Synmons
  39. GAMESERVER_COMM_PRIVATE_KEY_LOCATION - The Private key location used for signing requests sent to gameservers
  40. CRYPTOMUS_PAYMENT_ENABLED - If the cryptomus payment system is enabled
  41. CRYPTOMUS_MERCHANT_ID - Your Cryptomus merchant ID
  42. CRYPTOMUS_API_KEY - Your Cryptoumus API Key
  43. IPAPI_AUTH_KEY - API Key for IPAPI used for VPN and proxy detection on signup

KeyPair Generation

The SYNTAX Backend requires some keys for it to sign and communicate with gameservers, run the script below to generate those keys.

python tools/generate_new_keys.py

In the tools directory 6 new files should have been created, 2 key pairs are for joinscript signing which is needed by the Client and RCCService to authenticate and verify properly. Another keypair is for signing requests to communicate with all gameservers, take the public key and place it in your gameserver directory.

First Time Setup

First install all required dependencies by running pip install -r requirements.txt in this directory

Next run the command flask shell in the same directory as this README.md file, then in the shell run db.create_all(). This will automatically create all the tables needed in your PostgreSQL database.

Next use type in the following command in your flask shell

from app.shell_commands import create_admin_user
create_admin_user()

This will create an admin user with all existing admin privileges

Now we can finally start the website, please make sure you have gunicorn installed on your Linux Machine, gunicorn does not support Windows Machines. To start run the shell script ./start.sh which will start a webserver on port 3003. Please make sure you have NGINX configured as a reverse proxy to proxy the website and also have configured Cloudflare to serve your website on the main and all subdomains.

If you are running a Windows Machine and want to run in debug mode run flask run --port 3006 --debug, this will open the website on port 3006