Skip to content

Commit f496d19

Browse files
committed
sc/installation(docker): replace Running the Sauce Connect Docker Container with a CI/CD Pipeline with links to readiness check
1 parent d4d69eb commit f496d19

File tree

1 file changed

+11
-47
lines changed
  • docs/secure-connections/sauce-connect-5/installation

1 file changed

+11
-47
lines changed

docs/secure-connections/sauce-connect-5/installation/docker.md

Lines changed: 11 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -43,58 +43,22 @@ Here are some benefits/use cases for using containerized Sauce Connect Proxy:
4343
--network="host" \
4444
-it saucelabs/sauce-connect:5.0
4545
```
46+
If desired, you can specify any additional [`sc run` options](/dev/cli/sauce-connect-5/run/) as environment variables.
4647

47-
If desired, you can specify any additional ["sc run" CLI arguments](/dev/cli/sauce-connect-5/run/).
48+
Alternatively, you can also mount a config file to the container by adding the `-v` option to the `docker run` command.
4849

49-
:::note
50-
The example above uses `--network="host"` docker option to allow Sauce Connect in the Docker container to access your local services in the host machine. This option does not work on MacOS and Windows. See [Connect from a container to a service on the macOS host](https://docs.docker.com/desktop/networking/#use-cases-and-workarounds) for more details.
51-
:::
52-
53-
## Running the Sauce Connect Docker Container with a CI/CD Pipeline
54-
55-
If you want to run this Docker image as part of your CI/CD pipeline, you would need a way to determine that Sauce Connect Proxy is ready to proxy the requests. You can achieve that by:
56-
57-
- Using the `/readyz` endpoint, available with the Sauce Connect Proxy [internal API server](/secure-connections/sauce-connect-5/operation/monitoring/#local-api-server).
58-
59-
### Readiness Endpoint
60-
61-
The readiness endpoint allows you to configure liveness and readiness HTTP probes. See the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) for more information.
62-
63-
Docker container exposes Sauce Connect Proxy [API server](/secure-connections/sauce-connect-5/operation/monitoring/#local-api-server) on port 8032. The readiness endpoint `/readyz` returns 200 response code when Sauce Connect Proxy is ready, 503 otherwise.
64-
65-
You can leverage the readiness endpoint in your CI/CD pipeline by running the following:
66-
67-
1. Create a bash script `wait-for-sc.sh` that will ensure the pipeline only continues after Sauce Connect Proxy is fully connected and ready.
68-
69-
```bash title="wait-for-sc.sh"
70-
timeout=45
71-
i=0
72-
until [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8032/readyz)" == "200" ]
73-
do
74-
let "++i"
75-
if [ $i -gt $timeout ]; then
76-
echo "Timed out after $i seconds waiting for Sauce Connect readiness, exiting..."
77-
exit 1
78-
fi
79-
sleep 1
80-
done
81-
echo "SC ready"
50+
```bash
51+
$ docker run \
52+
-v /path/to/config.yaml:/etc/sauce-connect/sauce-connect.yaml \
53+
--network="host"\
54+
-it saucelabs/sauce-connect:5.0
8255
```
8356

84-
1. Run Sauce Connect Docker container using the script below. It is important that you map port 8032 (that is, `-p 8032:8032`) so that the port is available to the host.
57+
See [Sauce Connect Proxy Readiness Checks](/secure-connections/sauce-connect-5/operation/readiness-checks) for more information on how to check if the tunnel is ready to accept jobs.
8558

86-
```bash
87-
$ docker run \
88-
--detach \
89-
-e SAUCE_USERNAME=${SAUCE_USERNAME} \
90-
-e SAUCE_ACCESS_KEY=${SAUCE_ACCESS_KEY} \
91-
-e SAUCE_REGION=${SAUCE_REGION} \
92-
-e SAUCE_TUNNEL_NAME=${SAUCE_TUNNEL_NAME} \
93-
-p 8032:8032 \
94-
-t saucelabs/sauce-connect:5.0 \
95-
-i your-docker-tunnel
96-
$ ./wait-for-sc.sh
97-
```
59+
:::note
60+
The example above uses `--network="host"` docker option to allow Sauce Connect in the Docker container to access your local services in the host machine. This option does not work on MacOS and Windows. See [Connect from a container to a service on the macOS host](https://docs.docker.com/desktop/networking/#use-cases-and-workarounds) for more details.
61+
:::
9862

9963
## Additional Resources
10064

0 commit comments

Comments
 (0)