Skip to content

Add outbound network commands#984

Open
m-abdelwahab wants to merge 4 commits into
masterfrom
mahmoud/outbound-networking-cli
Open

Add outbound network commands#984
m-abdelwahab wants to merge 4 commits into
masterfrom
mahmoud/outbound-networking-cli

Conversation

@m-abdelwahab

@m-abdelwahab m-abdelwahab commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a top-level railway outbound-network command for service outbound networking management with dashboard parity through the Railway public GraphQL API.

railway outbound-network status
railway outbound-network static-ip status
railway outbound-network static-ip enable
railway outbound-network static-ip disable
railway outbound-network ipv6 status
railway outbound-network ipv6 enable
railway outbound-network ipv6 disable

All commands support the standard service selectors and JSON output:

-s, --service <SERVICE>
-e, --environment <ENVIRONMENT>
-p, --project <PROJECT_ID>
--json

Behavior

Static Outbound IP commands use the public egress gateway APIs directly, matching the current dashboard toggle. Enabling creates egress gateway associations, disabling clears them, and both commands report that a redeploy is required before outbound traffic changes.

Static Outbound IP status reports whether the feature is enabled, whether the returned assignment is high availability, and the assigned IPv4 addresses. It does not expose a legacy/single-IP mode in the CLI contract.

Outbound IPv6 commands stage an environment config patch for deploy.ipv6EgressEnabled, matching the current dashboard toggle. The CLI does not apply staged changes or trigger a redeploy; it reports that staged changes must be applied.

railway outbound-network status summarizes both Static Outbound IPs and Outbound IPv6 for the selected service and environment.

API

Uses only Railway public GraphQL API operations:

  • egressGateways
  • egressGatewayAssociationCreate
  • egressGatewayAssociationsClear
  • environmentStageChanges
  • environmentStagedChanges
  • environment { config }

JSON output

Action responses include a shared lifecycle object so automation can distinguish direct mutations from staged environment patches.

Static Outbound IP action responses use direct lifecycle mode. Outbound IPv6 action responses use environmentPatch lifecycle mode.

Tests

Added coverage for:

  • outbound network subcommand parsing, selectors, and --json
  • root CLI registration for railway outbound-network
  • Static Outbound IP status derivation for enabled, disabled, and high-availability gateway data
  • Static Outbound IP action lifecycle output
  • Outbound IPv6 staged action lifecycle output
  • deploy.ipv6EgressEnabled environment config serialization
  • applied and staged Outbound IPv6 status parsing

Validated with:

cargo fmt
cargo test
cargo clippy
git diff --check

Also validated against a real Railway account by creating a disposable project and service, deploying a minimal Dockerfile app, running the full JSON command matrix, running representative human-output commands, verifying Static Outbound IP enable/disable behavior, verifying Outbound IPv6 staged behavior, and leaving the temporary project available for manual follow-up testing.

@m-abdelwahab m-abdelwahab added the release/minor Author minor release label Jun 20, 2026
@m-abdelwahab m-abdelwahab changed the title Add outbound networking commands Add outbound network commands Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/minor Author minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant