Skip to content

Commit fbfd4f0

Browse files
Mid point.
1 parent 919c499 commit fbfd4f0

File tree

9 files changed

+233
-24
lines changed

9 files changed

+233
-24
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
echo 'provisioning apache2'
4+
5+
export DEBIAN_FRONTEND=noninteractive
6+
7+
if [ -f $HOME/.bashrc ]; then
8+
echo "export DEBIAN_FRONTEND=noninteractive" | sudo tee -a $HOME/.bashrc
9+
fi
10+
11+
sudo apt-get update
12+
sudo apt-get -y install apache2
13+
echo '<!doctype html><html><body><h1>Hello from stackql droplet auto-provisioned.</h1></body></html>' | sudo tee /var/www/html/index.html
14+
15+
echo 'provisioning complete'
16+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
echo 'provisioning all in one stackql dashboard VM'
4+
5+
sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get update
6+
sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get install -yq postgresql postgresql-contrib
7+
8+
mkdir -p /opt/stackql
9+
10+
curl -L https://bit.ly/stackql-zip -O && unzip stackql-zip && cp stackql /opt/stackql/ && chmod +x /opt/stackql/*
11+
12+
export DEBIAN_FRONTEND=noninteractive
13+
export NEEDRESTART_MODE=a
14+
export PATH=$PATH:/opt/stackql
15+
16+
if [ -f $HOME/.bashrc ]; then
17+
echo "export DEBIAN_FRONTEND=noninteractive" | sudo tee -a $HOME/.bashrc
18+
echo "export NEEDRESTART_MODE=a" | sudo tee -a $HOME/.bashrc
19+
echo "export PATH=$PATH:/opt/stackql" | sudo tee -a $HOME/.bashrc
20+
fi
21+
22+
echo 'provisioning complete'
23+

docs/walkthroughs/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ in order to setup, run, verify and tear down testing scenarios. The tests *can*
1616

1717
## The cost of freedom
1818

19-
We are deliberately not opinionated on choice of platform, technology, vendor, geography, etc. That is up to you. One thing we do know, though is that cost is always a consideration. These pricing calculators are good reference points:
19+
We are deliberately not opinionated on choice of platform, technology, vendor, geography, jurisdiction, etc. That is up to you. One thing we do know, though, is that cost is always a consideration. These pricing calculators are good reference points:
2020

21-
- [google price calciulator](https://cloud.google.com/products/calculator).
21+
- [google price calculator](https://cloud.google.com/products/calculator).
2222
- [aws price calculator](https://calculator.aws/#/).
2323
- [azure price calculator](https://azure.microsoft.com/en-au/pricing/calculator/).
2424
- [digitalocean price calculator](https://www.digitalocean.com/pricing/calculator).
25+
- [alibaba price calculator](https://www.alibabacloud.com/en/pricing).
2526

2627
There are other boutique providers that are ultra-competitive on some offerings:
2728

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
2+
3+
Useful helps:
4+
5+
- [digitalocean API reference](https://docs.digitalocean.com/reference/api/api-reference/).
6+
7+
8+
```bash
9+
10+
source cicd/keys/testing/digitalocean-rw-stackql.sh
11+
12+
stackql shell --approot=./test/tmp/.create-digitalocean-k8s.stackql --http.log.enabled
13+
```
14+
15+
```sql
16+
17+
registry pull digitalocean v24.11.00274;
18+
19+
insert into
20+
digitalocean.projects.projects (
21+
data__name,
22+
data__purpose,
23+
data__environment
24+
)
25+
select
26+
'dashboard-k8s-project-uat',
27+
'Hosting materials for k8s stackql dashboards',
28+
'Staging'
29+
;
30+
31+
-- this needs to be captured... '18e7b3f9-46d5-4bc9-81cd-08eb19aad862' in this particular case
32+
select id from digitalocean.projects.projects where name = 'dashboard-k8s-project-uat';
33+
34+
-- GOTTA click-ops this to be default project... for now
35+
36+
37+
38+
39+
-- predicated upon correct default project
40+
insert into
41+
digitalocean.kubernetes.clusters (
42+
data__name,
43+
data__region,
44+
data__version,
45+
data__node_pools,
46+
data__tags
47+
)
48+
select
49+
'stackql-dashboards-k8s-uat-01',
50+
'syd1',
51+
'1.31.1-do.5',
52+
'[
53+
{
54+
"size": "s-1vcpu-2gb",
55+
"count": 2,
56+
"name": "worker-pool"
57+
}
58+
]',
59+
'[
60+
"stackql-dashboards-k8s-uat-01",
61+
"stackql-dashboards",
62+
"uat"
63+
]'
64+
;
65+
66+
67+
-- here, wanna capture "id" for subsequent... 'b46e7d4f-da8b-4d7f-972c-544f2a37bf7d' ... can actually loop on this until ready -> may take ages
68+
select name, id from digitalocean.kubernetes.clusters where name = 'stackql-dashboards-k8s-uat-01';
69+
70+
71+
select * from digitalocean.kubernetes.clusters_credentials where cluster_id = 'b46e7d4f-da8b-4d7f-972c-544f2a37bf7d';
72+
73+
```
74+
75+
```bash
76+
77+
_clusterId=$(stackql exec --approot=./test/tmp/.create-digitalocean-k8s.stackql -o json "select name, id from digitalocean.kubernetes.clusters where name = 'stackql-dashboards-k8s-uat-01';" | jq -r '.[0].id')
78+
79+
_clusterAuthObj=$(stackql exec --approot=./test/tmp/.create-digitalocean-k8s.stackql -o json "select * from digitalocean.kubernetes.clusters_credentials where cluster_id = '${_clusterId}';" | jq -r '.[0]')
80+
81+
echo "cluster auth data = ${_clusterAuthObj}"
82+
83+
curl -H "Authorization: Bearer ${DIGITALOCEAN_TOKEN}" -X GET https://api.digitalocean.com/v2/kubernetes/clusters/${_clusterId}/kubeconfig > $(pwd)/test/tmp/kubeconfig/do-uat-kubeconfig.yaml
84+
85+
86+
kubectl --kubeconfig=$(pwd)/test/tmp/kubeconfig/do-uat-kubeconfig.yaml get ns
87+
```
88+
89+
## Notes
90+
91+
- `describe digitalocean.projects.projects;` returns only `column_anon`; but decent selct queries actually work.
92+
- Same also true for `describe digitalocean.droplets.droplets;`; probably endemic to the provider.
93+
- Pagination does not currently work, and appears to revolve around response body `"links":{"pages":{"last":"https://api.digitalocean.com/v2/images?page=14","next":"https://api.digitalocean.com/v2/images?page=2"}}`.
94+
- `stackql >>update digitalocean.projects.projects set is_default = true where project_id = 'c9027ad4-8e8a-47e8-9cb0-d9f0ae4d4b74';` -> `update statement RHS of type 'sqlparser.BoolVal' not yet supported`.
95+
- Debugging droplet init `cat /var/log/cloud-init-output.log`.
96+
- Viewing droplet startup script `cat /var/lib/cloud/instance/scripts/part-001`.
97+
- Apache2 service status `sudo systemctl status apache2`.

docs/walkthroughs/readwrite/create-stackql-dashboards-on-vm.md renamed to docs/walkthroughs/readwrite/create-stackql-dashboards-on-digitalocean-vm.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,5 @@ select
5252
- Pagination does not currently work, and appears to revolve around response body `"links":{"pages":{"last":"https://api.digitalocean.com/v2/images?page=14","next":"https://api.digitalocean.com/v2/images?page=2"}}`.
5353
- `stackql >>update digitalocean.projects.projects set is_default = true where project_id = 'c9027ad4-8e8a-47e8-9cb0-d9f0ae4d4b74';` -> `update statement RHS of type 'sqlparser.BoolVal' not yet supported`.
5454
- Debugging droplet init `cat /var/log/cloud-init-output.log`.
55+
- Viewing droplet startup script `cat /var/lib/cloud/instance/scripts/part-001`.
5556
- Apache2 service status `sudo systemctl status apache2`.

0 commit comments

Comments
 (0)