|
| 1 | +{ |
| 2 | + "Id": "3f4519f7-78f6-4fb9-8bc5-97e138825bb8", |
| 3 | + "Name": "Convex - Export Data", |
| 4 | + "Description": "Exports a snapshot of your Convex deployment's data to a local file using the [Convex CLI](https://docs.convex.dev/cli). Designed to be run before a production deployment as a data backup or rollback safety net.\n\nThe export file can optionally be captured as an Octopus build artifact for storage and auditing.", |
| 5 | + "ActionType": "Octopus.Script", |
| 6 | + "Version": 1, |
| 7 | + "CommunityActionTemplateId": null, |
| 8 | + "Packages": [], |
| 9 | + "Properties": { |
| 10 | + "Octopus.Action.Script.ScriptSource": "Inline", |
| 11 | + "Octopus.Action.Script.Syntax": "Bash", |
| 12 | + "Octopus.Action.Script.ScriptBody": "deployKey=$(get_octopusvariable \"ConvexExport.DeployKey\")\noutputPath=$(get_octopusvariable \"ConvexExport.OutputPath\")\ndeploymentType=$(get_octopusvariable \"ConvexExport.DeploymentType\")\npreviewName=$(get_octopusvariable \"ConvexExport.PreviewName\")\nworkingDir=$(get_octopusvariable \"ConvexExport.WorkingDirectory\")\ncaptureArtifact=$(get_octopusvariable \"ConvexExport.CaptureAsArtifact\")\ncmdTimeout=$(get_octopusvariable \"ConvexExport.CommandTimeout\")\n\nif [ -z \"$deployKey\" ]; then\n echo \"ERROR: ConvexExport.DeployKey is required.\"\n exit 1\nfi\n\nif [ -z \"$deploymentType\" ]; then\n deploymentType=\"prod\"\nfi\n\nif [ -z \"$cmdTimeout\" ]; then\n cmdTimeout=\"600\"\nfi\n\nexport CONVEX_DEPLOY_KEY=\"$deployKey\"\n\nif [ -n \"$workingDir\" ]; then\n echo \"Changing to working directory: $workingDir\"\n cd \"$workingDir\" || { echo \"ERROR: Could not change to directory '$workingDir'\"; exit 1; }\nfi\n\ntimestamp=$(date +\"%Y%m%d_%H%M%S\")\n\nif [ -z \"$outputPath\" ]; then\n outputPath=\"convex-export-${timestamp}.zip\"\nfi\n\ndeploymentFlag=\"\"\ncase \"$deploymentType\" in\n prod)\n deploymentFlag=\"--prod\"\n ;;\n preview)\n if [ -z \"$previewName\" ]; then\n echo \"ERROR: ConvexExport.PreviewName is required when deployment type is 'preview'.\"\n exit 1\n fi\n deploymentFlag=\"--preview-name $previewName\"\n ;;\n dev)\n deploymentFlag=\"\"\n ;;\nesac\n\nensure_node() {\n if command -v npx &>/dev/null; then\n echo \"Node.js found: $(node --version)\"\n return 0\n fi\n export NVM_DIR=\"${NVM_DIR:-$HOME/.nvm}\"\n if [ -s \"$NVM_DIR/nvm.sh\" ]; then\n \\. \"$NVM_DIR/nvm.sh\"\n if command -v npx &>/dev/null; then\n echo \"Node.js loaded via nvm: $(node --version)\"\n return 0\n fi\n fi\n echo \"Node.js not found. Installing via nvm...\"\n curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash\n \\. \"$NVM_DIR/nvm.sh\"\n nvm install --lts\n echo \"Node.js installed: $(node --version)\"\n}\nensure_node\n\necho \"Exporting Convex data from: $deploymentType\"\necho \"Output file: $outputPath\"\n\ntimeout \"$cmdTimeout\" npx convex export $deploymentFlag --path \"$outputPath\"\n\nexitCode=$?\nif [ $exitCode -ne 0 ]; then\n echo \"ERROR: Convex export failed with exit code $exitCode.\"\n exit $exitCode\nfi\n\nif [ ! -f \"$outputPath\" ]; then\n echo \"ERROR: Export completed but output file not found at '$outputPath'.\"\n exit 1\nfi\n\nfileSize=$(du -sh \"$outputPath\" | cut -f1)\necho \"Export complete. File: $outputPath ($fileSize)\"\n\nif [ \"$captureArtifact\" = \"True\" ]; then\n new_octopusartifact \"$outputPath\"\n echo \"Export captured as Octopus artifact.\"\nfi\n" |
| 13 | + }, |
| 14 | + "Parameters": [ |
| 15 | + { |
| 16 | + "Id": "ba76acd0-99e4-4aa1-8554-e0696b528ed7", |
| 17 | + "Name": "ConvexExport.DeployKey", |
| 18 | + "Label": "Deploy Key", |
| 19 | + "HelpText": "The Convex deploy key for the target project. Store this as a sensitive Octopus variable.\n\nSee: [Creating deploy keys](https://docs.convex.dev/cli#deploy-keys)", |
| 20 | + "DefaultValue": "", |
| 21 | + "DisplaySettings": { |
| 22 | + "Octopus.ControlType": "Sensitive" |
| 23 | + } |
| 24 | + }, |
| 25 | + { |
| 26 | + "Id": "17b1f813-7b43-4528-bafe-5b52eac6df1b", |
| 27 | + "Name": "ConvexExport.OutputPath", |
| 28 | + "Label": "Output File Path", |
| 29 | + "HelpText": "Optional. The local path where the export ZIP file should be written.\n\nDefaults to `convex-export-{timestamp}.zip` in the current working directory if left blank.", |
| 30 | + "DefaultValue": "", |
| 31 | + "DisplaySettings": { |
| 32 | + "Octopus.ControlType": "SingleLineText" |
| 33 | + } |
| 34 | + }, |
| 35 | + { |
| 36 | + "Id": "e7002edd-eb0d-4c2b-979e-972c095eede5", |
| 37 | + "Name": "ConvexExport.DeploymentType", |
| 38 | + "Label": "Deployment Type", |
| 39 | + "HelpText": "The Convex deployment to export data from.\n\n- `prod` \u2014 production deployment (default)\n- `preview` \u2014 preview deployment (requires a preview name)\n- `dev` \u2014 development deployment", |
| 40 | + "DefaultValue": "prod", |
| 41 | + "DisplaySettings": { |
| 42 | + "Octopus.ControlType": "Select", |
| 43 | + "Octopus.SelectOptions": "prod|Production\npreview|Preview\ndev|Development" |
| 44 | + } |
| 45 | + }, |
| 46 | + { |
| 47 | + "Id": "81526834-4204-4696-bfc4-3e965dcb320d", |
| 48 | + "Name": "ConvexExport.PreviewName", |
| 49 | + "Label": "Preview Name", |
| 50 | + "HelpText": "The name of the preview deployment. Only required when **Deployment Type** is `preview`.", |
| 51 | + "DefaultValue": "", |
| 52 | + "DisplaySettings": { |
| 53 | + "Octopus.ControlType": "SingleLineText" |
| 54 | + } |
| 55 | + }, |
| 56 | + { |
| 57 | + "Id": "690649ca-3801-45d1-9a59-45e561c127f5", |
| 58 | + "Name": "ConvexExport.WorkingDirectory", |
| 59 | + "Label": "Working Directory", |
| 60 | + "HelpText": "Optional. Path to the directory containing your Convex project. Defaults to the current working directory if left blank.", |
| 61 | + "DefaultValue": "", |
| 62 | + "DisplaySettings": { |
| 63 | + "Octopus.ControlType": "SingleLineText" |
| 64 | + } |
| 65 | + }, |
| 66 | + { |
| 67 | + "Id": "036c1260-7b14-4c05-8948-858cc1b5c893", |
| 68 | + "Name": "ConvexExport.CaptureAsArtifact", |
| 69 | + "Label": "Capture as Octopus Artifact", |
| 70 | + "HelpText": "When enabled, the exported file will be captured as an Octopus build artifact, making it available for download from the deployment details page.", |
| 71 | + "DefaultValue": "True", |
| 72 | + "DisplaySettings": { |
| 73 | + "Octopus.ControlType": "Checkbox" |
| 74 | + } |
| 75 | + }, |
| 76 | + { |
| 77 | + "Id": "186fac8e-92c9-482f-adea-551cb64dd999", |
| 78 | + "Name": "ConvexExport.CommandTimeout", |
| 79 | + "Label": "Command Timeout (seconds)", |
| 80 | + "HelpText": "Maximum number of seconds to wait for the export to complete. Defaults to 600 (10 minutes). Large datasets may require a higher value.", |
| 81 | + "DefaultValue": "600", |
| 82 | + "DisplaySettings": { |
| 83 | + "Octopus.ControlType": "SingleLineText" |
| 84 | + } |
| 85 | + } |
| 86 | + ], |
| 87 | + "LastModifiedBy": "itsmebenwalker", |
| 88 | + "$Meta": { |
| 89 | + "ExportedAt": "2026-05-29T00:00:00.000Z", |
| 90 | + "OctopusVersion": "2026.1.0", |
| 91 | + "Type": "ActionTemplate" |
| 92 | + }, |
| 93 | + "Category": "convex" |
| 94 | +} |
0 commit comments