Workflows¶
Real-world scenarios and step-by-step guides for common txpark workflows.
Quick Testing Workflow¶
Test a feature branch quickly with automatic cleanup.
Scenario¶
You're developing a new feature and want to quickly test it on a real testnet that automatically cleans itself up after testing.
Steps¶
-
Generate sequencer configuration (first time only):
-
Deploy testnet from your feature branch:
-
Monitor deployment:
-
View logs to verify functionality:
-
Test your feature:
-
Automatic cleanup:
- Testnet automatically deletes after 2 hours
- Or manually destroy:
txpark destroy quick-test
Expected Time¶
- Setup: 5 minutes (first time)
- Deployment: 10-15 minutes
- Testing: Variable
- Cleanup: Automatic
Development Workflow¶
Iterative development with sequential testnet deployments.
Scenario¶
You're actively developing and want to test multiple iterations of your code throughout the day.
Steps¶
-
List current testnets:
-
Deploy first iteration:
-
After making changes, deploy next iteration:
-
Compare behavior between iterations:
-
Clean up old iterations:
Tips¶
- Use consistent naming:
dev-iter1,dev-iter2, etc. - Keep lifetime at 4h to prevent accumulation
- List frequently to track active testnets
- Compare endpoints side-by-side in browser
Load Testing Workflow¶
Stress test with high-performance resources.
Scenario¶
You need to perform load testing to validate performance under heavy traffic.
Steps¶
-
Deploy high-performance testnet:
-
Verify resource allocation:
-
Run load tests:
-
Monitor during testing:
-
Collect metrics:
-
Clean up:
Key Considerations¶
- Use
high-performanceprofile for adequate resources - Set longer lifetime (8h) to complete tests
- Monitor CPU and memory usage throughout
- Save logs and metrics for analysis
Long-Running Staging Environment¶
Create a permanent staging environment for extended testing.
Scenario¶
You need a stable staging environment that persists across days for integration testing.
Steps¶
-
Deploy permanent testnet:
-
Verify deployment:
-
Share endpoints with team:
-
Periodic upgrades:
-
Regular health checks:
-
When no longer needed:
Maintenance Schedule¶
- Daily: Check status, review logs
- Weekly: Verify all endpoints accessible
- Monthly: Consider upgrading to latest stable
- As needed: Destroy and redeploy if issues arise
Debugging Failed Deployments¶
Troubleshoot deployment issues systematically.
Scenario¶
Your testnet deployment failed or pods aren't becoming ready.
Steps¶
-
Check overall status:
-
Identify failing pods: Look for pods with status other than "Running" or "0/N" ready count.
-
Check pod events:
-
View logs from failing component:
-
Check init containers (if pod is stuck in Init state):
-
Inspect pod directly:
-
Common issues and fixes:
Pipeline failure:
# Check GitLab pipeline status
# Visit: https://gitlab.com/tezos/tezos/-/pipelines
# Redeploy with working branch
txpark destroy my-testnet
txpark deploy my-testnet --sequencer --build-branch master
Missing configuration:
# Verify kernel_setup.yml exists
ls -la output/kernel_setup.yml
# Regenerate if missing
./scripts/setup-sequencer.sh my-testnet
Resource constraints:
# Check node resources
kubectl top nodes
# Try default profile instead
txpark destroy my-testnet
txpark deploy my-testnet --sequencer --build-branch master --profile default
- Interactive debugging:
Managing Multiple Testnets¶
Efficiently manage several concurrent testnets.
Scenario¶
You're working on multiple features and need to track several active testnets.
Steps¶
-
Naming convention:
-
List and filter:
-
Batch status checks:
-
Batch cleanup:
-
Document active testnets:
Organization Tips¶
- Naming: Use
<type>-<description>format (feature-, bugfix-, test-) - Lifetime: Keep default 1h for experiments, 4-8h for active work
- Cleanup: Run daily cleanup of expired testnets
- Documentation: Maintain a shared document with active testnets
CI/CD Integration¶
Automate testnet deployment in CI pipelines.
Scenario¶
You want to automatically deploy testnets for testing in your CI/CD pipeline.
Example GitLab CI Configuration¶
# .gitlab-ci.yml
stages:
- build
- test
- deploy-testnet
- integration-test
- cleanup
variables:
TESTNET_NAME: "ci-$CI_PIPELINE_ID"
TESTNET_LIFETIME: "2h"
deploy_testnet:
stage: deploy-testnet
image: google/cloud-sdk:alpine
before_script:
- gcloud auth activate-service-account --key-file=$GCP_SERVICE_ACCOUNT_KEY
- gcloud container clusters get-credentials txpark-cluster --region europe-west1
- curl -LO https://gitlab.com/tezos-infra/evm/txpark/-/releases/permalink/latest/downloads/txpark-linux-amd64
- chmod +x txpark-linux-amd64
- mv txpark-linux-amd64 /usr/local/bin/txpark
script:
- ./scripts/setup-sequencer.sh $TESTNET_NAME
- txpark deploy $TESTNET_NAME --sequencer --build-branch $CI_COMMIT_REF_NAME --lifetime $TESTNET_LIFETIME
- txpark status $TESTNET_NAME
artifacts:
reports:
dotenv: testnet.env
environment:
name: testnet-$CI_PIPELINE_ID
on_stop: cleanup_testnet
integration_tests:
stage: integration-test
dependencies:
- deploy_testnet
script:
- export RPC_URL="https://${TESTNET_NAME}.txpark.nomadic-labs.com/rpc"
- npm run integration-tests
artifacts:
reports:
junit: test-results.xml
cleanup_testnet:
stage: cleanup
image: google/cloud-sdk:alpine
when: always
script:
- txpark destroy $TESTNET_NAME --force
environment:
name: testnet-$CI_PIPELINE_ID
action: stop
GitHub Actions Example¶
# .github/workflows/integration-test.yml
name: Integration Tests
on:
pull_request:
branches: [main]
jobs:
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup GCloud
uses: google-github-actions/setup-gcloud@v1
with:
service_account_key: ${{ secrets.GCP_SA_KEY }}
project_id: nl-tezos-x-alpha-infra
- name: Configure kubectl
run: |
gcloud container clusters get-credentials txpark-cluster \
--region europe-west1
- name: Install txpark
run: |
curl -LO https://gitlab.com/tezos-infra/evm/txpark/-/releases/permalink/latest/downloads/txpark-linux-amd64
chmod +x txpark-linux-amd64
sudo mv txpark-linux-amd64 /usr/local/bin/txpark
- name: Deploy testnet
id: deploy
env:
TESTNET_NAME: "gh-${{ github.run_id }}"
run: |
./scripts/setup-sequencer.sh $TESTNET_NAME
txpark deploy $TESTNET_NAME \
--sequencer \
--build-branch ${{ github.head_ref }} \
--lifetime 2h
echo "testnet_name=$TESTNET_NAME" >> $GITHUB_OUTPUT
- name: Run integration tests
env:
RPC_URL: "https://${{ steps.deploy.outputs.testnet_name }}.txpark.nomadic-labs.com/rpc"
run: npm run integration-tests
- name: Cleanup
if: always()
run: |
txpark destroy ${{ steps.deploy.outputs.testnet_name }} --force
Best Practices for CI Integration¶
- Use unique names: Include pipeline/run ID in testnet name
- Set appropriate lifetime: 2-4h to cover test duration with buffer
- Always cleanup: Use
always()orwhen: alwaysto ensure cleanup - Capture logs on failure: Save testnet logs as artifacts
- Environment variables: Export testnet URLs for test access
- Parallel testing: Deploy separate testnets for parallel jobs
Emergency Procedures¶
Handle critical situations with testnets.
Testnet Consuming Too Many Resources¶
-
Identify the testnet:
-
Check what's running:
-
Immediate action:
Mass Cleanup Required¶
-
List all testnets:
-
Destroy expired testnets:
-
Destroy old testnets (older than 7 days):
Stuck Namespace Deletion¶
If a testnet namespace won't delete:
-
Check for finalizers:
-
Remove finalizers:
-
Force delete:
Next Steps¶
- Review Best Practices for optimization tips
- Check Commands for detailed command reference
- See Development to contribute improvements