Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
VGSOURCES
Get listed

DevOpsPATCH 2026.10.27

How to Host a Java Discord Bot on a VPS 24/7

By VGSources Team 15 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

To keep a Java Discord bot online after you close SSH, run its packaged JAR as a supervised Linux service on a VPS. A systemd unit is usually the simplest option for one bot: it starts at boot, restarts the process after a crash, and sends output to the journal. Docker with a single unless-stopped restart policy is a good alternative when you already operate containers.

The bot does not normally need a public web port. JDA opens an outbound Gateway WebSocket to Discord, while your VPS only needs the administration access you actually use. Build and test locally, keep the token outside your repository, deploy under a dedicated non-root account, enable automatic startup, and test both a crash recovery and a reboot before calling the deployment 24/7.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

As an Amazon Associate I earn from qualifying purchases.

What does a 24/7 Java Discord bot deployment look like?

A Discord bot is a Java process that uses JDA (Java Discord API) to maintain a persistent Gateway WebSocket. Discord sends server events over that secure connection, and JDA handles identification, heartbeats, event dispatch, and reconnect or resume behavior. The VPS provides an always-on operating system and a process supervisor; it is not a Discord server and does not need an inbound HTTP endpoint for ordinary Gateway features.

The production path is:

  1. Develop and test the JDA application on your workstation.
  2. Package a versioned, runnable JAR with Maven or the build tool used by the project.
  3. Create a locked-down Linux service account and an application directory such as /opt/discord-bot.
  4. Copy the JAR and required resources to the VPS.
  5. Load DISCORD_TOKEN from a protected secret file or a systemd credential, never from source control.
  6. Run the process under systemd, or in a container with one Docker restart policy.
  7. Enable startup at boot, inspect logs, and perform controlled failure and reboot tests.

Keeping these responsibilities separate makes failures easier to diagnose: Discord controls the Gateway protocol, JDA manages the client connection, and systemd or Docker keeps the Java process running.

Popular on Amazon
Sale
Gaoye Blue Light Blocking Glasses | Anti UV Ray, For Computers & Gaming, Square Frame, Eyewear for Men and Women
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

What do I need before deploying?

You need a Discord application, a Linux VPS with administrative SSH access, a supported Java runtime, and a repeatable build. The exact CPU, memory, and disk requirement depends on JDA caches, enabled libraries, shard count, database use, and event volume; no single Java-specific VPS size is valid for every bot.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Application and access prerequisites

  • A Discord application with a bot user created in the Discord Developer Portal.
  • The bot token copied once into a password manager or another protected secret store.
  • An invite URL using the bot scope and, when slash or other interaction commands are used, the applications.commands scope.
  • Only the Discord permissions required by the bot’s features.
  • A VPS distribution with systemd if you choose the native deployment, or a Docker installation if you choose containers.
  • SSH keys for a non-root administrator account. Keep root login and password authentication disabled where your distribution’s security policy allows.

Version control and build prerequisites

Pin the Java version, JDA version, and build-tool versions in source control. Run the project’s normal verification tests locally before uploading anything. A deployment should contain the packaged artifact and required resources, not a working copy with credentials, test data, or an entire Git checkout.

How do I create and configure the Discord application?

Create the application in Discord’s Developer Portal, add a bot user, and treat the token as a password. JDA’s official getting-started pattern reads the token from an environment variable:

public static void main(String[] arguments) throws Exception {
    JDA api = JDABuilder.createDefault(System.getenv("DISCORD_TOKEN")).build();
}

Register listeners with addEventListeners(...) and implement only the events your bot needs. For slash commands and other interactions, use JDA’s current interaction APIs. Do not enable privileged intents merely because they are available: request the smallest set needed by your handlers, enable each required privileged intent in the Developer Portal, and account for Discord review requirements as the application grows.

Invite scopes and permissions

Generate an invite with bot. Add applications.commands if the bot registers slash commands or other application commands. Grant narrowly scoped permissions instead of administrator access. A bot that only reads messages and responds to commands does not automatically need moderation, member-management, or broad message-management rights.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Protect the token from the first copy

Copy the token once into a password manager or protected secret store. Never place it in a Git repository, issue, screenshot, chat transcript, terminal recording, or a unit file readable by unrelated users. If the token is exposed, reset it in the Developer Portal and update the VPS secret immediately; an old token cannot be made safe by deleting the leaked text.

How do I build a deployable JAR?

Use the same build command the project uses in development, and make the resulting artifact identifiable by version. For a Maven project, the standard lifecycle includes compile, test, package, verify, and deploy. The package phase creates the distributable JAR; run verification before it so a failed test cannot silently become a release.

mvn verify package

Some projects produce a thin JAR that expects dependencies beside it, while others produce a shaded or otherwise self-contained JAR. Confirm the project’s normal launch command locally, for example:

Also popular on Amazon
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
java -jar target/my-bot-1.0.0.jar

Do not assume that a JAR named my-bot.jar is runnable unless that command succeeds in a clean environment with the same Java major version you will install on the VPS.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Transfer only the release artifacts

One simple transfer pattern is to upload to a temporary location and install the file with the service account as owner:

scp target/my-bot-1.0.0.jar admin@VPS_HOST:/tmp/
ssh admin@VPS_HOST
sudo install -o discordbot -g discordbot -m 0755 /tmp/my-bot-1.0.0.jar /opt/discord-bot/my-bot.jar

Replace the example host, account, version, and file names with your own values. Upload required configuration templates or static resources separately, and do not include the real token in a command line because shells can retain commands in history.

How should I prepare and harden the VPS?

Use a non-root administrator for SSH and a separate, non-login account for the bot. Apply security updates, restrict the firewall to the administration port and any ports required by unrelated features, and leave ordinary Gateway traffic outbound. The bot account should own its application files but have no unnecessary sudo rights.

Create a dedicated service account and directories

sudo useradd --system --home /opt/discord-bot --shell /usr/sbin/nologin discordbot
sudo install -d -o discordbot -g discordbot -m 0755 /opt/discord-bot
sudo install -d -m 700 /etc/discord-bot

Exact account-management flags differ among Linux distributions; check the local manual if a command rejects an option. The important properties are a dedicated UID, no interactive login, ownership of only the bot’s files, and a directory layout that makes permissions auditable.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Store the secret outside the application

A straightforward environment-file method is:

sudo install -m 600 /dev/null /etc/discord-bot/bot.env
sudoedit /etc/discord-bot/bot.env
# DISCORD_TOKEN=replace-with-the-real-token

The file should be readable by root and by the service only as needed. Keep the placeholder out of production and check that your editor did not create a world-readable backup. For stronger separation, systemd’s LoadCredential= can present a read-only credential file to the service. Verify that the systemd version shipped by your distribution supports the directives you select before relying on them.

Network expectations

A normal JDA Gateway bot initiates an outbound TLS WebSocket, so it generally needs no public HTTP port. Open SSH only to the networks or controls you actually use, and open an inbound port only for a separate web dashboard, webhook receiver, metrics endpoint, or other feature that truly listens. Exposing an unused port increases attack surface without improving Gateway connectivity.

How do I run the bot with systemd?

For one small or medium bot, systemd has few moving parts and integrates directly with boot ordering, permissions, restart behavior, and journal logging. Create /etc/systemd/system/discord-bot.service with a unit like this:

Also popular on Amazon
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men | Office Gifts for Women, iPhone Stand, Gadgets for Men, Office Decor, Gaming Desk Accessories for Samsung Fold 8, Switch, iPad
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
[Unit]
Description=Java Discord bot
Wants=network-online.target
After=network-online.target

[Service]
Type=exec
User=discordbot
Group=discordbot
WorkingDirectory=/opt/discord-bot
EnvironmentFile=/etc/discord-bot/bot.env
ExecStart=/usr/bin/java -jar /opt/discord-bot/my-bot.jar
Restart=on-failure
RestartSec=10s

[Install]
WantedBy=multi-user.target

Type=exec is appropriate for a long-running service because systemd can report failures to invoke the configured executable or user. Use the absolute Java path returned by command -v java if it is not /usr/bin/java. Keep the JAR path, working directory, and environment-file path consistent with the files you installed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Validate, enable, and inspect the unit

  1. Check syntax and executable references:
    sudo systemd-analyze verify /etc/systemd/system/discord-bot.service
  2. Reload unit definitions:
    sudo systemctl daemon-reload
  3. Enable startup and start now:
    sudo systemctl enable --now discord-bot.service
  4. Inspect state and the latest failure details:
    sudo systemctl status discord-bot.service
  5. Follow standard output and errors:
    sudo journalctl -u discord-bot.service -f

Restart=on-failure restarts crashes and abnormal exits but does not fight an intentional clean stop. If your program is designed never to exit voluntarily, Restart=always is possible; retain a delay or increasing backoff so a programming defect cannot create a rapid restart loop.

Test the behavior you are paying for

After the bot has connected and responded to a test command, deliberately stop and start it during a maintenance window:

sudo systemctl restart discord-bot.service
sudo systemctl is-active discord-bot.service
sudo journalctl -u discord-bot.service --since "5 minutes ago"

For a crash-recovery test, terminate the Java process in a controlled window and confirm that systemd starts a new one. Do not repeatedly force failures against a production bot: every fresh Discord identification contributes to the account’s connection budget.

Should I use Docker instead of systemd?

Docker is attractive when the project already has an image build and container-operations workflow. For a single bot with no existing container pipeline, systemd usually has fewer layers and a simpler update path. Choose one process supervisor for the container; do not add a second host-level supervisor around a Docker restart policy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Decision area systemd service Docker container
Boot integration Native system boot target and service dependencies. Docker daemon starts the container according to its restart policy.
Restart semantics Restart=on-failure with a configurable delay; always is available when appropriate. restart: unless-stopped restarts after exit or daemon restart, but not after an intentional manual stop.
Secret delivery EnvironmentFile or systemd credentials with host file permissions. Container environment or mounted secret mechanisms; keep the token out of the image and Compose file committed to Git.
Filesystem isolation Controlled with service users and optional systemd sandboxing. Container boundaries and read-only mounts can limit the process view of the host.
Logs journalctl -u discord-bot.service. Container logs through the configured Docker logging workflow.
Updates and rollback Install a new JAR, switch the active file or symlink, restart, and inspect the journal. Build or pull a new image, recreate the service, and retain the previous image for rollback.
Best fit A bot deployed directly on one Linux VPS. A team already maintaining images, Compose files, and container operations.

Minimal Compose example

A Compose service can run the packaged JAR in a Java runtime image and use one restart policy:

services:
  discord-bot:
    image: your-registry/discord-bot:1.0.0
    restart: unless-stopped
    env_file:
      - /etc/discord-bot/bot.env

The image name is illustrative; use the registry and tag scheme your project controls. Docker documents that unless-stopped restarts a container after an exit or Docker daemon restart, while preserving an intentional manual stop. Do not combine this policy with a host process manager supervising the same container, because the two supervisors can issue conflicting starts and stops.

How do Gateway heartbeats, intents, and reconnects affect uptime?

Discord sends a Hello event containing the heartbeat interval. The client must identify and then send heartbeats at the required interval. If an acknowledgement is not received, a healthy client closes the connection and reconnects or resumes according to the protocol. JDA supplies the client machinery; your code should avoid creating unmanaged duplicate JDA instances whenever a connection changes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Also popular on Amazon
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack | IC+Rgb & W Smart RGB Light Bar, USB Powered TV Light Bar, Led Lights for TV PC Room Monitor Backlight Gaming Accessories
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Request only required intents

Intents determine which event categories the bot receives. Enable ordinary intents that match your handlers and request privileged intents only when a feature genuinely needs them. Privileged intents must be enabled in the Developer Portal and may require Discord review as the application grows. An intent mismatch can look like a hosting failure even when the Java process is healthy: the bot may appear online but never receive the events its code expects.

Avoid identification loops

Discord states that clients are limited to 1,000 IDENTIFY calls per 24 hours. A crash loop, a deployment script that repeatedly creates clients, or a supervisor with no delay can consume that allowance. Keep RestartSec (or an equivalent container backoff), investigate the first exception in the logs, and let JDA’s reconnect and resume strategy handle transient Gateway disconnects instead of constructing new clients in a tight loop.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How do I read logs and fix common failures?

Start with service state, then inspect the earliest meaningful exception rather than the final restart message. These commands provide the quickest view for a systemd deployment:

sudo systemctl status discord-bot.service
sudo journalctl -u discord-bot.service -n 200 --no-pager
sudo journalctl -u discord-bot.service -f

The service exits immediately

Run the same JAR manually as the service account in the configured working directory, without exposing the token on the command line. Check that the Java major version matches the build, the JAR is readable, required resources exist, and the environment file is loaded. A syntax error in the environment file or a missing variable can cause the application to terminate before JDA logs a useful Gateway message.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The token is rejected

A token error usually means the value is wrong, revoked, truncated, or not loaded by the service. Re-copy the current token into the protected secret file, verify file ownership and permissions, and restart the unit. If the token appeared anywhere public or in a shared log, reset it in the Developer Portal before testing again.

status=203/EXEC appears

This status normally means systemd could not execute the configured command. Verify the Java path, JAR path, executable permissions on parent directories, and the service account’s ability to read the file. Run systemd-analyze verify after correcting the unit, reload systemd, and start the service again.

The process cannot write a file

A read-only filesystem or sandbox restriction can block a cache, database, or log file. Give the bot a dedicated state directory owned by discordbot and point the application at it. Do not respond by making the entire filesystem writable or weakening every systemd protection setting.

The bot is online but misses events

Check that the required intents are enabled both in code and in the Developer Portal, that the invite included the correct scopes, and that the bot has permission in the affected channel or server. Confirm that listener registration occurs before the JDA client begins handling events and that the command registration path matches the interaction type you are testing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Also popular on Amazon
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Repeated reconnects or rate-limit symptoms

Inspect the first network or Gateway exception, server clock and DNS resolution, and the restart frequency. A temporary network interruption should be handled by JDA’s reconnect logic. A process that exits after every disconnect needs an application-level fix; increasing the VPS size will not repair a crash loop or an identification-budget problem.

How do I update the bot without losing a reliable rollback?

Keep releases versioned and leave the previous artifact available until the new one has passed a health check. Upload the new JAR to a temporary path, install it with the service account as owner, and replace the active file atomically where possible.

  1. Build and verify a new version locally, such as my-bot-1.0.1.jar.
  2. Upload it to a temporary directory on the VPS.
  3. Install it as /opt/discord-bot/releases/my-bot-1.0.1.jar with restrictive ownership and permissions.
  4. Update a symlink such as /opt/discord-bot/current.jar in one operation, or copy over the active file only when your filesystem and procedure make that safe.
  5. Restart the service:
    sudo systemctl restart discord-bot.service
  6. Follow the journal and issue a harmless test command.
  7. If startup fails, point the symlink back to the last known-good release, restart, and investigate the failed version offline.

Keep the environment file and token independent of the release artifact so a code rollback does not overwrite or expose credentials. For a container, tag images immutably, recreate the service with the new tag, and retain the previous image until the health check succeeds.

How much VPS capacity and cost does a Java Discord bot need?

There is no stable Java-specific VPS price or universal memory minimum for this workload. A small command bot may use very little CPU, while large member caches, multiple shards, database clients, image processing, or additional web services change the profile substantially. Measure the running process under realistic event and reconnect loads.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Watch resident memory and garbage-collection behavior after the bot has been online through a normal traffic cycle.
  • Observe CPU during startup, command bursts, scheduled jobs, and reconnects.
  • Include disk for logs, local state, backups, and release artifacts rather than counting only the JAR.
  • Resize when memory pressure, swapping, sustained CPU saturation, or disk exhaustion appears in system metrics.
  • Budget separately for a managed service if you do not want to administer Linux; its regions, limits, pricing, and Java support must be checked for the specific provider and date.

Do not buy capacity based solely on the JAR’s file size. Runtime caches and the JVM heap are the important variables, and Discord shard count can change both memory use and connection behavior.

What is the final 24/7 deployment checklist?

  • The bot connects successfully from a clean local run using an environment variable rather than a hard-coded token.
  • The application requests only the intents and Discord permissions its features need.
  • The Java, JDA, and build-tool versions are pinned and the verification build passes.
  • The VPS uses SSH keys and a non-root administrator, with security updates applied.
  • The bot runs as a non-login discordbot account with no unnecessary sudo access.
  • The token is in a root-protected secret file or supported systemd credential, never in Git or the unit text.
  • The JAR path, Java path, working directory, and file ownership match the service definition.
  • systemd-analyze verify reports no unit errors, and systemctl enable --now starts the bot.
  • Logs are visible through journalctl, and retention is sufficient for diagnosing a restart without filling the disk.
  • A controlled restart, crash-recovery test, and one maintenance-window reboot have succeeded.
  • The operator knows how to identify token errors, 203/EXEC, permission failures, missing intents, and reconnect loops.
  • The previous release remains available for rollback after each update.

Frequently Asked Questions

Can a Discord bot run on a VPS without opening port 443?

Yes, a normal JDA Gateway bot makes an outbound WebSocket connection, so it does not need an inbound web port. You still need outbound network access and the administration access required to manage the VPS. Port 443 becomes relevant only when you add a separate HTTPS listener, webhook endpoint, or dashboard.

Will closing my SSH session stop the Java bot?

Not when the bot is started by systemd or a container configured to restart independently of your shell. SSH is used for administration; the supervisor owns the process after you disconnect. A bot launched directly with java -jar from an interactive shell can end with that session unless you use a proper service manager.

How can I change a Discord bot token safely on a VPS?

Edit the protected secret file or credential source, replace the revoked value, and restart the service. Keep the JAR and unit definition unchanged, then confirm the journal shows a successful Gateway connection. If the old token was exposed, reset it first in the Developer Portal rather than merely overwriting the local file.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why does my bot appear online but slash commands do not work?

The invite may lack the applications.commands scope, or the command registration code may be targeting a different server or command type. Check the bot’s application-command registration path and allow for Discord’s propagation behavior when registering globally. This is separate from whether the Java process is being supervised correctly.

Should I run multiple Discord bots in one Java process?

You can, but it couples their deployments, memory use, logs, and restart behavior. Separate services make permissions, tokens, updates, and failures easier to isolate; a shared process can reduce overhead when the bots are intentionally managed as one application. Choose based on operational boundaries rather than assuming one VPS requires one process.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

DevOpsDiscord BotsDockerJavaJDALinuxsystemdVPS

Leave a reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.