alphagov / verify-local-startup

Utilities to run the Verify Hub and stubs locally
MIT License
1 stars 4 forks source link

BAU Added experimental powershell scripts #93

Closed j-maynard closed 1 year ago

j-maynard commented 2 years ago

These largely replicate their bashshell equivelenets but with a focus on making things run natively in Windows (No WSL Required). The script checks to make sure Docker, Git and Ruby are all installed and if they are missing tells the user to go download them.

This is an inital commit of the PowerShell scripts. Although they have been extensively tested on Windows they've not yet been tested using PowerShell running on MacOS or Linux.

jkunle commented 2 years ago

This is what I got when I tired this out

`PS C:\Users\jkunle\Documents\verify-local-startup> .\startup.ps1


\ \ / / _ ()/ | | | | | | | / _|/ \ \ \ / / \ '| | || | | | | || | | | | ' \ | | | | | | \ V / / | | | | || | | | || | |) | | || | || | \/ _|| ||| _, | || ||_,|_./ __|_/ |___/ [+] Building 768.4s (17/17) FINISHED => [internal] load build definition from Dockerfile 5.2s => => transferring dockerfile: 954B 0.3s => [internal] load .dockerignore 4.3s => => transferring context: 84B 0.2s => [internal] load metadata for docker.io/library/ruby:2.7.3-alpine3.13 23.4s => [internal] load metadata for docker.io/library/golang:1.15.15-alpine3.13 23.1s => [stage-1 1/9] FROM docker.io/library/ruby:2.7.3-alpine3.13@sha256:b63a28fd862407f5a57486076c19003389d6a3c3f13dc6b198519064fbc12546 51.6s => => resolve docker.io/library/ruby:2.7.3-alpine3.13@sha256:b63a28fd862407f5a57486076c19003389d6a3c3f13dc6b198519064fbc12546 1.7s => => sha256:b63a28fd862407f5a57486076c19003389d6a3c3f13dc6b198519064fbc12546 977B / 977B 0.0s => => sha256:b8ab2d36410d34e3bfb666f9f76d23ea939a145dc32481c8ef67825e2b132559 1.36kB / 1.36kB 0.0s => => sha256:0654570c487c7f0b7f5c18f9c2f0b41ab3b9d4768ceb3f66ea199c540e2b5b97 6.05kB / 6.05kB 0.0s => => sha256:540db60ca9383eac9e418f78490994d0af424aab7bf6d0e47ac8ed4e2e9bcbba 2.81MB / 2.81MB 4.1s => => extracting sha256:540db60ca9383eac9e418f78490994d0af424aab7bf6d0e47ac8ed4e2e9bcbba 729.7s => => sha256:98a867505730167ce0636f0811cb765ebbde11bf979c1a9839f6915f2fc3b85b 1.22MB / 1.22MB 9.5s => => sha256:69c77620f6108dc0610cba72f77d68c271fb1b14cb0800a7a8b6aaeb8950fec9 222B / 222B 11.2s => => extracting sha256:98a867505730167ce0636f0811cb765ebbde11bf979c1a9839f6915f2fc3b85b 0.9s => => sha256:9b370d66bb9903810edd365042a2f34b7a59947c942741ab947cec1b00dc738d 23.21MB / 23.21MB 21.9s => => sha256:d9f4ad4e4f54edfb60dcbf3da39a0d79bb818be470a76b7aa5d940214fd6817b 171B / 171B 16.5s => => extracting sha256:69c77620f6108dc0610cba72f77d68c271fb1b14cb0800a7a8b6aaeb8950fec9 0.1s => => extracting sha256:9b370d66bb9903810edd365042a2f34b7a59947c942741ab947cec1b00dc738d 5.4s => => extracting sha256:d9f4ad4e4f54edfb60dcbf3da39a0d79bb818be470a76b7aa5d940214fd6817b 0.0s => [internal] load build context 3.9s => => transferring context: 1.83kB 0.3s => [golang 1/2] FROM docker.io/library/golang:1.15.15-alpine3.13@sha256:330f31a4415d97bb64f244d5f4d838bea7a7ee1ab5a1a0bac49e7973c57cbb88 88.6s => => resolve docker.io/library/golang:1.15.15-alpine3.13@sha256:330f31a4415d97bb64f244d5f4d838bea7a7ee1ab5a1a0bac49e7973c57cbb88 1.5s => => sha256:330f31a4415d97bb64f244d5f4d838bea7a7ee1ab5a1a0bac49e7973c57cbb88 1.65kB / 1.65kB 0.0s => => sha256:f69c99459e619d82c218b032e592ecdd215e24486e570df7972135c3d5146dbc 1.36kB / 1.36kB 0.0s => => sha256:83dcc9afdc08205e7529cde9383bcfd395b5522363f01d62540c7866b079c412 4.86kB / 4.86kB 0.0s => => sha256:540db60ca9383eac9e418f78490994d0af424aab7bf6d0e47ac8ed4e2e9bcbba 2.81MB / 2.81MB 4.5s => => sha256:adcc1eea9eeabb6de296adb3e0c1b0722cf13251ff3e4e2d0a5f7ed8e3d48342 281.27kB / 281.27kB 3.9s => => sha256:4c4ab2625f07be8d5c6e48046a05ff3ecc7f374b794a926fb62247b66b511909 154B / 154B 3.5s => => extracting sha256:540db60ca9383eac9e418f78490994d0af424aab7bf6d0e47ac8ed4e2e9bcbba 2.5s => => sha256:d01cb752872bf56a9c307522e77e37297715cfec78b1ff9365168a327ca095c0 107.24MB / 107.24MB 31.3s => => sha256:3d811a8f33ce39ab2a48255cba30cd2784c4b9660eecf02848c1e1651b759a00 154B / 154B 7.3s => => extracting sha256:adcc1eea9eeabb6de296adb3e0c1b0722cf13251ff3e4e2d0a5f7ed8e3d48342 0.8s => => extracting sha256:4c4ab2625f07be8d5c6e48046a05ff3ecc7f374b794a926fb62247b66b511909 0.0s => => extracting sha256:d01cb752872bf56a9c307522e77e37297715cfec78b1ff9365168a327ca095c0 32.9s => => extracting sha256:3d811a8f33ce39ab2a48255cba30cd2784c4b9660eecf02848c1e1651b759a00 0.0s => [stage-1 2/9] RUN apk --no-cache upgrade && apk add --no-cache build-base ncurses bash git openssl openjdk11 curl 65.1s => [golang 2/2] RUN apk --no-cache upgrade && apk add --no-cache build-base git && go get -u github.com/cloudflare/cfssl/cmd/... 523.4s => [stage-1 3/9] COPY --from=golang /go/bin /go/bin 11.0s => [stage-1 4/9] ADD Gemfile Gemfile 2.0s => [stage-1 5/9] ADD Gemfile.lock Gemfile.lock 2.8s => [stage-1 6/9] RUN bundle && curl --silent -O https://shibboleth.net/downloads/tools/xmlsectool/latest/xmlsectool-3.0.0-bin.zip && unzip xmlsectool-3.0.0-bin.zip 54.8s => [stage-1 7/9] COPY config/bashrc /root/.bashrc 3.3s => [stage-1 8/9] RUN chmod +x /root/.bashrc 5.1s => [stage-1 9/9] WORKDIR /verify-local-startup 3.6s => exporting to image 32.4s => => exporting layers 31.5s => => writing image sha256:19ab47579de9c4b1940b7d9cc78016498dbaaafcae9e0d98ce95214a592e23f8 0.2s => => naming to docker.io/library/verify-local-startup 0.1s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them ': No such file or directory The following gems are missing

current directory: C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/racc-1.5.2/ext/racc/cparse C:/Ruby27-x64/bin/ruby.exe -I C:/Ruby27-x64/lib/ruby/2.7.0 -r ./siteconf20211125-14104-jwv8en.rb extconf.rb checking for rb_ary_subseq()... extconf.rb failed Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/Ruby27-x64/bin/$(RUBY_BASE_NAME) C:/Ruby27-x64/lib/ruby/2.7.0/mkmf.rb:471:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from C:/Ruby27-x64/lib/ruby/2.7.0/mkmf.rb:564:intry_link0' from C:/Ruby27-x64/lib/ruby/2.7.0/mkmf.rb:582:in try_link' from C:/Ruby27-x64/lib/ruby/2.7.0/mkmf.rb:794:intry_func' from C:/Ruby27-x64/lib/ruby/2.7.0/mkmf.rb:1083:in block in have_func' from C:/Ruby27-x64/lib/ruby/2.7.0/mkmf.rb:971:inblock in checking_for' from C:/Ruby27-x64/lib/ruby/2.7.0/mkmf.rb:361:in block (2 levels) in postpone' from C:/Ruby27-x64/lib/ruby/2.7.0/mkmf.rb:331:inopen' from C:/Ruby27-x64/lib/ruby/2.7.0/mkmf.rb:361:in block in postpone' from C:/Ruby27-x64/lib/ruby/2.7.0/mkmf.rb:331:inopen' from C:/Ruby27-x64/lib/ruby/2.7.0/mkmf.rb:357:in postpone' from C:/Ruby27-x64/lib/ruby/2.7.0/mkmf.rb:970:inchecking_for' from C:/Ruby27-x64/lib/ruby/2.7.0/mkmf.rb:1082:in have_func' from extconf.rb:6:in

'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/racc-1.5.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/racc-1.5.2 for inspection. Results logged to C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/racc-1.5.2/gem_make.out

An error occurred while installing racc (1.5.2), and Bundler cannot continue. Make sure that gem install racc -v '1.5.2' --source 'http://rubygems.org/' succeeds before bundling.

In Gemfile: verify-metadata-generator was resolved to 0.0.2, which depends on nokogiri was resolved to 1.11.3, which depends on racc Traceback (most recent call last): 2: from ./lib/build-local.rb:5:in <main>' 1: from C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:inrequire' C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in require': cannot load such file -- os (LoadError) ERROR: Couldn't find env file: C:\Users\jkunle\Documents\verify-local-startup\.env Started - visit http://localhost:50130/test-rp to start a journey (may take some time to spin up) PS C:\Users\jkunle\Documents\verify-local-startup> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c854e8f3cd9e verify-local-startup "/bin/bash -c 'set -…" 4 hours ago Exited (127) 4 hours ago frosty_burnell PS C:\Users\jkunle\Documents\verify-local-startup>

owenblacker commented 1 year ago

This PR is no longer pertinent, as Verify has closed and this repo is being archived.