Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

[OBS-405]Add setup command for EC2 installation #242

Merged
merged 13 commits into from
Oct 19, 2023

Conversation

gmann42
Copy link
Contributor

@gmann42 gmann42 commented Sep 27, 2023

Why

  • To onboard as many users as possible
  • Current support is available only for Kubernetes, ECS but many of our users are running plain EC2

What

  • Adds a new command postman-lc-agent setup for installation in linux servers

How

  • After user runs setup
  • Checks for Postman api key and collectionId existence
  • Verifies api key has correct access permission
  • setupAgentForServer -> checkUserPermissions -> checkSystemdExists -> configureSystemdFiles -> enablePostmanAgent -> postChecks

func configureSystemdFiles

  • Read the env files as go template, fill in the api_key and collection id
  • Check or create directories /etc/default and /usr/lib/systemd/system
  • Over-write or create files /etc/default/postman-lc-agent and /usr/lib/systemd/system/postman-lc-agent.service

References

Test plan

  • collection Id missing, throw error collection missing
  • POSTMAN_API_KEY missing, throw error api key missing
  • Authorization/collection not existing in backend issues, throw incorrect api key error
  • Non root user, throw error saying use root
  • Systemd doesn't exist, throw error saying not supported yet
    TODO: Add more test cases

@gmann42 gmann42 requested a review from mgritter September 27, 2023 14:52
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/ec2.go Outdated Show resolved Hide resolved
cmd/internal/ec2/ec2.go Outdated Show resolved Hide resolved
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/add.go Show resolved Hide resolved
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
Copy link
Contributor

@mgritter mgritter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ready for final review, or still WIP?

cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/ec2.go Outdated Show resolved Hide resolved
@gmann42
Copy link
Contributor Author

gmann42 commented Oct 17, 2023

Is this ready for final review, or still WIP?

@mgritter This is ready for final review.

@gmann42 gmann42 requested a review from mgritter October 17, 2023 08:26
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
return nil
}

func configureSystemdFiles(collectionId string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error messages here are all minimally informational to the end user. What are they supposed to do next?

Probably, contact the support email for most of them, but are there any that can be corrected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't think user can do anything. because lack of systemd is quite unfixable.

cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/add.go Outdated Show resolved Hide resolved
cmd/internal/ec2/usage_error.go Outdated Show resolved Hide resolved
@gmann42 gmann42 merged commit 9609391 into main Oct 19, 2023
@gmann42 gmann42 deleted the OBS-405/linux-server-installation branch October 19, 2023 16:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants