Repository navigation
added floci support #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
added floci support #194
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| FROM floci/floci:2.3.0-compat@sha256:ecfd33bb98d3e0ce0e11d528730f0827c08ab18c9b331865203d67ec65c10c07 | ||
|
|
||
| ENV AWS_ENDPOINT_URL=http://floci:4566 \ | ||
| AWS_DEFAULT_REGION=us-east-1 \ | ||
| AWS_ACCESS_KEY_ID=test \ | ||
| AWS_SECRET_ACCESS_KEY=test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| services: | ||
| # Notice how the service name, container name and repo directory (where the Dockerfile lives) all match. | ||
| floci: | ||
| container_name: floci | ||
| build: ../scripts/docker/floci/ | ||
| ports: | ||
| - 4566:4566 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| require_relative 'utilities' | ||
| require_relative 'commodities' | ||
| require 'yaml' | ||
|
|
||
| def provision_floci(root_loc, new_containers) | ||
| # Load configuration.yml into a Hash | ||
| config = YAML.load_file("#{root_loc}/dev-env-config/configuration.yml") | ||
| return unless config['applications'] | ||
|
|
||
| # Did the container previously exist, if not then we MUST provision regardless of .commodities value | ||
| new_container = false | ||
| if new_containers.include?('floci') | ||
| new_container = true | ||
| puts colorize_yellow('The Floci container has been newly created - '\ | ||
| 'provision status in .commodities will be ignored') | ||
| end | ||
|
|
||
| floci_initialised = false | ||
|
|
||
| config['applications'].each_key do |appname| | ||
| # To help enforce the accuracy of the app's dependency file, only search for init script | ||
| # if the app specifically specifies floci in it's commodity list | ||
| next unless File.exist?("#{root_loc}/apps/#{appname}/configuration.yml") | ||
| next unless commodity_required?(root_loc, appname, 'floci') | ||
|
|
||
| # Load any init fragments contained in the apps into the docker commands list | ||
| if File.exist?("#{root_loc}/apps/#{appname}/fragments/floci-init-fragment.sh") | ||
| process_floci_fragment(root_loc, appname, floci_initialised, new_container) | ||
| end | ||
| end | ||
| end | ||
|
|
||
| def process_floci_fragment(root_loc, appname, floci_initialised, new_container) | ||
| result = floci_initialised | ||
| puts colorize_pink("Found a Floci init fragment in #{appname}") | ||
| if commodity_provisioned?(root_loc, appname, 'floci') && !new_container | ||
| puts colorize_yellow("Floci has previously been provisioned for #{appname}, skipping") | ||
| else | ||
| unless floci_initialised | ||
| init_floci | ||
| result = true | ||
| end | ||
| init_floci_sh(root_loc, appname) | ||
| end | ||
| result | ||
| end | ||
|
|
||
| def init_floci_sh(root_loc, appname) | ||
| # See comments in provision_postgres.rb for why we are doing it this way | ||
| run_command('tar -c' \ | ||
| " -C #{root_loc}/apps/#{appname}/fragments" \ | ||
| ' floci-init-fragment.sh' \ | ||
| ' | docker cp - floci:/') | ||
|
|
||
| cmd = 'docker exec floci bash -c "sh /floci-init-fragment.sh"' | ||
| exit_code = run_command(cmd) | ||
|
|
||
| puts colorize_lightblue("Completed #{appname} Floci fragment") | ||
|
|
||
| if ![0].include?(exit_code) | ||
| # if exit_code != 0 | ||
| puts colorize_red("Something went wrong with the Floci setup. Exitcode - #{exit_code}") | ||
| else | ||
| puts colorize_yellow("Floci initialised correctly. Exitcode - #{exit_code}.") | ||
| set_commodity_provision_status(root_loc, appname, 'floci', true) | ||
| end | ||
| end | ||
|
|
||
| def init_floci | ||
| # Start floci | ||
| run_command("#{ENV['DC_CMD']} up -d floci") | ||
| puts colorize_green('Floci is ready') | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #!/bin/bash | ||
|
|
||
| aws s3 mb s3://test-bucket |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.