Skip to content
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

sample-data-service mock infra client data #4398

Merged
merged 14 commits into from
Nov 9, 2020

Conversation

kvivek1115
Copy link

@kvivek1115 kvivek1115 commented Oct 12, 2020

🔩 Description: What code changed, and why?

  • This PR only responsible to run sample-data-service using various deploy options.

  • Define sample-data-service as product and user can run this service using --product sample-data.

⛓️ Related Resources

#4141

👍 Definition of Done

  • sample-data-service is enabled and running.

👟 How to Build and Test the Change

  • rebuild components/sample-data-service
  • rebuild components/automate-deployment
  • in hab studio:
enable_sample_data_service

OR

> cat sample-data.toml 
[deployment.v1.svc]
      products = ["sample-data", "automate"]

> chef-automate config patch sample-data.toml

OR

> chef-automate deploy --product sample-data 
  • check sample-data-service status chef-automate status
sample-data-service     running        ok            12204      4977 

✅ Checklist

📷 Screenshots, if applicable

@kvivek1115 kvivek1115 self-assigned this Oct 12, 2020
@netlify
Copy link

netlify bot commented Oct 12, 2020

Deploy preview for chef-automate ready!

Built with commit 7565e9e

https://deploy-preview-4398--chef-automate.netlify.app

@kvivek1115 kvivek1115 changed the title sample-data-service mock infra client data [WIP] sample-data-service mock infra client data Oct 12, 2020
products.meta Outdated
"name": "sample-data",
"type": "product",
"dependencies": ["automate"],
"services": []
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we'll want to list the new services in this service array as chef/sample-data-service

@kvivek1115 kvivek1115 changed the title [WIP] sample-data-service mock infra client data sample-data-service mock infra client data Oct 22, 2020
@kvivek1115 kvivek1115 added the sample-data-service Sample data service mock chef infra client runs label Oct 22, 2020
@kvivek1115 kvivek1115 marked this pull request as ready for review October 22, 2020 14:02
@kvivek1115
Copy link
Author

build fc35c99adf07 is failing due to:


./testssl.sh --parallel --quiet -n none --color 0 --severity LOW --warnings off --disable-rating --jsonfile=/tmp/testssl.lrn6Gn/jsonfile_00000037.json --fast --add-ca /hab/svc/deployment-service/data/root.crt --warnings=batch 127.0.0.1:10155
--
  |  
  | Start 2020-10-22 11:17:02        -->> 127.0.0.1:10155 (127.0.0.1) <<--
  |  
  | rDNS (127.0.0.1):       (instructed to minimize DNS queries)./testssl.sh: connect: Connection refused
  | ./testssl.sh: line 10817: /dev/tcp/127.0.0.1/10155: Connection refused
  | Oops: TCP connect problem
  |  
  | Unable to open a socket to 127.0.0.1:10155.
  | Fatal error: Can't connect to "127.0.0.1:10155"
  | Make sure a firewall is not between you and your scanning target!
  |  
  |  
  | /go/src/github.com/chef/automate
  | /usr/bin/buildkite-agent
  | 2020-10-22 11:17:41 INFO   Found 1 files that match "/tmp/tmp.Z70e6hNAQk"
  | 2020-10-22 11:17:41 INFO   Creating (0-1)/1 artifacts
  | 2020-10-22 11:17:41 INFO   Uploading artifact ec9a32da-7c90-48ba-8db8-f913e33e796b tmp/tmp.Z70e6hNAQk (54525 bytes)
  | [Thu Oct 22 11:17:43 UTC 2020][error] == SSL CONFIGURATION TEST FAILED ==
  | [Thu Oct 22 11:17:43 UTC 2020][error] Found 1 SSL config violations not whitelisted by ssl_filters.jq file
  | [Thu Oct 22 11:17:43 UTC 2020][error] Test failures may be caused by changes to https://github.com/drwetter/testssl.sh
  | [Thu Oct 22 11:17:43 UTC 2020][error] testssl.sh was last changed on Tue Oct 20 21:00:02 2020 +0200
  | [Thu Oct 22 11:17:43 UTC 2020][error] Violations (excluding whitelisted):
  | [
  | {
  | "id": "scanProblem",
  | "ip": "127.0.0.1/127.0.0.1",
  | "port": "10155",
  | "severity": "FATAL",
  | "finding": "Can't connect to '127.0.0.1:10155'\nMake sure a firewall is not between you and your scanning target!"
  | }
  | ]
  | /usr/bin/buildkite-agent
  | Deploy Failed - Uploading logs to buildkite
  | 2020-10-22 11:17:44 INFO   Found 3 files that match "logs/*"
  | 2020-10-22 11:17:44 INFO   Creating (0-3)/3 artifacts
  | 2020-10-22 11:17:44 INFO   Uploading artifact 6642c7f7-8f32-44f4-a1cf-f9d2c16862a9 logs/all (1874609 bytes)
  | 2020-10-22 11:17:44 INFO   Uploading artifact f031baf2-b17b-4740-be2f-d42fae9aa514 logs/deploy (896108 bytes)
  | 2020-10-22 11:17:44 INFO   Uploading artifact 79448e20-02b4-469d-9545-33e50b9c19b3 logs/remaining (978931 bytes)
  | [Thu Oct 22 11:17:46 UTC 2020][info] Killing background processes
  | [Thu Oct 22 11:17:46 UTC 2020][info] Exiting with 1
  | Attempting to clean up docker container automate-24792-4256
  | automate-24792-4256
  | ------------------------------------------------------------
  | To run this test locally:
  |  
  | integration/run_test integration/tests/security.sh
  |  
  | ------------------------------------------------------------
  | 🚨 Error: The command exited with status 1
  |  



@srenatus
Copy link
Contributor

It looks like the testssl call, which checks all open ports, cannot connect to the new service, sample-data-service.

Is it supposed to be running at all times? Or something you selectively start or do not start? I guess that either the port should be excluded from the scan targets or we should check that it really comes online. 🤔

@srenatus
Copy link
Contributor

Nevermind, the description says that you have to select it. I guess the testssl deployment (i.e. the "security" test run) doesn't do it.

@srenatus
Copy link
Contributor

@vsingh-msys I've pushed a commit enabling the sample-data product for the security test. Let's see what happens now 😄

@srenatus
Copy link
Contributor

Looks like the security test now is green. ✔️

@kvivek1115
Copy link
Author

Yeah, thanks @srenatus

if err != nil {
fail(errors.Wrap(err, "Could not read certs"))
}
connFactory := secureconn.NewFactory(*serviceCerts)
Copy link
Author

Choose a reason for hiding this comment

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

Added service to get started maybe we can skip it later

Copy link
Contributor

@lancewf lancewf left a comment

Choose a reason for hiding this comment

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

Working for me. The code looks good also.
Thank you for breaking this task up to only adding the service first.

Copy link
Contributor

@stevendanna stevendanna left a comment

Choose a reason for hiding this comment

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

This seems like a reasonable start to me! Nice work. Left mostly minor comments.

Log log = 4;

message Service {
google.protobuf.StringValue host = 1 [deprecated=true]; // The listen host is no longer setable(localhost only)
Copy link
Contributor

Choose a reason for hiding this comment

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

We can avoid adding a deprecated option at the start of this service since no users have used this option yet.

@@ -0,0 +1 @@
# Sample data service
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add a bit of content here? What does the service do? How do you use it?

Sha: version.GitSHA,
Built: version.BuildTime,
}, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You can get this by default via the debug API.

Copy link
Author

Choose a reason for hiding this comment

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

Noted thanks!

Vivek Singh and others added 9 commits November 3, 2020 15:39
- Add required config options

Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
We still need configuration protobufs for this service.

Signed-off-by: Steven Danna <steve@chef.io>
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
# Helper methods specific for the sample-data-service

document "start_sample_data_service" <<DOC
Build and start the local sample-data-service
Copy link
Contributor

@msorens msorens Nov 3, 2020

Choose a reason for hiding this comment

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

Let's be consistent. Here you use "sample-data-service" and on the next function you use "Sample data service", and "sample data service" in other files. Suggest stick with "sample data service".

Copy link
Author

Choose a reason for hiding this comment

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

thanks for nitpick suggestion!

Comment on lines +9 to +10
install_if_missing core/jq-static jq
install_if_missing core/grpcurl grpcurl
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these necessary here? You are not using either one.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, starting the service alone and installing grpcurl & jq would be handy so that grpcurl & jq can be used in hab studio.

func DefaultConfigRequest() *ConfigRequest {
c := NewConfigRequest()
c.V1.Sys.Service.Host = w.String("127.0.0.1")
c.V1.Sys.Service.Port = w.Int32(10155)
Copy link
Contributor

Choose a reason for hiding this comment

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

How did you determine this value?

Copy link
Author

@kvivek1115 kvivek1115 Nov 4, 2020

Choose a reason for hiding this comment

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

We can pick any of the port which is available in chef-automate dev ports free

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool; did not know that command!

verbose?="-v"
endif

all: lint build test
Copy link
Contributor

Choose a reason for hiding this comment

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

The test target is missing? Are there tests to run? If not, remove it here.

Copy link
Author

Choose a reason for hiding this comment

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

Right now, have added these helpers to the future building, removing test make sense we can add these helpers once required. Thanks!

mkdir -p bin/
go build -o bin/sample-data-service ./cmd/sample-data-service

.PHONY: all static unit build compile proto test dep-ensure have-dep lint
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
.PHONY: all static unit build compile proto test dep-ensure have-dep lint
.PHONY: all static unit build test lint

(And possibly remove test as well per last comment.)

@@ -0,0 +1,5 @@
# Sample data service

Sample data service can be used to send scheduled data to Automate mimicing the data that would be send from a client.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Sample data service can be used to send scheduled data to Automate mimicing the data that would be send from a client.
Sample data service can be used to send scheduled data to Automate mimicking the data that would be send from a client.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks!

"github.com/chef/automate/lib/tracing"
)

// Server is an sample-data server
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Server is an sample-data server
// Server is a sample-data server

service *service.Service
}

// NewServer returns an sample-data server
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// NewServer returns an sample-data server
// NewServer returns a sample-data server

return &Server{service: service}
}

// NewGRPCServer creates a grpc server that serves all Teams GRPC APIs
Copy link
Contributor

Choose a reason for hiding this comment

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

Teams??

Copy link
Author

Choose a reason for hiding this comment

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

copy-pasted stuff forgot to update comment thanks!

Vivek Singh added 4 commits November 4, 2020 06:33
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
@kvivek1115
Copy link
Author

Hoping everything is as expected, merging this PR so proceeding with the further roadmap. 🤞

@kvivek1115 kvivek1115 merged commit 3d88cc0 into master Nov 9, 2020
@kvivek1115 kvivek1115 deleted the VSingh/sample-data-service branch November 9, 2020 05:56
alexpop pushed a commit that referenced this pull request Nov 18, 2020
author Michael Sorens <msorens@chef.io> 1604676405 -0800
committer Alex Pop <apop@chef.io> 1605705520 +0000

Pin semgrep for custom rules (#4426)

sample-data-service mock infra client data (#4398)

Co-authored-by: Steven Danna <steve@chef.io>

Compliance APIs default to 24h without end_time (#4310)

* Compliance APIs default to 24h without end_time

Signed-off-by: Alex Pop <apop@chef.io>

Fix overlapping

Signed-off-by: Alex Pop <apop@chef.io>

* Update docker test based on new inspec error output

Signed-off-by: Alex Pop <apop@chef.io>

* Remove fmt package

Signed-off-by: Alex Pop <apop@chef.io>

Add option to select last 24h compliance report (#4358)

* Add option to select last 24h compliance report

This commit adds the option to view the last 24h of compliance data. Compliance API endpoints were recently updated to return last 24h window of data if `start_time` and `end_time` are excluded from requests.

Signed-off-by: Scott Christopherson <scott@chef.io>

* Align filters

Signed-off-by: Alex Pop <apop@chef.io>

* Update docker test based on new inspec error output

Signed-off-by: Alex Pop <apop@chef.io>

Co-authored-by: Alex Pop <apop@chef.io>

Add Compliance Knowledge Transfer notes

Signed-off-by: Alex Pop <apop@chef.io>

small updates

Signed-off-by: Alex Pop <apop@chef.io>

before call

Signed-off-by: Alex Pop <apop@chef.io>

before call

Signed-off-by: Alex Pop <apop@chef.io>

added filters and migrations

added some filter types

ingest clarifications

Signed-off-by: Alex Pop <apop@chef.io>

Before second kt call

Signed-off-by: Alex Pop <apop@chef.io>

changes post second call

Signed-off-by: Alex Pop <apop@chef.io>
alexpop pushed a commit that referenced this pull request Nov 23, 2020
author Michael Sorens <msorens@chef.io> 1604676405 -0800
committer Alex Pop <apop@chef.io> 1605705520 +0000

Pin semgrep for custom rules (#4426)

sample-data-service mock infra client data (#4398)

Co-authored-by: Steven Danna <steve@chef.io>

Compliance APIs default to 24h without end_time (#4310)

* Compliance APIs default to 24h without end_time

Signed-off-by: Alex Pop <apop@chef.io>

Fix overlapping

Signed-off-by: Alex Pop <apop@chef.io>

* Update docker test based on new inspec error output

Signed-off-by: Alex Pop <apop@chef.io>

* Remove fmt package

Signed-off-by: Alex Pop <apop@chef.io>

Add option to select last 24h compliance report (#4358)

* Add option to select last 24h compliance report

This commit adds the option to view the last 24h of compliance data. Compliance API endpoints were recently updated to return last 24h window of data if `start_time` and `end_time` are excluded from requests.

Signed-off-by: Scott Christopherson <scott@chef.io>

* Align filters

Signed-off-by: Alex Pop <apop@chef.io>

* Update docker test based on new inspec error output

Signed-off-by: Alex Pop <apop@chef.io>

Co-authored-by: Alex Pop <apop@chef.io>

Add Compliance Knowledge Transfer notes

Signed-off-by: Alex Pop <apop@chef.io>

small updates

Signed-off-by: Alex Pop <apop@chef.io>

before call

Signed-off-by: Alex Pop <apop@chef.io>

before call

Signed-off-by: Alex Pop <apop@chef.io>

added filters and migrations

added some filter types

ingest clarifications

Signed-off-by: Alex Pop <apop@chef.io>

Before second kt call

Signed-off-by: Alex Pop <apop@chef.io>

changes post second call

Signed-off-by: Alex Pop <apop@chef.io>
alexpop pushed a commit that referenced this pull request Nov 23, 2020
author Michael Sorens <msorens@chef.io> 1604676405 -0800
committer Alex Pop <apop@chef.io> 1605705520 +0000

Pin semgrep for custom rules (#4426)

sample-data-service mock infra client data (#4398)

Co-authored-by: Steven Danna <steve@chef.io>

Compliance APIs default to 24h without end_time (#4310)

* Compliance APIs default to 24h without end_time

Signed-off-by: Alex Pop <apop@chef.io>

Fix overlapping

Signed-off-by: Alex Pop <apop@chef.io>

* Update docker test based on new inspec error output

Signed-off-by: Alex Pop <apop@chef.io>

* Remove fmt package

Signed-off-by: Alex Pop <apop@chef.io>

Add option to select last 24h compliance report (#4358)

* Add option to select last 24h compliance report

This commit adds the option to view the last 24h of compliance data. Compliance API endpoints were recently updated to return last 24h window of data if `start_time` and `end_time` are excluded from requests.

Signed-off-by: Scott Christopherson <scott@chef.io>

* Align filters

Signed-off-by: Alex Pop <apop@chef.io>

* Update docker test based on new inspec error output

Signed-off-by: Alex Pop <apop@chef.io>

Co-authored-by: Alex Pop <apop@chef.io>

Add Compliance Knowledge Transfer notes

Signed-off-by: Alex Pop <apop@chef.io>

small updates

Signed-off-by: Alex Pop <apop@chef.io>

before call

Signed-off-by: Alex Pop <apop@chef.io>

before call

Signed-off-by: Alex Pop <apop@chef.io>

added filters and migrations

added some filter types

ingest clarifications

Signed-off-by: Alex Pop <apop@chef.io>

Before second kt call

Signed-off-by: Alex Pop <apop@chef.io>

changes post second call

Signed-off-by: Alex Pop <apop@chef.io>

Co-authored-by: Michael Sorens <msorens@chef.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sample-data-service Sample data service mock chef infra client runs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants