Skip to content

Commit bc79f4d

Browse files
committed
Refresh docs
1 parent 34db298 commit bc79f4d

5 files changed

Lines changed: 191 additions & 36 deletions

File tree

README.md

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,63 @@
22

33
Stack allows building and deployment of a suite of related applications as a single "stack". It is a fork of https://git.vdb.to/cerc-io/stack intended for more general use.
44

5+
## Quick Start
6+
7+
### Docker
8+
9+
```
10+
# clone / build
11+
stack fetch stack bozemanpass/example-todo-list
12+
stack build containers --stack ~/bpi/example-todo-list/stacks/todo
13+
14+
# config
15+
stack config init \
16+
--stack ~/bpi/example-todo-list/stacks/todo \
17+
--output todo.yml \
18+
--map-ports-to-host localhost-same
19+
20+
# create the deployment from the config
21+
stack deploy --spec-file todo.yml --deployment-dir ~/deployments/todo
22+
23+
# start / status / logs / stop
24+
stack manage --dir ~/deployments/todo start
25+
stack manage --dir ~/deployments/todo status
26+
stack manage --dir ~/deployments/todo logs
27+
stack manage --dir ~/deployments/todo stop
28+
```
29+
30+
### Kubernetes
31+
32+
```
33+
# clone / build
34+
stack fetch stack bozemanpass/example-todo-list
35+
stack build containers --stack ~/bpi/example-todo-list/stacks/todo \
36+
--image-registry $IMAGE_REGISTRY \
37+
--publish-images
38+
39+
# config
40+
stack config --deploy-to k8s init \
41+
--stack ~/bpi/example-todo-list/stacks/todo \
42+
--output todo.yml \
43+
--image-registry $IMAGE_REGISTRY \
44+
--kube-config /path/to/kubeconfig.yaml \
45+
--http-proxy example-todo.bpi.servesthe.world:frontend:3000 \
46+
--http-proxy example-todo.bpi.servesthe.world/api/todos:backend:5000 \
47+
--config REACT_APP_API_URL=https://example-todo.bpi.servesthe.world/api/todos
48+
49+
# create the deployment from the config
50+
stack deploy --spec-file todo.yml --deployment-dir ~/deployments/todo
51+
52+
# push image tags for this deployment to the image registry used by Kubernetes
53+
stack manage --dir ~/deployments/todo push-images
54+
55+
# start / status / logs / stop
56+
stack manage --dir ~/deployments/todo start
57+
stack manage --dir ~/deployments/todo status
58+
stack manage --dir ~/deployments/todo logs
59+
stack manage --dir ~/deployments/todo stop
60+
```
61+
562
## Install
663

764
**To get started quickly** on a fresh Ubuntu instance (e.g, Digital Ocean); [try this script](./scripts/quick-install-linux.sh). **WARNING:** always review scripts prior to running them so that you know what is happening on your machine.
@@ -12,7 +69,7 @@ For any other installation, follow along below and **adapt these instructions ba
1269
Ensure that the following are already installed:
1370

1471
- [Python3](https://wiki.python.org/moin/BeginnersGuide/Download): `python3 --version` >= `3.8.10` (the Python3 shipped in Ubuntu 20+ is good to go)
15-
- [Docker](https://docs.docker.com/get-docker/): `docker --version` >= `20.10.21`
72+
- [Docker](https://docs.docker.com/get-docker/): `docker --version` >= `20.10.21` or [podman](https://podman.io/) `podman --version` >= `3.4.4`
1673
- [jq](https://stedolan.github.io/jq/download/): `jq --version` >= `1.5`
1774
- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git): `git --version` >= `2.10.3`
1875

@@ -24,8 +81,8 @@ curl -SL https://github.com/docker/compose/releases/download/v2.11.2/docker-comp
2481
chmod +x ~/.docker/cli-plugins/docker-compose
2582
```
2683

27-
Next decide on a directory where you would like to put the stack program. Typically this would be
28-
a "user" binary directory such as `~/bin` or perhaps `/usr/local/stack` or possibly just the current working directory.
84+
Next decide on a directory where you would like to put the stack program. Typically, this would be
85+
a "user" binary directory such as `~/bin` or perhaps `/usr/local/bin/stack` or possibly just the current working directory.
2986

3087
Now, having selected that directory, download the latest release from [this page](https://github.com/bozemanpass/stack/tags) into it (we're using `~/bin` below for concreteness but edit to suit if you selected a different directory). Also be sure that the destination directory exists and is writable:
3188

@@ -47,12 +104,6 @@ Verify operation (your version will probably be different, just check here that
47104
stack version
48105
Version: 2.0.0-fb86d3c-202503251632
49106
```
50-
Save the distribution url to `~/.stack/config.yml`:
51-
> Note: You only need to do this if you are using a fork from a different URL, rather than the main release from https://github.com/bozemanpass/stack
52-
```bash
53-
mkdir ~/.stack
54-
echo "distribution-url: https://github.com/bozemanpass/stack/releases/latest/download/stack" > ~/.stack/config.yml
55-
```
56107

57108
### Update
58109
If `stack` was installed using the process above, it is able to self-update to the current latest version by running:
@@ -61,10 +112,17 @@ If `stack` was installed using the process above, it is able to self-update to t
61112
stack update
62113
```
63114

64-
## Contributing
115+
#### Alternate Update Locations (e.g., a fork)
65116

66-
See the [CONTRIBUTING.md](/docs/CONTRIBUTING.md) for developer mode install.
117+
If you want to update from a different location (e.g., a fork), you can do so setting the distribution URL to use:
67118

68-
## Platform Support
119+
Save the alternate distribution URL in `~/.stack/config.yml`:
120+
121+
```bash
122+
mkdir ~/.stack
123+
echo "distribution-url: https://github.com/example-org/my-stack-fork/releases/latest/download/stack" > ~/.stack/config.yml
124+
```
125+
126+
## Contributing
69127

70-
Native aarm64 is _not_ currently supported.
128+
See the [CONTRIBUTING.md](/docs/CONTRIBUTING.md) for developer mode install.d

docs/cli.md

Lines changed: 109 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,136 @@
22

33
Sub-commands and flags
44

5+
## fetch stack
6+
```
7+
$ stack fetch stack bozemanpass/example-todo-list
8+
```
9+
510
## fetch repositories
611

712
Clone the repositories for a stack:
813
```
9-
$ stack fetch repositories --stack ~/bpi/gitea-stack
14+
$ stack fetch repositories --stack ~/bpi/example-todo-list/stacks/todo
1015
```
1116
Pull latest commits from origin:
1217
```
13-
$ stack fixturenet-eth fetch repositories --stack ~/bpi/gitea-stack --pull
18+
$ stack fetch repositories --stack ~/bpi/example-todo-list/stacks/todo --pull
1419
```
1520
Use SSH rather than https:
1621
```
17-
$ stack fixturenet-eth fetch repositories --stack ~/bpi/gitea-stack --git-ssh
22+
$ stack fetch repositories --stack ~/bpi/example-todo-list/stacks/todo --git-ssh
1823
```
1924

2025
## build containers
2126

22-
Build a single container:
27+
Build all containers:
28+
```
29+
$ stack build containers --stack ~/bpi/example-todo-list/stacks/todo
30+
```
31+
Build a specific container:
32+
```
33+
$ stack build containers --stack ~/bpi/example-todo-list/stacks/todo --include "bpi/todo-frontend"
34+
```
35+
Force full rebuild of container images:
2336
```
24-
$ stack build containers --include <container-name>
37+
$ stack build containers --stack ~/bpi/example-todo-list/stacks/todo --build-policy build-force
2538
```
26-
e.g.
39+
40+
See [fetching-containers](fetching-containers.md) for more information on fetching, building,
41+
and checking for container images.
42+
43+
## config
44+
45+
Create a configuration spec file with the default values:
2746
```
28-
$ stack build containers --include bpi/go-ethereum
47+
$ stack config init --stack ~/bpi/example-todo-list/stacks/todo --output todo.yml
2948
```
30-
Build the containers for a stack:
49+
50+
Map stack ports to localhost:
3151
```
32-
$ stack --stack <stack-name> build containers
52+
$ stack config init --stack ~/bpi/example-todo-list/stacks/todo --output todo.yml --map-ports-to-host localhost-same
3353
```
34-
e.g.
54+
55+
Set a configuration value:
3556
```
36-
$ stack --stack fixturenet-eth build containers
57+
$ stack config init --stack ~/bpi/example-todo-list/stacks/todo --output todo.yml \
58+
--map-ports-to-host localhost-same \
59+
--config REACT_APP_API_URL=http://127.0.0.1:5000/api/todos
3760
```
38-
Force full rebuild of container images:
61+
62+
Full Kubernetes configuration with image registry, HTTP ingress, and environment settings:
63+
```
64+
$ stack config --deploy-to k8s init \
65+
--stack ~/bpi/example-todo-list/stacks/todo \
66+
--output todo.yml \
67+
--image-registry $IMAGE_REGISTRY \
68+
--kube-config /path/to/kubeconfig.yaml \
69+
--http-proxy example-todo.bpi.servesthe.world:frontend:3000 \
70+
--http-proxy example-todo.bpi.servesthe.world/api/todos:backend:5000 \
71+
--config REACT_APP_API_URL=https://example-todo.bpi.servesthe.world/api/todos
72+
```
73+
74+
## deploy
75+
76+
Deploy the stack according to the configuration spec:
77+
78+
```
79+
$ stack deploy --spec-file todo.yml --deployment-dir ~/deployments/todo
80+
```
81+
82+
## manage
83+
84+
Push image tags for stack containers (needed with Kubernetes and external image registries):
85+
```
86+
$ stack manage --deployment-dir ~/deployments/todo push-images
87+
```
88+
89+
Start the stack:
90+
```
91+
$ stack manage --deployment-dir ~/deployments/todo start
92+
```
93+
94+
Stop the stack:
95+
```
96+
$ stack manage --deployment-dir ~/deployments/todo stop
97+
```
98+
99+
Stop the stack and delete volumes:
100+
```
101+
$ stack manage --deployment-dir ~/deployments/todo stop --delete-volumes
102+
```
103+
104+
Reload to pick up config changes:
105+
```
106+
$ stack manage --deployment-dir ~/deployments/todo reload
107+
```
108+
109+
Show basic stack and container status:
110+
```
111+
$ stack manage --deployment-dir ~/deployments/todo status
112+
```
113+
114+
List running container ids, names, and ports:
115+
```
116+
$ stack manage --deployment-dir ~/deployments/todo ps
117+
```
118+
119+
Show port mapping details for a specific service and port:
120+
```
121+
$ stack manage --deployment-dir ~/deployments/todo port frontend 3000
122+
```
123+
124+
Print service logs:
125+
```
126+
$ stack manage --deployment-dir ~/deployments/todo logs
127+
```
128+
129+
Follow logs (limited to _n_ lines):
130+
```
131+
$ stack manage --deployment-dir ~/deployments/todo logs -f -n 10
132+
```
133+
134+
Execute a command in a running container:
39135
```
40-
$ stack build containers --include <container-name> --force-rebuild
136+
$ stack manage --dir ~/deployments/todo exec frontend 'node --version'
41137
```

docs/webapp.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Building and Running Webapps
22

3-
It is possible to build and run Next.js webapps using the `webapp build` and `webapp run` subcommands.
3+
It is possible to build and run static, React, and Next.js webapps using the `webapp build` and `webapp run` subcommands.
44

55
To make it easier to build once and deploy into different environments and with different configuration,
66
compilation and static page generation are separated in the `webapp build` and `webapp run` steps.
@@ -18,7 +18,7 @@ can be overidden with the build arguments `BPI_NEXT_VERSION` and `BPI_BUILD_TOOL
1818
**Example**:
1919
```
2020
$ cd ~/bpi
21-
$ git clone git@git.vdb.to:cerc-io/test-progressive-web-app.git
21+
$ git clone https://github.com/bozemanpass/test-progressive-web-app
2222
$ stack webapp build --source-repo ~/bpi/test-progressive-web-app
2323
...
2424
@@ -53,12 +53,12 @@ ID: 9ab96494f563aafb6c057d88df58f9eca81b90f8721a4e068493a289a976051c
5353
URL: http://localhost:32769
5454
```
5555

56-
## Deploying
56+
## Deploy and Run
5757

58-
Use the subcommand `webapp init create` to make a deployment directory that can be subsequently deployed to a Kubernetes cluster.
58+
Use the subcommand `webapp deploy` to make a deployment directory that can be subsequently deployed to a Kubernetes cluster.
5959
Example commands are shown below, assuming that the webapp container image `bpi/test-progressive-web-app:stack` has already been built:
6060
```
61-
$ stack webapp init create --kube-config ~/kubectl/k8s-kubeconfig.yaml --image-registry registry.digitalocean.com/laconic-registry --deployment-dir webapp-k8s-deployment --image bpi/test-progressive-web-app:stack --url https://test-pwa-app.hosting.laconic.com/ --env-file test-webapp.env
62-
$ stack deployment --dir webapp-k8s-deployment push-images
63-
$ stack deployment --dir webapp-k8s-deployment start
61+
$ stack webapp deploy --kube-config ~/kubectl/k8s-kubeconfig.yaml --image-registry registry.digitalocean.com/laconic-registry --deployment-dir ~/bpi/webapp-k8s-deployment --image bpi/test-progressive-web-app:stack --url https://test-pwa-app.bpi.servesthe.world --env-file test-webapp.env
62+
$ stack manage --dir ~/bpi/webapp-k8s-deployment push-images
63+
$ stack manage --dir ~/bpi/webapp-k8s-deployment start
6464
```

src/stack/deploy/deploy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ def port_operation(ctx, extra_args):
148148
if global_context.verbose:
149149
print(f"Running compose port {service_name} {exposed_port}")
150150
mapped_port_data = ctx.obj.deployer.port(service_name, exposed_port)
151-
print(f"{mapped_port_data[0]}:{mapped_port_data[1]}")
151+
if mapped_port_data:
152+
print(f"{mapped_port_data[0]}:{mapped_port_data[1]}")
152153

153154

154155
def exec_operation(ctx, extra_args):

src/stack/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ def include_exclude_check(s, include, exclude):
3434
return True
3535
if include is not None:
3636
include_list = include.split(",")
37-
return s in include_list
37+
return s.name in include_list
3838
if exclude is not None:
3939
exclude_list = exclude.split(",")
40-
return s not in exclude_list
40+
return s.name not in exclude_list
4141

4242

4343
def get_stack_path(stack):

0 commit comments

Comments
 (0)