This repository has been archived by the owner on Sep 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathhttp_socket_application.sh
62 lines (61 loc) · 2.04 KB
/
http_socket_application.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
sudo crictl pull docker.io/tpmccallum/http_client
if [ -f http_client_sandbox_config.json ]
then
rm -rf http_client_sandbox_config.json
fi
if [ -f http_client_container_wasi.json ]
then
rm -rf http_client_container_wasi.json
fi
wget https://raw.githubusercontent.com/second-state/crunw/main/http_client_sandbox_config.json
wget https://raw.githubusercontent.com/second-state/crunw/main/http_client_container_wasi.json
echo -e "Creating POD ..."
POD_ID=$(sudo crictl runp http_client_sandbox_config.json)
echo -e "POD_ID: $POD_ID"
CONTAINER_ID=$(sudo crictl create $POD_ID http_client_container_wasi.json http_client_sandbox_config.json)
echo -e "CONTAINER_ID: $CONTAINER_ID"
sudo crictl start $CONTAINER_ID
sudo crictl ps -a
echo -e "Sleeping for 10 seconds"
sleep 10
echo -e "Awake again"
sudo crictl ps -a
echo -e "Checking logs ...\n\n"
sudo crictl logs $CONTAINER_ID
echo -e "\n\nFinished\n\n"
# Clean up
echo -e "Cleaning up ..."
rm -rf http_client_sandbox_config.json
rm -rf http_client_container_wasi.json
echo -e "Done!"
sudo crictl pull docker.io/tpmccallum/http_server
if [ -f http_server_sandbox_config.json ]
then
rm -rf http_server_sandbox_config.json
fi
if [ -f http_server_container_wasi.json ]
then
rm -rf http_server_container_wasi.json
fi
wget https://raw.githubusercontent.com/second-state/crunw/main/http_server_sandbox_config.json
wget https://raw.githubusercontent.com/second-state/crunw/main/http_server_container_wasi.json
echo -e "Creating POD ..."
POD_ID=$(sudo crictl runp http_server_sandbox_config.json)
echo -e "POD_ID: $POD_ID"
CONTAINER_ID=$(sudo crictl create $POD_ID http_server_container_wasi.json http_server_sandbox_config.json)
echo -e "CONTAINER_ID: $CONTAINER_ID"
sudo crictl start $CONTAINER_ID
sudo crictl ps -a
echo -e "Sleeping for 10 seconds"
sleep 10
echo -e "Awake again"
sudo crictl ps -a
echo -e "Checking logs ...\n\n"
sudo crictl logs $CONTAINER_ID
echo -e "\n\nFinished\n\n"
# Clean up
echo -e "Cleaning up ..."
rm -rf http_server_sandbox_config.json
rm -rf http_server_container_wasi.json
echo -e "Done!"