chore: quickly revise commands

This commit is contained in:
Michele Cereda
2025-03-16 12:05:44 +01:00
parent e03b814003
commit 8c660da6fb
4 changed files with 29 additions and 19 deletions

View File

@@ -1,11 +1,11 @@
# Dagger # Dagger
> TODO Open-source runtime for composable workflows.<br/>
Intended for systems with many moving parts and strong needs for repeatability, modularity, observability and
cross-platform support, which makes it good for AI agents and CI/CD workflows.
Programmable tool aiming to replace scripts with a modern API and cross-language scripting engine. Tries to replace software projects' artisanal scripts with a modern API and cross-language scripting engine.<br/>
Helps to create consistent and reliable local development and testing environments that can do whatever one's CI can.
<!-- Remove this line to uncomment if used
## Table of contents <!-- omit in toc -->
1. [TL;DR](#tldr) 1. [TL;DR](#tldr)
1. [Further readings](#further-readings) 1. [Further readings](#further-readings)
@@ -13,15 +13,14 @@ Programmable tool aiming to replace scripts with a modern API and cross-language
## TL;DR ## TL;DR
<!-- Uncomment if used
<details> <details>
<summary>Setup</summary> <summary>Setup</summary>
```sh ```sh
brew install 'dagger/tap/dagger'
``` ```
</details> </details>
-->
<!-- Uncomment if used <!-- Uncomment if used
<details> <details>

View File

@@ -1,5 +1,8 @@
#!/usr/bin/env fish #!/usr/bin/env fish
# If not configured, the CLI tool needs to have those specified
dblab --url 'http://dblab.example.org:1234/' --token "$(gopass show -o 'dblab')"
# Check logs # Check logs
docker logs --since '5m' -f 'dblab_server' docker logs --since '5m' -f 'dblab_server'
@@ -8,8 +11,8 @@ docker exec -it 'dblab_server' kill -SIGHUP '1'
# Check the running container's version # Check the running container's version
# Used to check the instance is up and running # Used to check the instance is up and running
dblab instance version
curl 'http://127.0.0.1:2345/healthz' curl 'http://127.0.0.1:2345/healthz'
dblab --url 'http://dblab.example.org:1234/' --token "$(gopass show -o 'dblab')" instance version
# Initialize the CLI client # Initialize the CLI client
dblab init dblab init
@@ -42,20 +45,21 @@ open 'https://dblab.example.org:1234/api/'
open 'http://dblab.example.org:1234/' open 'http://dblab.example.org:1234/'
# Get instance status, instance info, and list of clones # Get instance status, instance info, and list of clones
dblab instance status
curl 'https://dblab.example.org:2345/status' -H "Verification-Token: $(gopass show -o 'dblab')" curl 'https://dblab.example.org:2345/status' -H "Verification-Token: $(gopass show -o 'dblab')"
curl 'https://dblab.example.org:1234/api/status' -H "Verification-Token: $(gopass show -o 'dblab')" curl 'https://dblab.example.org:1234/api/status' -H "Verification-Token: $(gopass show -o 'dblab')"
dblab instance status
# Show data refresh status # Show data refresh status
curl 'https://dblab.example.org:2345/instance/retrieval' -H "Verification-Token: $(gopass show -o 'dblab')" curl 'https://dblab.example.org:2345/instance/retrieval' -H "Verification-Token: $(gopass show -o 'dblab')"
curl 'https://dblab.example.org:1234/api/instance/retrieval' -H "Verification-Token: $(gopass show -o 'dblab')" curl 'https://dblab.example.org:1234/api/instance/retrieval' -H "Verification-Token: $(gopass show -o 'dblab')"
# List snapshots # List snapshots
dblab snapshot list
curl 'https://dblab.example.org:2345/snapshots' -H "Verification-Token: $(gopass show -o 'dblab')" curl 'https://dblab.example.org:2345/snapshots' -H "Verification-Token: $(gopass show -o 'dblab')"
curl 'https://dblab.example.org:1234/api/snapshots' -H "Verification-Token: $(gopass show -o 'dblab')" curl 'https://dblab.example.org:1234/api/snapshots' -H "Verification-Token: $(gopass show -o 'dblab')"
dblab snapshot list
# Create clones # Create clones
dblab clone create --id 'some-clone' --protected --username 'geppetto' --password 'pinocchio' --db-name 'puppetshop'
curl -X 'POST' 'https://dblab.example.org:1234/api/clone' -H "Verification-Token: $(gopass show -o 'dblab')" \ curl -X 'POST' 'https://dblab.example.org:1234/api/clone' -H "Verification-Token: $(gopass show -o 'dblab')" \
-H 'accept: application/json' -H 'content-type: application/json' \ -H 'accept: application/json' -H 'content-type: application/json' \
-d '{ -d '{
@@ -64,19 +68,23 @@ curl -X 'POST' 'https://dblab.example.org:1234/api/clone' -H "Verification-Token
"db": { "db": {
"username": "geppetto", "username": "geppetto",
"password": "pinocchio", "password": "pinocchio",
"db_name": "puppets-workshop" "db_name": "puppetshop"
} }
}' }'
# List clones # List clones
dblab clone list
curl 'https://dblab.example.org:2345/status' -H "Verification-Token: $(gopass show -o 'dblab')" | jq '.' - curl 'https://dblab.example.org:2345/status' -H "Verification-Token: $(gopass show -o 'dblab')" | jq '.' -
curl 'https://dblab.example.org:1234/api/status' -H "Verification-Token: $(gopass show -o 'dblab')" curl 'https://dblab.example.org:1234/api/status' -H "Verification-Token: $(gopass show -o 'dblab')"
dblab clone list
# Get clones' information # Get clones' information
dblab clone status 'some-clone'
curl 'https://dblab.example.org:1234/clone/some-clone' -H "Verification-Token: $(gopass show -o 'dblab')" curl 'https://dblab.example.org:1234/clone/some-clone' -H "Verification-Token: $(gopass show -o 'dblab')"
curl 'https://dblab.example.org:1234/api/clone/some-clone' -H "Verification-Token: $(gopass show -o 'dblab')" curl 'https://dblab.example.org:1234/api/clone/some-clone' -H "Verification-Token: $(gopass show -o 'dblab')"
dblab clone status 'some-clone'
# Restart clones
# Only doable from the instance
docker restart 'dblab_clone_6000'
# Reset clones # Reset clones
# Only available via the '/api' endpoints, no direct ones # Only available via the '/api' endpoints, no direct ones
@@ -95,15 +103,15 @@ curl --url 'https://dblab.example.org:2345/status' --header 'verification-token:
--data '{ "latest": true }' --data '{ "latest": true }'
# Unprotect clones # Unprotect clones
dblab clone update --protected='false' 'some-clone'
curl -X 'PATCH' 'https://dblab.example.org:1234/api/clone/some-clone' \ curl -X 'PATCH' 'https://dblab.example.org:1234/api/clone/some-clone' \
-H "Verification-Token: $(gopass show -o 'dblab')" \ -H "Verification-Token: $(gopass show -o 'dblab')" \
-H 'accept: application/json' -H 'content-type: application/json' \ -H 'accept: application/json' -H 'content-type: application/json' \
-d '{ "protected": false }' -d '{ "protected": false }'
dblab clone update --protected='false' 'some-clone'
# Delete clones # Delete clones
curl -X 'DELETE' 'https://dblab.example.org:1234/api/clone/some-clone' -H "Verification-Token: $(gopass show -o 'dblab')"
dblab clone destroy 'some-clone' dblab clone destroy 'some-clone'
curl -X 'DELETE' 'https://dblab.example.org:1234/api/clone/some-clone' -H "Verification-Token: $(gopass show -o 'dblab')"
# Get admin config in YAML format # Get admin config in YAML format
curl 'https://dblab.example.org:1234/api/admin/config.yaml' -H "Verification-Token: $(gopass show -o 'dblab')" curl 'https://dblab.example.org:1234/api/admin/config.yaml' -H "Verification-Token: $(gopass show -o 'dblab')"

View File

@@ -1,13 +1,13 @@
#!/usr/bin/env fish #!/usr/bin/env fish
# Connect to PeerDB server in SQL mode # Connect to PeerDB server in SQL mode
psql 'port=9900 host=localhost password=peerdb' psql 'host=localhost port=9900 password=peerdb'
# List peers # List peers
psql "host=localhost port=9900 password=$(gopass show -o 'peerdb/instance')" \
-c "SELECT id, name, type FROM peers;"
curl -fsS --url 'http://localhost:3000/api/v1/peers/list' \ curl -fsS --url 'http://localhost:3000/api/v1/peers/list' \
-H "Authorization: Basic $(gopass show -o 'peerdb/instance' | xargs printf '%s' ':' | base64)" -H "Authorization: Basic $(gopass show -o 'peerdb/instance' | xargs printf '%s' ':' | base64)"
psql 'port=9900 host=localhost password=peerdb' \
-c "SELECT id, name, type FROM peers;"
# Create peers # Create peers
# postgres: peer.type=3|'POSTGRES' + postgres_config={…} # postgres: peer.type=3|'POSTGRES' + postgres_config={…}
@@ -29,7 +29,7 @@ curl -fsS --url 'http://localhost:3000/api/v1/peers/create' -X 'POST' \
} }
} }
}" }"
psql 'port=9900 host=localhost password=peerdb' \ psql "host=localhost port=9900 password=$(gopass show -o 'peerdb/instance')" \
-c "CREATE PEER some_pg_peer FROM POSTGRES WITH ( -c "CREATE PEER some_pg_peer FROM POSTGRES WITH (
host = 'localhost', host = 'localhost',
port = '5432', port = '5432',

View File

@@ -94,6 +94,7 @@ jq '.dependencies."@pulumi/aws" |= "6.66.2"' 'package.json' | sponge 'package.js
# Could use `--suppress-outputs --generate-code='false' --protect=false` for some # Could use `--suppress-outputs --generate-code='false' --protect=false` for some
pulumi import 'aws:alb/listener:Listener' 'pihole' 'arn:aws:elasticloadbalancing:us-west-2:012345678901:listener/app/pihole/0123456789abcdef/0123456789abcdef' pulumi import 'aws:alb/listener:Listener' 'pihole' 'arn:aws:elasticloadbalancing:us-west-2:012345678901:listener/app/pihole/0123456789abcdef/0123456789abcdef'
pulumi import 'aws:chatbot/slackChannelConfiguration:SlackChannelConfiguration' 'alarms' 'arn:aws:chatbot::012345678901:chat-configuration/slack-channel/alarms' pulumi import 'aws:chatbot/slackChannelConfiguration:SlackChannelConfiguration' 'alarms' 'arn:aws:chatbot::012345678901:chat-configuration/slack-channel/alarms'
pulumi import 'aws:cloudfront/distribution:Distribution' 'someWebsite' 'E74FTE3EXAMPLE'
pulumi import 'aws:cloudwatch/logGroup:LogGroup' 'vulcan' 'vulcan' pulumi import 'aws:cloudwatch/logGroup:LogGroup' 'vulcan' 'vulcan'
pulumi import 'aws:cloudwatch/metricAlarm:MetricAlarm' 'prometheus-ec2-CPUUtilization' 'prometheus-ec2-CPUUtilization-drc5644' pulumi import 'aws:cloudwatch/metricAlarm:MetricAlarm' 'prometheus-ec2-CPUUtilization' 'prometheus-ec2-CPUUtilization-drc5644'
pulumi import 'aws:codedeploy/application:Application' 'my-app-prod' 'my-application-production' pulumi import 'aws:codedeploy/application:Application' 'my-app-prod' 'my-application-production'
@@ -105,5 +106,7 @@ pulumi import 'aws:ecs/service:Service' 'pihole' 'experiments/pihole'
pulumi import 'aws:ecs/taskDefinition:TaskDefinition' 'pihole' 'arn:aws:ecs:eu-west-1:012345678901:task-definition/pihole:27' pulumi import 'aws:ecs/taskDefinition:TaskDefinition' 'pihole' 'arn:aws:ecs:eu-west-1:012345678901:task-definition/pihole:27'
pulumi import 'aws:iam/instanceProfile:InstanceProfile' 'prometheus-instance-profile' 'PrometheusRole' pulumi import 'aws:iam/instanceProfile:InstanceProfile' 'prometheus-instance-profile' 'PrometheusRole'
pulumi import 'aws:iam/user:User' 'jimmy' 'jimmy' pulumi import 'aws:iam/user:User' 'jimmy' 'jimmy'
pulumi import 'aws:imagebuilder/component:Component' 'requiredPackages' 'arn:aws:imagebuilder:us-east-1:123456789012:component/project-alpha-required-packages/1.0.0/1'
pulumi import 'aws:imagebuilder/imagePipeline:ImagePipeline' 'serverBase' 'arn:aws:imagebuilder:us-east-1:123456789012:image-pipeline/server-base'
pulumi import 'aws:rds/instance:Instance' 'staging' 'odoo-staging-replica' pulumi import 'aws:rds/instance:Instance' 'staging' 'odoo-staging-replica'
pulumi import 'aws:route53/record:Record' 'hoppscotch' 'ZGG4442BC3E8M_hoppscotch.example.org_A' pulumi import 'aws:route53/record:Record' 'hoppscotch' 'ZGG4442BC3E8M_hoppscotch.example.org_A'