Skip to content

Commit f250cd4

Browse files
authored
Merge pull request #81 from UoMResearchIT/code-extraction
Episode's code extraction
2 parents 94439ed + 8089eed commit f250cd4

17 files changed

+1293
-13
lines changed

.github/workflows/pr-close-signal.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
mkdir -p ./pr
1717
printf ${{ github.event.number }} > ./pr/NUM
1818
- name: Upload Diff
19-
uses: actions/upload-artifact@v3
19+
uses: actions/upload-artifact@v4
2020
with:
2121
name: pr
2222
path: ./pr

.github/workflows/pr-comment.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
contents: write
8383
steps:
8484
- name: 'Checkout md outputs'
85-
uses: actions/checkout@v3
85+
uses: actions/checkout@v4
8686
with:
8787
ref: md-outputs
8888
path: built

.github/workflows/pr-receive.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: "Upload PR number"
2626
id: upload
2727
if: ${{ always() }}
28-
uses: actions/upload-artifact@v3
28+
uses: actions/upload-artifact@v4
2929
with:
3030
name: pr
3131
path: ${{ github.workspace }}/NR
@@ -58,10 +58,10 @@ jobs:
5858
MD: ${{ github.workspace }}/site/built
5959
steps:
6060
- name: "Check Out Main Branch"
61-
uses: actions/checkout@v3
61+
uses: actions/checkout@v4
6262

6363
- name: "Check Out Staging Branch"
64-
uses: actions/checkout@v3
64+
uses: actions/checkout@v4
6565
with:
6666
ref: md-outputs
6767
path: ${{ env.MD }}
@@ -107,20 +107,20 @@ jobs:
107107
shell: Rscript {0}
108108

109109
- name: "Upload PR"
110-
uses: actions/upload-artifact@v3
110+
uses: actions/upload-artifact@v4
111111
with:
112112
name: pr
113113
path: ${{ env.PR }}
114114

115115
- name: "Upload Diff"
116-
uses: actions/upload-artifact@v3
116+
uses: actions/upload-artifact@v4
117117
with:
118118
name: diff
119119
path: ${{ env.CHIVE }}
120120
retention-days: 1
121121

122122
- name: "Upload Build"
123-
uses: actions/upload-artifact@v3
123+
uses: actions/upload-artifact@v4
124124
with:
125125
name: built
126126
path: ${{ env.MD }}

.github/workflows/sandpaper-main.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
steps:
3333

3434
- name: "Checkout Lesson"
35-
uses: actions/checkout@v3
35+
uses: actions/checkout@v4
3636

3737
- name: "Set up R"
3838
uses: r-lib/actions/setup-r@v2

.github/workflows/update-cache.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
needed: ${{ steps.renv.outputs.exists }}
4444
steps:
4545
- name: "Checkout Lesson"
46-
uses: actions/checkout@v3
46+
uses: actions/checkout@v4
4747
- id: renv
4848
run: |
4949
if [[ -d renv ]]; then
@@ -76,7 +76,7 @@ jobs:
7676
steps:
7777

7878
- name: "Checkout Lesson"
79-
uses: actions/checkout@v3
79+
uses: actions/checkout@v4
8080

8181
- name: "Set up R"
8282
uses: r-lib/actions/setup-r@v2

.github/workflows/update-workflows.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
if: ${{ needs.check_token.outputs.workflow == 'true' }}
3737
steps:
3838
- name: "Checkout Repository"
39-
uses: actions/checkout@v3
39+
uses: actions/checkout@v4
4040

4141
- name: Update Workflows
4242
id: update

code/episodes/docker-cli-toolkit.md

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
2+
3+
4+
5+
## Pulling and Listing Images
6+
```bash
7+
docker pull spuacv/spuc:latest
8+
```
9+
10+
## The structure of a Docker command
11+
Image: A diagram showing the syntactic structure of a Docker command
12+
13+
## Listing Images
14+
```bash
15+
docker image ls
16+
```
17+
## Inspecting
18+
```bash
19+
docker inspect spuacv/spuc:latest
20+
```
21+
```bash
22+
docker inspect spuacv/spuc:latest -f "Command: {{.Config.Cmd}}"
23+
```
24+
```bash
25+
docker inspect spuacv/spuc:latest -f "Entrypoint: {{.Config.Entrypoint}}"
26+
```
27+
```bash
28+
docker inspect spuacv/spuc:latest -f $'Command: {{.Config.Cmd}}\nEntrypoint: {{.Config.Entrypoint}}'
29+
```
30+
31+
## Default Command
32+
Image: A diagram representing the lifecycle of a container
33+
34+
### Further examples of container lifecycle
35+
Image: Further details and examples of the lifecycle of a container
36+
37+
38+
## Running
39+
```bash
40+
docker run spuacv/spuc:latest
41+
```
42+
```bash
43+
docker run -d spuacv/spuc:latest
44+
```
45+
## Listing Containers
46+
```bash
47+
docker ps
48+
```
49+
```bash
50+
docker ps -a
51+
```
52+
## Logs
53+
```bash
54+
docker logs ecstatic_nightingale
55+
```
56+
```bash
57+
curl -X PUT localhost:8321/unicorn_spotted?location=moon\&brightness=100
58+
```
59+
## Exposing ports
60+
```bash
61+
docker run -d -p 8321:8321 spuacv/spuc:latest
62+
```
63+
```bash
64+
docker ps
65+
```
66+
```bash
67+
curl -X PUT localhost:8321/unicorn_spotted?location=moon\&brightness=100
68+
```
69+
```bash
70+
docker logs unruffled_noyce
71+
```
72+
## Setting the name of a container
73+
```bash
74+
docker run -d --name spuc_container -p 8321:8321 spuacv/spuc:latest
75+
```
76+
```bash
77+
docker stop unruffled_noyce
78+
docker rm unruffled_noyce
79+
```
80+
81+
### Killing containers
82+
```bash
83+
docker kill ecstatic_nightingale
84+
```
85+
86+
```bash
87+
docker run -d --name spuc_container -p 8321:8321 spuacv/spuc:latest
88+
```
89+
```bash
90+
docker logs -f spuc_container
91+
```
92+
93+
### Logs
94+
95+
## Executing commands in a running container
96+
```bash
97+
docker exec spuc_container cat config/print.config
98+
```
99+
```bash
100+
docker exec -it spuc_container bash
101+
```
102+
```bash
103+
apt update
104+
apt install tree
105+
tree
106+
```
107+
108+
## Interactive sessions
109+
```bash
110+
docker run -it alpine:latest
111+
```
112+
113+
## Reviving Containers
114+
```bash
115+
docker kill spuc_container
116+
```
117+
```bash
118+
docker start spuc_container
119+
```
120+
```bash
121+
docker stats
122+
```
123+
## Cleaning up
124+
```bash
125+
docker kill spuc_container
126+
```
127+
```bash
128+
docker rm spuc_container
129+
```
130+
```bash
131+
docker image rm spuacv/spuc:latest
132+
```
133+
```bash
134+
docker system prune
135+
```
136+
### Automatic cleanup
137+
```bash
138+
docker run -d --rm --name spuc_container -p 8321:8321 spuacv/spuc:latest
139+
```
140+
141+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
2+
3+
4+
5+
## Microservices
6+
## Microservices in Docker Compose
7+
```yml
8+
services:
9+
proxy:
10+
image: 'jc21/nginx-proxy-manager:latest'
11+
ports:
12+
- '80:80'
13+
- '443:443'
14+
depends_on:
15+
- authelia
16+
healthcheck:
17+
test: ["CMD", "/bin/check-health"]
18+
19+
whoami:
20+
image: docker.io/traefik/whoami
21+
22+
authelia:
23+
image: authelia/authelia
24+
depends_on:
25+
lldap:
26+
condition: service_healthy
27+
volumes:
28+
- ${PWD}/config/authelia/config:/config
29+
environment:
30+
AUTHELIA_DEFAULT_REDIRECTION_URL: https://whoami.${URL}
31+
AUTHELIA_STORAGE_POSTGRES_HOST: authelia-postgres
32+
AUTHELIA_AUTHENTICATION_BACKEND_LDAP_URL: ldap://apperture-ldap:3890
33+
34+
lldap:
35+
image: nitnelave/lldap:stable
36+
depends_on:
37+
lldap-postgres:
38+
condition: service_healthy
39+
environment:
40+
LLDAP_LDAP_BASE_DN: dc=example,dc=com
41+
LLDAP_DATABASE_URL: postgres://user:pass@lldap-postgres/dbname
42+
volumes:
43+
- lldap-data:/data
44+
45+
lldap-postgres:
46+
image: postgres
47+
volumes:
48+
- lldap-postgres-data:/var/lib/postgresql/data
49+
healthcheck:
50+
test: ["CMD-SHELL", "pg_isready -U lldap"]
51+
52+
volumes:
53+
lldap-data:
54+
lldap-postgres-data:
55+
```
56+
Image: Apperture Services: Showing a user accessing WhoAmI via the web portal, which is protected by Authelia, which authenticates against an LDAP server, which pulls user data from a Postgres database.
57+
## Combining Stacks
58+
```yml
59+
# SPUC docker-compose.yml
60+
61+
+ networks:
62+
+ apperture:
63+
+ external: true
64+
+ name: apperture_default
65+
```
66+
Image: SPUC and Apperture Services: Showing a user accessing the SPUC interface via the web portal.
67+
## Rapid extension
68+
Image: SPUC and Apperture Services: Showing a user accessing the SPUC interface via the web portal, which is protected by Authelia, which authenticates against an LDAP server, which pulls user data from a Postgres database. The SPUC interface communicates with a Postgres database, a RabbitMQ message queue, a Telegraf sensor, and a MinIO object store.
69+
## They Lived Happily Ever After
70+
Image: Thank you for supporting the SPUA!

0 commit comments

Comments
 (0)