|
|
||
|---|---|---|
| app | ||
| download_cache | ||
| logs | ||
| tools | ||
| .gitignore | ||
| README.md | ||
| config.example.py | ||
| debug.sh | ||
| requirements.txt | ||
| start.sh | ||
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
- 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 stringRemoved from codebase - SQLALCHEMY_DATABASE_URI - URI for connecting to the postgres database, refer to Documentation for creating a database URI
- FLASK_LIMITED_STORAGE_URI - Redis Server URI, can leave as default if your redis server is hosted locally and does not require authorization
- BaseDomain - Change to your domain (eg. roblox.com), please do not host on a subdomain as it is not supported!
- CloudflareTurnstileSiteKey - Please setup turnstile on the domain you are hosting and then grab the turnstile site key from there
- CloudflareTurnstileSecretKey - Read above
- 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
- DiscordBotToken - Use your Discord Bot Token
- DISCORD_CLIENT_SECRET - Discord Application Client Secret
- DISCORD_BOT_AUTHTOKEN - Authorization Token for Syntax Discord Bot, use random long string
- DISCORD_BOT_AUTHORISED_IPS - List of IPs which are allowed to access Discord Bot internal APIs
- DISCORD_ADMIN_LOGS_WEBHOOK - Discord Webhook for logging Moderation Actions
- MAILJET - You will have to modify the code and the config for this as your email template will be different
- 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.
- VERIFIED_EMAIL_REWARD_ASSET - The AssetId the user is rewarded with once they verify their email, you can change this after setting up everything
- ASSETMIGRATOR_ROBLOSECURITY - Used for private audio migration
- ASSETMIGRATOR_USE_PROXIES - If you want to use proxies for Asset Migration ( Which you should as it speeds up everything )
- ASSETMIGRATOR_PROXY_LIST_LOCATION - The path to the file which contains the proxies
- 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!!
- RSA_PRIVATE_KEY_PATH2 - Same thing for above but expects a 2048 Bit RSA private key
- 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 )
- AWS_ACCESS_KEY - Your AWS Access Key, please create one in your AWS IAM Manager
- AWS_SECRET_KEY - The Secret Key for the access key
- AWS_S3_BUCKET_NAME - The bucket name assets and images will be uploaded to
- AWS_S3_DOWNLOAD_CACHE_DIR - Where files downloaded from S3 will be cached
- AWS_REGION_NAME - The region of the bucket
- CDN_URL - Change to where the CDN is
- DISCOURSE_SSO_ENABLED - Allows authentication with Syntax for Discourse Forums
- DISCOURSE_FORUM_BASEURL - The location of the forum
- DISCOURSE_SECRET_KEY - The secret key for signing
- ADMIN_GROUP_ID - The GroupId where admins are in, used for showing the admin badges ingame
- ITEMRELEASER_DISCORD_WEBHOOK - The Discord Webhook to use for announcing an item release
- ITEMRELEASER_ITEM_PING_ROLE_ID - The Discord Role ID to ping for announcing an item release
- PROMETHEUS_ENABLED - If the Prometheus endpoint is enabled
- PROMETHEUS_ALLOWED_IPS - IPs which are allowed to query the Prometheus endpoint
- CHEATER_REPORTS_DISCORD_WEBHOOK - The Discord webhook to use for cheater reports from RCCService
- ROLIMONS_API_ENABLED - Used for Synmons
- ROLIMONS_API_KEY - Used for Synmons
- GAMESERVER_COMM_PRIVATE_KEY_LOCATION - The Private key location used for signing requests sent to gameservers
- CRYPTOMUS_PAYMENT_ENABLED - If the cryptomus payment system is enabled
- CRYPTOMUS_MERCHANT_ID - Your Cryptomus merchant ID
- CRYPTOMUS_API_KEY - Your Cryptoumus API Key
- 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