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

Make docker and docker-compose work on WSL2 #1375

Merged
merged 10 commits into from
Nov 5, 2024
Merged

Conversation

achantavy
Copy link
Contributor

@achantavy achantavy commented Nov 2, 2024

Summary

Describe your changes.

Fixes the docker-compose steps to work on WSL2 (Windows Subsystem for Linux 2) and OSX. Updates documentation to use the new cncf tag when building the container.

docker-compose is very helpful for dev setups and trying out cartography.

Checklist

Testing performed

I started with a fresh clone of this branch and on both OSX and WSL2ran

  1. docker build -t cartography-cncf/cartography-dev -f dev.Dockerfile ./
  2. docker-compose run cartography-dev make test

I can confirm that both paths worked and ran the full test suite using docker-compose.

WSL2

Linter:
image

Unit tests:
image

Integration tests:
image

OSX

Linter:
Screenshot 2024-11-03 at 12 29 49 AM

Unit tests:
Screenshot 2024-11-03 at 12 30 07 AM

Integration tests:
Screenshot 2024-11-03 at 12 30 22 AM

Signed-off-by: Alex Chantavy <[email protected]>
Signed-off-by: Alex Chantavy <[email protected]>
Signed-off-by: Alex Chantavy <[email protected]>
Signed-off-by: Alex Chantavy <[email protected]>
Signed-off-by: Alex Chantavy <[email protected]>
@achantavy achantavy changed the title [WIP] Make docker and docker-compose work on WSL2 Make docker and docker-compose work on WSL2 Nov 3, 2024
@@ -16,11 +16,13 @@
from tests.data.github.rate_limit import RATE_LIMIT_RESPONSE_JSON


@patch('cartography.intel.github.util.time.sleep')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated to this change, but this was wrong for a while and added 2 extra seconds to each test unncessarily

@achantavy achantavy marked this pull request as ready for review November 3, 2024 07:35
interval: 10s
timeout: 10s
retries: 10

# Runs the standard cartography image available at ghcr.io.
cartography:
image: ghcr.io/lyft/cartography:latest
image: ghcr.io/cartography-cncf/cartography:latest
platform: linux/x86_64
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is needed for M* Macs.

@@ -34,14 +33,15 @@ services:
# Networking:
- dbms.connector.bolt.listen_address=0.0.0.0:7687
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:7474"]
test: ["CMD", "wget", "--no-verbose", "http://localhost:7474"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

wget works better than curl in reporting health for some reason. curl would get stuck on 'starting' status.

@achantavy achantavy enabled auto-merge (squash) November 5, 2024 19:01
@achantavy achantavy merged commit 9f15fc3 into master Nov 5, 2024
5 checks passed
@achantavy achantavy deleted the dockercomposefixes branch November 5, 2024 19:03
chandanchowdhury pushed a commit to chandanchowdhury/cartography that referenced this pull request Nov 27, 2024
### Summary
> Describe your changes.

Fixes the docker-compose steps to work on WSL2 (Windows Subsystem for
Linux 2) and OSX. Updates documentation to use the new cncf tag when
building the container.

docker-compose is very helpful for dev setups and trying out
cartography.

### Checklist

### Testing performed
I started with a fresh clone of this branch and on _both_ OSX and
WSL2ran

1. `docker build -t cartography-cncf/cartography-dev -f dev.Dockerfile
./`
1. `docker-compose run cartography-dev make test`

I can confirm that both paths worked and ran the full test suite using
docker-compose.

#### WSL2
Linter:

![image](https://github.com/user-attachments/assets/b165feb6-0d0a-4a9c-90dd-fe47e8390b0d)

Unit tests:

![image](https://github.com/user-attachments/assets/4cfa8a41-6775-4ac1-ad9c-6052163c0a17)

Integration tests:

![image](https://github.com/user-attachments/assets/f134dec5-8df2-4c9b-a7f6-57cccac51f89)

#### OSX
Linter:
<img width="1000" alt="Screenshot 2024-11-03 at 12 29 49 AM"
src="https://github.com/user-attachments/assets/e7840c2a-8065-4163-8057-3de902532291">

Unit tests:
<img width="997" alt="Screenshot 2024-11-03 at 12 30 07 AM"
src="https://github.com/user-attachments/assets/11d91723-776c-4438-b2a1-fe783e75e414">

Integration tests:
<img width="1003" alt="Screenshot 2024-11-03 at 12 30 22 AM"
src="https://github.com/user-attachments/assets/c2360ad5-a2c2-4309-91d0-1080dc9d0bb3">

---------

Signed-off-by: Alex Chantavy <[email protected]>
Signed-off-by: chandanchowdhury <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants