Add docker-compose files and requirements
[releng.git] / utils / test / vnfcatalogue / VNF_Catalogue / migration / 3rd_party / wait-for-it / README.md
1 # HELP NEEDED
2
3 ### March 13, 2017 update
4
5 Since I posted this request for help, I've had a dozen or so responses which I am now sorting through.  Applicants need to fill out [this](https://goo.gl/forms/GKCBFxaloaU47aky1) survey by March 17th.  I will select, notify and announce the new volunteer(s) on March 19th.  Once this is done, me and my team will work through the backlog of issues amd pull requests.  Thanks for your paitence.
6
7 ### Old request follows:
8
9 Hi there!  I wrote `wait-for-it` in order to help me orchestrate containers I operate at my day job.  I thought it was a neat little script, so I published it.  I assumed I would be its only user, but that's not what happened!  `wait-for-it` has received more stars then all of my other public repositories put together.  I had no idea this tool would solicit such an audience, and I was equally unprepared to carve out the time required to address my user's issues and patches.  I would like to solicit a volunteer from the community who would be willing to be a co-maintainer of this repository.  If this is something you might be interested in, please email me at `waitforit@polymerase.org`.  Thanks!
10
11 ## wait-for-it
12
13 `wait-for-it.sh` is a pure bash script that will wait on the availability of a host and TCP port.  It is useful for synchronizing the spin-up of interdependent services, such as linked docker containers.  Since it is a pure bash script, it does not have any external dependencies.
14
15 ## Usage
16
17 ```
18 wait-for-it.sh host:port [-s] [-t timeout] [-- command args]
19 -h HOST | --host=HOST       Host or IP under test
20 -p PORT | --port=PORT       TCP port under test
21                             Alternatively, you specify the host and port as host:port
22 -s | --strict               Only execute subcommand if the test succeeds
23 -q | --quiet                Don't output any status messages
24 -t TIMEOUT | --timeout=TIMEOUT
25                             Timeout in seconds, zero for no timeout
26 -- COMMAND ARGS             Execute command with args after the test finishes
27 ```
28
29 ## Examples
30
31 For example, let's test to see if we can access port 80 on www.google.com, and if it is available, echo the message `google is up`.
32
33 ```
34 $ ./wait-for-it.sh www.google.com:80 -- echo "google is up"
35 wait-for-it.sh: waiting 15 seconds for www.google.com:80
36 wait-for-it.sh: www.google.com:80 is available after 0 seconds
37 google is up
38 ```
39
40 You can set your own timeout with the `-t` or `--timeout=` option.  Setting the timeout value to 0 will disable the timeout:
41
42 ```
43 $ ./wait-for-it.sh -t 0 www.google.com:80 -- echo "google is up"
44 wait-for-it.sh: waiting for www.google.com:80 without a timeout
45 wait-for-it.sh: www.google.com:80 is available after 0 seconds
46 google is up
47 ```
48
49 The subcommand will be executed regardless if the service is up or not.  If you wish to execute the subcommand only if the service is up, add the `--strict` argument. In this example, we will test port 81 on www.google.com which will fail:
50
51 ```
52 $ ./wait-for-it.sh www.google.com:81 --timeout=1 --strict -- echo "google is up"
53 wait-for-it.sh: waiting 1 seconds for www.google.com:81
54 wait-for-it.sh: timeout occurred after waiting 1 seconds for www.google.com:81
55 wait-for-it.sh: strict mode, refusing to execute subprocess
56 ```
57
58 If you don't want to execute a subcommand, leave off the `--` argument.  This way, you can test the exit condition of `wait-for-it.sh` in your own scripts, and determine how to proceed:
59
60 ```
61 $ ./wait-for-it.sh www.google.com:80
62 wait-for-it.sh: waiting 15 seconds for www.google.com:80
63 wait-for-it.sh: www.google.com:80 is available after 0 seconds
64 $ echo $?
65 0
66 $ ./wait-for-it.sh www.google.com:81
67 wait-for-it.sh: waiting 15 seconds for www.google.com:81
68 wait-for-it.sh: timeout occurred after waiting 15 seconds for www.google.com:81
69 $ echo $?
70 124
71 ```
72
73 ## Thanks
74
75 I wrote this script for my employer, [Ginkgo Bioworks](http://www.ginkgobioworks.com/), who was kind enough to let me release it as an open source tool.  We are always looking to [hire](https://jobs.lever.co/ginkgobioworks) talented folks who are interested in working in the field of synthetic biology.