Skip to content

Commit 45f44e5

Browse files
committed
Small documentation and usability improvements.
- Fix two typos in code - Add syntax to code blocks in documentation and other markdown documents - Add vscode folder to git ignored folders
1 parent 1f13236 commit 45f44e5

6 files changed

Lines changed: 56 additions & 29 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
public
22
/target/
3+
4+
# VSCode
5+
/.vscode/

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,21 @@ Precompiled binaries can be downloaded from the releases page (for linux and OSX
6969

7070
To obtain `curl` and extract the latest linux binary directly in your shell, run
7171

72-
```
72+
```shell
7373
$ curl -L https://github.com/Metaswitch/floki/releases/download/0.6.1/floki-0.6.1-linux.tar.gz | tar xzvf -
7474
```
7575

7676
You should be able to run `floki` from your working directory:
7777

78-
```
78+
```shell
7979
$ ./floki --version
8080
floki 0.6.1
8181
```
8282

8383
Move it onto your path to run it from anywhere. E.g.
8484

85-
```
86-
# mv floki /usr/local/bin/
85+
```shell
86+
$ mv floki /usr/local/bin/
8787
```
8888

8989
Enjoy!
@@ -92,7 +92,7 @@ Enjoy!
9292

9393
`floki` can also be installed directly from `cargo`.
9494

95-
```
95+
```shell
9696
$ cargo install floki
9797
```
9898

docs/content/documentation/getting-started.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,54 @@ draft: false
66

77
## Installation
88

9+
### Prerequisites
10+
11+
It's recommended you add your user to the `docker` group:
12+
13+
```shell
14+
sudo usermod -a -G docker USERNAME
15+
```
16+
17+
and logout and in again to pick up the changes.
18+
19+
Alternatively you can run `floki` (after installation) with `sudo -E floki`.
20+
21+
### Installation from pre-built binaries
22+
923
Precompiled binaries for linux and OSX can be downloaded from the [releases](https://github.com/Metaswitch/floki/releases) page.
1024

1125
For example, to obtain the latest binary with `curl` and extract it, run
1226

13-
```
27+
```shell
1428
$ curl -L https://github.com/Metaswitch/floki/releases/download/0.6.1/floki-0.6.1-linux.tar.gz | tar xzvf -
1529
```
1630

1731
in a shell. You should now be able to run `floki` from your working directory:
1832

19-
```
33+
```shell
2034
$ ./floki --version
2135
floki 0.6.1
2236
```
2337

2438
Copy this into your path to run it without needing to specify the path absolutely. E.g.
2539

40+
```shell
41+
$ mv floki /usr/local/bin/
2642
```
27-
# mv floki /usr/local/bin/
43+
44+
### Installation from cargo
45+
46+
`floki` can also be installed directly from `cargo`.
47+
48+
```shell
49+
$ cargo install floki
2850
```
2951

52+
### Shell completions
53+
3054
Shell completions can be added to your existing shell session with
3155

32-
```
56+
```shell
3357
source <(floki completion <shell>)
3458
```
3559

@@ -41,21 +65,21 @@ Enjoy!
4165

4266
`floki` is configured using a configuration file typically placed in the root of your codebase. As a basic example, write a basic configuration file, and name it `floki.yaml`.
4367

44-
```
68+
```yaml
4569
image: debian:latest
4670
init:
4771
- echo "Welcome to your first floki container!"
4872
```
4973
5074
Now, in the same directory, run
5175
52-
```
76+
```shell
5377
floki
5478
```
5579

5680
A container will launch with the working directory mounted as your working directory. Verify this by running `ls`:
5781

58-
```
82+
```shell
5983
$ ls
6084
... floki.yaml ...
6185
```
@@ -68,7 +92,7 @@ In general, invoking `floki` in any child directory of this root directory will
6892

6993
You can use a different configuration file with `floki` by telling it to use a different file from the command line. For example, if you have another configuration in `config.yaml`, you can run `floki` with
7094

71-
```
95+
```shell
7296
floki -c config.yaml
7397
```
7498

docs/content/intro/feature-overview.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The ideal workflow is
2222

2323
Using a prebuilt image (e.g. one from dockerhub or a docker registry) is as simple as providing its name as a top-level key in `floki.yaml`:
2424

25-
```
25+
```yaml
2626
image: debian:sid
2727
```
2828
@@ -34,7 +34,7 @@ Custom registries can be used by configuring `docker` to use these registries. `
3434

3535
`floki` can use an image built from a `Dockerfile` in source tree. It's easiest to see an example of `floki.yaml` to see how to configure this.
3636

37-
```
37+
```yaml
3838
image:
3939
build:
4040
name: foo # Will build the image with name foo:floki
@@ -44,9 +44,9 @@ image:
4444
```
4545

4646
## Referencing a key in another yaml file
47-
`floki` can use an image by reference to another yaml file. This can help keep local development environments sync'd with a CI environment.
47+
`floki` can use an image by reference to another yaml file. This can help keep local development environments synced with a CI environment.
4848

49-
```
49+
```yaml
5050
image:
5151
yaml:
5252
file: .gitlab-ci.yaml
@@ -67,7 +67,7 @@ The default shell is `sh`.
6767

6868
A shell can be set for a container using the top-level `shell` key:
6969

70-
```
70+
```yaml
7171
image: alpine:latest
7272
shell: sh
7373
```
@@ -76,7 +76,7 @@ shell: sh
7676

7777
A different shell can be used for initialization and the interactive shell provided to the user.
7878

79-
```
79+
```yaml
8080
image: alpine:latest
8181
shell:
8282
inner: bash
@@ -87,7 +87,7 @@ init:
8787

8888
A useful use case here is if you want to run the container with the same user as on the host. `floki` exposes the user id and user group id in environment variables, so you can add a user to the running container and switch to the new user in the inner shell:
8989

90-
```
90+
```yaml
9191
image: foo:latest
9292
shell:
9393
inner: bash
@@ -102,7 +102,7 @@ The commands to make the above work depend on the container you are running. `fl
102102

103103
Docker-in-docker (`dind`) can be enabled by setting the top-level `dind` key to `true`.
104104

105-
```
105+
```yaml
106106
image: foo:bar
107107
dind: true
108108
```
@@ -111,7 +111,7 @@ Note that the docker CLI tools are still required in the container, and the dock
111111

112112
The precise `dind` image can also be set
113113

114-
```
114+
```yaml
115115
dind:
116116
image: docker:stable-dind
117117
```
@@ -122,7 +122,7 @@ This helps properly pin and version the docker-in-docker container.
122122

123123
`floki` has the ability to use volumes for caching build artifacts between runs of the container (amongst other things). Volumes can be configured in `floki.yaml`:
124124

125-
```
125+
```yaml
126126
volumes:
127127
cargo-registry:
128128
mount: /home/rust/.cargo/registry
@@ -132,7 +132,7 @@ The key names the volume (it can be any valid yaml name), while the `mount` key
132132

133133
It's also possible to share volumes across different `floki.yaml`s. For example, you may want to share a `cargo` registry across all Rust build containers. These shared volumes are identified by the name given to the volume.
134134

135-
```
135+
```yaml
136136
volumes:
137137
cargo-registry:
138138
shared: true
@@ -162,7 +162,7 @@ You can set where this directory is mounted in the container using the `mount` k
162162

163163
Sometimes it is useful to be able to pull dependencies from source code management servers for builds. To make this easier to do in an automated fashion, `floki` can forward and `ssh-agent` socket into the container, and expose its path through `SSH_AUTH_SOCK`.
164164

165-
```
165+
```yaml
166166
forward_ssh_agent: true
167167
```
168168

@@ -172,7 +172,7 @@ You will need to have an `ssh-agent` running on the host before launching `floki
172172

173173
`floki` also allows single commands to be run, rather than dropping into an interactive shell.
174174

175-
```
175+
```shell
176176
$ floki run ls
177177
floki.yaml
178178
```
@@ -184,7 +184,7 @@ Note that if you have configured an inner shell, the command will run within the
184184

185185
`floki` also allows you to pass additional switches to the underlying docker command, for example to forward port `8080` to the host.
186186

187-
```
187+
```yaml
188188
image: debian:sid
189189
docker_switches:
190190
- -p

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl FlokiConfig {
120120
.parent()
121121
.ok_or_else(|| errors::FlokiInternalError::InternalAssertionFailed {
122122
description: format!(
123-
"could not constuct path to external yaml file '{:?}'",
123+
"could not construct path to external yaml file '{:?}'",
124124
&yaml.file
125125
),
126126
})?

src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub enum FlokiError {
5252
exit_status: FlokiSubprocessExitStatus,
5353
},
5454

55-
#[fail(display = "Failed to check existance of image '{}': {}", image, error)]
55+
#[fail(display = "Failed to check existence of image '{}': {}", image, error)]
5656
FailedToCheckForImage { image: String, error: io::Error },
5757

5858
#[fail(display = "Failed to find the key '{}' in file '{}'", key, file)]

0 commit comments

Comments
 (0)