Giter Club home page Giter Club logo

gruntwork-installer's Introduction

gruntwork.io website

This is the code for the Gruntwork website.

Gruntwork can help you get your entire infrastructure, defined as code, in about a day. You focus on your product. We'll take care of the Gruntwork.

Docker quick start

The fastest way to launch this site is to use Docker.

  1. git clone this repo
  2. docker compose up
  3. Go to http://localhost:4000 to test
  4. If you are going to be testing the checkout flow, you must login to Aperture at: https://aperture.dogfood-stage.com/.

The default Docker compose configuration supports hot-reloading of your local environment, meaning that as you edit files to change markup, text, images, etc, your local development server will pick up these changes and reload the latest version of the site for you. This makes it quick and convenient to develop on the site locally.

Manual quick start

  1. git clone this repo
  2. Install Jekyll
  3. Just the first time: bundle install
  4. Start Jekyll server: bundle exec jekyll serve --livereload
  5. Go to http://localhost:4000
  6. If you are going to be testing the checkout flow, you must login to Aperture at: https://aperture.dogfood-stage.com/.

Deploying

To deploy the site:

  1. Create a PR with your code changes
  2. After the PR has been approved, merge it into master
  3. Create a new tag, you can do this manually via git or in the subsequent step on the releases page - be sure to increment the version number using semantic versioning
  4. Go to the releases page and create a draft release with the relevant information (use the "Generate Release Notes" button to make your life easier)
  5. Release it
  6. The CI/CD pipeline will deploy it automatically

Technologies

  1. Built with Jekyll. This website is completely static and we use basic HTML or Markdown for everything.
  2. Preview environments are built with Netlify.
  3. Hosted on Amazon S3, with CloudFront as a CDN. Using s3_website to automatically upload static content to S3.
  4. We use Bootstrap and Less.
  5. We're using UptimeRobot, Google Analytics, and HubSpot Traffic Analytics for monitoring and metrics.

Troubleshooting

Disabling the Jekyll Feed gem

The Gruntwork website uses a Ruby Gem called Jekyll Feed which generates a structured RSS feed of "posts" on the site. Unfortunately, in development this can significantly slow down the hot-reloading of the site, forcing you to wait upwards of a minute at a time to see minor text changes locally.

You'll know this is happening when you look at the STDOUT of your docker-compose process and the final count of seconds spent Generating feed for posts is greater than 5:

web_1  |       Regenerating: 1 file(s) changed at 2021-07-21 14:31:08
web_1  |                     _data/website-terms.yml
web_1  |        Jekyll Feed: Generating feed for posts
web_1  |                     ...done in 58.507850014 seconds.

As a temporary workaround, you can open the Gemfile in the root of the project directory and temporarily comment out the line that pulls in the Jekyll Feed dependency:

source 'https://rubygems.org'
gem 'jekyll', '~> 4.1'
gem 's3_website', '3.3.0'
group :jekyll_plugins do
  gem 'jekyll-redirect-from', '0.16.0'
  gem 'jekyll-sitemap', '1.4.0'
  gem 'jekyll-paginate', '1.1.0'
  gem 'therubyracer', '0.12.3'
  gem 'less', '2.6.0'
  gem 'jekyll-asciidoc'
  gem 'jekyll-toc'
  gem 'nokogiri', '1.11.0.rc4' # Addressing security issue in earlier versions of this library
#  gem 'jekyll-feed'
end

Important - Be sure that you don't end up committing this change because we do want the Jekyll Feed plugin to run for production!

I made changes locally but they're not being reflected in my hot-reloaded development environment

This can happen especially if you add or remove files from the website's working directory. When this occurs, terminate your docker-compose process and restart it to see your changes reflected.

License

See LICENSE.txt.

gruntwork-installer's People

Contributors

alainodea avatar autero1 avatar brikis98 avatar bwhaley avatar eak12913 avatar etiene avatar gruntwork-ci avatar harrymilne avatar hngerebara avatar hongil0316 avatar iangrunt avatar jalessio avatar jeckhart avatar josh-padnick avatar mcalhoun avatar oredavids avatar rhoboat avatar robmorgan avatar yorinasub17 avatar zackproser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gruntwork-installer's Issues

Broken module parameters parsing

Describe the bug
When you want to pass module parameter that is not in the format key=value, but is a flag, such as --no-cloudwatch-metrics in this module, you will see an error like this:

2024-04-11 11:38:01 [INFO] [gruntwork-install] Executing /tmp/gruntwork-script-modules/fail2ban/install.sh --no-cloudwatch-metrics no-cloudwatch-metrics
2024-04-11 11:38:01 [ERROR] [configure-fail2ban] Unrecognized argument: no-cloudwatch-metrics

The script is not prepared to accept a parameter other than one that has the format key=value. Look here.

To Reproduce

gruntwork-install --module-name 'fail2ban' --module-param 'no-cloudwatch-metrics' --repo https://github.com/gruntwork-io/module-security --tag 'v0.65.5'

Expected behavior
It should work fine with all existing parameters.

Bootstrap script should allow alternate destinations for binaries and user-data

Describe the solution you'd like
The bootstrap script is hardcoded to install binaries into /usr/local/bin, and to download user-data into /etc/user-data. This prevents running this script without root permissions, even though none of these artifacts need to be installed system-wide.

Describe alternatives you've considered

  • Manually install the prerequisites (fetch and gruntwork-installer), but this is error-prone.
  • Modify the bootstrap script to use alternate directories (I have done this, PR incoming).

Additional context
This is a minor change that can be accomplished by overriding the default values for two environment variables. It may not be widely used, and would be easily discovered by advanced users upon inspection of the script, so it does not need associated CLI args or even documentation.

Cannot install on a VM

A user provided this error log to illustrate that they couldn't use the installer to install openvpn-admin on a VM.

gruntwork-install --binary-name openvpn-admin --repo https://github.com/gruntwork-io/terraform-aws-openvpn --tag v0.5.4

Error:

2021-07-02 12:08:08 [INFO] [gruntwork-install] Installing openvpn-admin...

2021-07-02 12:08:09 [INFO] [gruntwork-install] Moving /tmp/gruntwork-script-modules/openvpn-admin_linux_amd64 to /usr/local/bin/openvpn-admin and setting execute permissions

mv: cannot stat '/tmp/gruntwork-script-modules/openvpn-admin_linux_amd64': No such file or directory

We suspect that this has to do with the downloaded file being in the wrong place (i.e., the native system instead of the VM), or something like that. Is this a case we should support?

Workaround: Allow the script to complete and error out. Manually scp or otherwise locate the file and move it to the right place, adding execute permissions.

Issues with fetch and PATH

bootstrap-gruntwork-installer.sh installs fetch into /usr/local/bin. Depending on the OS and the user (e.g., root), this directory is not always on the PATH. As a result, the call to fetch in gruntwork-install may fail.

We should either (1) call fetch from an absolute path in gruntwork-install or (2) install fetch into something more likely to be on the PATH, such as /usr/bin.

Provide a simple way to upgrade the tools

As I understand, to upgrade a tool we need to re-run the same command than for the installation, replacing the version.

It will be good for the sake of simplicity and to avoid the rot of the tool versions, to have a way to upgrade easily the different tools.

It could be a command: gruntwork upgrade. It will require of course some metadata regarding the list of the tools installed.

Did you considered using existing package managers (brew, apt-get, ...) ? There are solving lots of problems than new coming packing managers will face sooner or later.

I understand than some of your tools are private. Brew seems to provide a way to support this.

Reduce GitHub token scope needed to use gruntwork-install (from `repo` to `package:read`)

This issue is not valid - gruntworks modules are published via GitHub releases, not packages.


Hello ๐Ÿ‘‹

My name is Peter and I work at FreeAgent. We use Gruntworks extensively - thanks for your great work, it helps us a lot! I've got one quick request to raise however:

Currently the gruntwork-installer requires a GITHUB_OAUTH_TOKEN to be able to access the gruntworks modules as they live in private GitHub repositories.

This GITHUB_OAUTH_TOKEN currently needs to be a "Private Access Token" (link) with repo access. This means that the token has full read & write access to all repositories that that user has access to.

Describe the solution you'd like
Following the principle of least privilege, would it be possible to alter the installer to only need a GITHUB_OAUTH_TOKEN with read:package access.

image

The binaries that are eventually installed (in the use cases I've come across) are published as packages to GitHub, but I think the gruntworks-installer fails because it queries the tags before installing (logs at the bottom).

This might require adding an optional parameter to manually specify the GitHub release?

Describe alternatives you've considered
None

Additional context
The motivation behind wanting not to have a repo scoped token in our pipeline is that we'd like to allow dependabot to create PR and run CI, but want to grant as few permissions to that workflow as possible to mitigate against a malicious package stealing tokens.


Failure log when using a GITHUB_OAUTH_TOKEN scoped to only package:read:

#8 0.830 2022-04-26 10:49:41 [INFO] [gruntwork-install] Installing gruntkms...
#8 1.048 [fetch] time="2022-04-26T10:49:41Z" level=error msg="\nReceived an HTTP 404 Response when attempting to query the repo for its tags.\n\nThis means that either no GitHub repo exists at the URL provided, or that you don't have permission to access it.\nIf the URL is correct, you may need to pass in a --github-oauth-token.\n\nUnderlying error message:\nReceived HTTP Response 404 while fetching releases for GitHub URL https://api.github.com/repos/gruntwork-io/gruntkms/tags?per_page=100. Full HTTP response: {\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/reference/repos#list-repository-tags\"}\n\n"
#8 ERROR: process "/bin/sh -c curl -LSs https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version \"$GRUNTWORK_INSTALLER_VERSION\" &&   gruntwork-install --repo \"[https://github.com/gruntwork-io/gruntkms\](https://github.com/gruntwork-io/gruntkms/)" --binary-name \"gruntkms\" --tag \"$GRUNTKMS_VERSION\"" did not complete successfully: exit code: 1

Amazon Linux 2 doesn't support `sudo`

Behavior:

$ docker run --rm -it amazonlinux /bin/bash
bash-4.2# curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version v0.0.22
Installing gruntwork-install...
Installing fetch version v0.3.2 to /usr/local/bin/fetch
Downloading https://github.com/gruntwork-io/fetch/releases/download/v0.3.2/fetch_linux_amd64 to /tmp/gruntwork-bootstrap-download-FsgPxG
Got expected status code 200
Moving /tmp/gruntwork-bootstrap-download-FsgPxG to /usr/local/bin/fetch
/dev/stdin: line 71: sudo: command not found
bash-4.2# sudo
bash: sudo: command not found

From line 71 of bootstrap-gruntwork-installer.sh:

sudo mv -f "$tmp_path" "$file"

Looks like a check needs to be made on all sudo commands to not use sudo on Amazon Linux 2.

Better error messaging for curl failures

A customer recently had an issue with curl failing to download fetch. The error is:

Step 10/24 : RUN curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version v0.0.23
 ---> Running in b606ba274890
Installing gruntwork-install...
Installing fetch version v0.3.2 to /usr/local/bin/fetch
Downloading https://github.com/gruntwork-io/fetch/releases/download/v0.3.2/fetch_linux_amd64 to /tmp/gruntwork-bootstrap-download-JAaGkA
ERROR: Expected status code 200 but got 302 when downloading https://github.com/gruntwork-io/fetch/releases/download/v0.3.2/fetch_linux_amd64
The command '/bin/sh -c curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version v0.0.23' returned a non-zero code: 1

Upon investigation, the error turned out to be a network monitoring proxy that was in the middle of the SSL connection causing curl to fail SSL validation. This was being swallowed silently.

Gruntwork Installer Installing Vulnerable Fetch Package

Gruntwork installer needs to install an updated version of fetch. It is also possible that fetch will need to be patched after gruntwork install is installing the updated version. I am not sure if the most recent fetch release is patched.

Fetch details:

Installed version: 1.16.2
Patched version: 1.18.6
Paths: /usr/local/bin/fetch

Documentation is not up to date regarding the installation command and the latest version

The current one line command for the installation is working (curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version 0.0.11)

But if you want to install the latest version (currently 0.0.16), it is not working. It seems that, starting from the 0.0.14, the version start with the letter "v". The following command is working:
curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version v0.0.16

Install without sudo

Is it possible to install this on a machine without sudo? basically in a docker image (eg jenkins jnlp slave image). Related to #37

Improve messaging around a non-existent tag

Describe the bug
When installing cloud-nuke, I specified a tag that didn't exist (I omitted v from v0.16.2. The messaging was not crystal clear and led me astray:

2022-08-01 09:44:53 [INFO] [gruntwork-install] Moving /tmp/gruntwork-script-modules/cloud-nuke_darwin_amd64 to /usr/local/bin/cloud-nuke and setting execute permissions

There shouldn't be any attempt to move a non-existent binary. Even better, we might be able to detect that there was no tag specified and message that to make it really clear.

To Reproduce

$ gruntwork-install --binary-name 'cloud-nuke' --repo 'https://github.com/gruntwork-io/cloud-nuke' --tag '0.16.2'
2022-08-01 09:44:52 [INFO] [gruntwork-install] Installing cloud-nuke...
2022-08-01 09:44:53 [INFO] [gruntwork-install] Moving /tmp/gruntwork-script-modules/cloud-nuke_darwin_amd64 to /usr/local/bin/cloud-nuke and setting execute permissions
mv: rename /tmp/gruntwork-script-modules/cloud-nuke_darwin_amd64 to /usr/local/bin/cloud-nuke: No such file or directory

Expected behavior
Tell the user that there is no such tag.
Check to see if the binary exists before attempting to move it and message accordingly.

Add optional retry

Every now and then GitHub API fails with GitHub API error Failed to download file at the url https://api.github.com/repos/xxx/xxx/zipball/xxx. Received HTTP Response 502.. To make the installer more resilient to those transient errors, an optional retry should be added.

Because gruntwork-installer uses fetch, one option could be adding the retry to fetch instead.

Misleading INFO log: GITHUB_OAUTH_TOKEN env var is required

When calling gruntwork-install in a Dockerfile and attempting to download a private repo, we currently echo this INFO level log line to STDOUT:

2020-10-06 23:48:56 [INFO] [gruntwork-install] Repository is not public. GITHUB_OAUTH_TOKEN environment variable is required.

In my case, given my setup, this log line was dark red - so it seemed like an error.

The first couple of times, I mistook this as meaning that gruntwork-install was not finding the GITHUB_OAUTH_TOKEN it was looking for, when in fact it's just confirming that because you're attempting to access a private repo, the token is in fact required.

Does anyone else find this potentially confusing? If so, perhaps we should modify the messaging to be more explicit - or consider instead stating that a valid-looking GITHUB_OAUTH_TOKEN was found, etc.

Problem with build packer image

Hello.

I have a problem with running command:

    "type": "shell",
    "inline": [
      "curl -LsS  https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version v0.0.35"
    ]},

Looks like it stucks, I see no output from curl, packer try run next commands and from next shell provisioner but fails because command gruntwork-install is not available.

Fix local / readonly usage

The Gruntwork Installer is still using our old, incorrect bash pattern of declaring variables:

local readonly foo="bar"

Combining local and readonly this way doesn't actually work. We need to change to:

local -r foo="bar"

Or, in the case of arrays:

local -ar foo=("aaa" "bbb")

Define an optional alias so you know which function came from which module.

A typical gruntwork-installer configuration in circle.yml looks like this:

...
- curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version "v0.0.14"
    - gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/module-ci" --tag "v0.3.8"
    - gruntwork-install --binary-name "docs-generator" --repo "https://github.com/gruntwork-io/module-ci" --tag "v0.3.8"
...

test:
  override:
    - run-go-tests --path test

The question here is where did that run-go-tests function come from? it'd be nice to answer this systematically. For example, imagine this revised circle.yml:

...
- gruntwork-install --alias "cci" --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/module-ci" --tag "v0.3.8"
...
test:
  override:
    - cci.run-go-tests --path test

Now it's clear exactly where this came from.

For users browsing the OS, perhaps include a cci.help function that explains which gruntwork-installer command was used to install this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.