Hot Deploy

3files
1figure
2min read
Sheet 30 of 47 · Server

Filesworkflow.json · plugin.yml · paper-plugin.yml

Fileworkflow.jsonFileplugin.ymlServer > Deploy builds the plugin, copies its jars into <serverDir>/plugins, restarts the managed server and, if you want, reruns the scenarios. One key, or on its own when a jar changes.

Deploy: build, swap the jars, restart, rerun.
The Deploy page with its four stages, build, swap the jar, restart and run tests, each with a lamp

Set it up

  1. Project folder

    Where the build runs.

  2. Build command

    For example gradlew build -x test. Leave it empty to only copy. A Gradle wrapper runs through its jar, so odd characters in the path do not matter.

  3. Plugin jars

    Globs relative to the project, ; between them, for example dist/*.jar or core/build/libs/*.jar; gear/build/libs/*.jar.

  4. Deploy

    Press Deploy. The page shows the four stages, build, swap the jar, restart and run tests, with a lamp each.

Settings

SettingWhat it does
Project folderWhere the build runs
Build commande.g. gradlew build -x test, empty for copy only
Build timeoutSeconds before the build is killed, default 600 (deployBuildTimeoutSeconds)
Plugin jarsGlobs relative to the project, ; between them
RestartStop, copy, start and wait for Done
WatchDeploy on its own when a jar in those folders changes, e.g. after a build in the IDE
After deployRun the scenario folder and fail the deploy when a scenario fails

Fileworkflow.jsonSettings live in workflow.json. /workflow reads them and /workflow/set?key=value changes any of them.

How the jar swap works

Windows keeps a loaded jar locked, so the server stops before the copy and starts after it.

Fileplugin.ymlFilepaper-plugin.ymlConfig keycore-1.1.jarConfig keycore-1.0.jarA new jar removes every other jar in plugins/ whose plugin.yml or paper-plugin.yml has the same name:, so core-1.1.jar replaces core-1.0.jar. A jar whose name only looks similar, or that has no readable descriptor, is left alone. -sources, -javadoc and -plain jars are skipped.

Safety rails

  • The build gets deployBuildTimeoutSeconds (default 600) and is killed with its whole process tree after that. Cancel on the page, or /deploy/cancel, kills it right away and stops a deploy between its steps.
  • With restart on and no server started by the tool, a server that still holds the port or the world fails the deploy before anything is copied, instead of a second server starting next to it.
  • Watch follows every folder from the project down to the jar folders, so it keeps working after gradle clean deletes build/, and starts even when build/libs does not exist yet.
  • A jar that changes during a deploy, or while a scenario run holds the bots, is not dropped: one deploy waits and runs once they are done.
  • With "Also post every deploy" on the Schedule page (webhookOnDeploy), each deploy and watch deploy posts its result to the webhook too.

Over HTTP

EndpointWhat it does
/deploy?build=0|1&wait=1Starts a deploy, with or without the build
/deploy/statusWhere the deploy is
/deploy/cancelKills the build and stops the deploy
/workflow, /workflow/set?key=valueReads or changes the deploy settings

From a shell, run suite/ --cache --deploy builds, swaps the jar, restarts the server and runs only what changed. See Short Loop & Result Cache.

Loading the index

Enter openUp Down moveEsc close