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

[DOC] Getting Started guide leads to "no such file or directory" fatal #352

Closed
PB-TW opened this issue Jan 31, 2023 · 11 comments
Closed

[DOC] Getting Started guide leads to "no such file or directory" fatal #352

PB-TW opened this issue Jan 31, 2023 · 11 comments
Labels
documentation Improvements or additions to documentation Needs Triage This issue needs to be investigated by a maintainer

Comments

@PB-TW
Copy link

PB-TW commented Jan 31, 2023

Change in the documentation

I was following this guide: https://docs.openfeature.dev/docs/tutorials/getting-started/java

In step 5, I create the flags.json file in my working directory and then I am running this command:
docker run -p 8013:8013 -v $(pwd)/:/etc/flagd/ -it ghcr.io/open-feature/flagd:latest start --uri file:/etc/flagd/flags.json

This leads to the following stacktrace:

{"level":"info","ts":1675136126.8201787,"caller":"file/filepath_sync.go:29","msg":"Starting filepath sync notifier","component":"sync","sync":"filepath"}
{"level":"info","ts":1675136126.8217688,"caller":"service/connect_service.go:108","msg":"metrics listening at 8014","component":"service"}
{"level":"fatal","ts":1675136126.8291576,"caller":"cmd/start.go:120","msg":"no such file or directory","component":"start","stacktrace":"github.com/open-feature/flagd/cmd.glob..func1\n\t/workspace/cmd/start.go:120\ngithub.com/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:920\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044\ngithub.com/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968\ngithub.com/open-feature/flagd/cmd.Execute\n\t/workspace/cmd/root.go:37\nmain.main\n\t/workspace/main.go:30\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:250"}

I tried several different ways, including moving the file around, making the path explicit etc.
When I run docker inspect, the volume looks correct to me.

I am using Colima instead of Docker Desktop, if that is relevant.

Either the documentation is wrong or there is a bug in the latest version of flagd.

@PB-TW PB-TW added documentation Improvements or additions to documentation Needs Triage This issue needs to be investigated by a maintainer labels Jan 31, 2023
@Kavindu-Dodan
Copy link
Contributor

I tried installing Colima and starting flagd. I can confirm that flagd detects the mounted file and starts successfully. My assumption is the way you bind the volume. Make sure your flags.json is available at $(pwd)/ (which translates to current directory you are executing the docker command) & file is named exactly flags.json

@Kavindu-Dodan
Copy link
Contributor

Anyway, when using Colima, I noticed that changes to file are not propogated to flagd (i.e - changing feature flag definition is not reflected in flagd [1]).

This should be a limitation/issue of colima. So you might not be able to experience the full potential of flagd.

[1] - https://docs.openfeature.dev/docs/tutorials/getting-started/java/#step-6-rerun-the-application

@Kavindu-Dodan
Copy link
Contributor

Alternatively, you can download flagd binary matching your system from the releases [1] and run it locally.

The run command is simple : ./flagd start --uri file: <BASE_PATH>/flags.json

[1] - https://github.com/open-feature/flagd/releases

@toddbaert
Copy link
Member

toddbaert commented Jan 31, 2023

@PB-TW I'm not able to reproduce this on docker + Linux. Could you tell us what OS are you using?

Can you try docker run -p 8013:8013 -v {ABSOLUTE_DIR}:/etc/flagd/ -it ghcr.io/open-feature/flagd:latest start --uri file:/etc/flagd/flags.json, where {ABSOLUTE_DIR} is a full path to your working directory (or is that what you mean by making the path explicit?) Note that it should be a DIRECTORY, not a file, if you are specifying it manually.

Can you also make sure that the flags.json file has the appropriate permissions and ownership?

@PB-TW
Copy link
Author

PB-TW commented Feb 1, 2023

I'm using MacOS 13.2. The file is named correctly. Colima version is 0.5.2.

I tried it with the {ABSOLUTE_DIR}, leading to the same result as in my original post.

I also don't think that the -v flag is an issue, because when I run docker inspect [container_id], then I can see that:

        "HostConfig": {
            "Binds": [
                "[correct directory path, in which flags.json lives]/:/etc/flagd/"
            ],
...
        }
...
        "Mounts": [
            {
                "Type": "bind",
                "Source": "[correct directory path, in which flags.json lives]",
                "Destination": "/etc/flagd",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],

I will try to download the flagd binary and run it next.

@PB-TW
Copy link
Author

PB-TW commented Feb 1, 2023

The binary is sadly not usable on my system since it is not signed and therefore I may not open it on my Mac.

Covered by: #328

@PB-TW
Copy link
Author

PB-TW commented Feb 1, 2023

I installed flagd via homebrew and ran flagd start --uri file:./flags.json. This is working as expected now!

But of course would be more happy to use it dockerized.

@toddbaert
Copy link
Member

toddbaert commented Feb 2, 2023

@PB-TW this sounds a lot like your problem. I'm not familiar enough with Colima, but maybe this could be helpful?

We will keep troubleshooting on our end.

@skyerus
Copy link
Contributor

skyerus commented Feb 2, 2023

I'm using macOS Ventura 13.2.

I could not reproduce this issue, these are the steps I took:

  1. Created flags.json in my working directory
  2. Ran colima start (version 0.5.2)
  3. Ran docker run -p 8013:8013 -v $(pwd)/:/etc/flagd/ -it ghcr.io/open-feature/flagd:latest start --uri file:/etc/flagd/flags.json
Unable to find image 'ghcr.io/open-feature/flagd:latest' locally
latest: Pulling from open-feature/flagd
5f80a38cb015: Pull complete
de3ec0d85b60: Pull complete
Digest: sha256:91515407e8527b8a0dc8857efebfbcba291bc3cd498085e99a7d5c5cddd97440
Status: Downloaded newer image for ghcr.io/open-feature/flagd:latest

		 ______   __       ________   _______    ______
		/_____/\ /_/\     /_______/\ /______/\  /_____/\
		\::::_\/_\:\ \    \::: _  \ \\::::__\/__\:::_ \ \
		 \:\/___/\\:\ \    \::(_)  \ \\:\ /____/\\:\ \ \ \
		  \:::._\/ \:\ \____\:: __  \ \\:\\_  _\/ \:\ \ \ \
		   \:\ \    \:\/___/\\:.\ \  \ \\:\_\ \ \  \:\/.:| |
		    \_\/     \_____\/ \__\/\__\/ \_____\/   \____/_/

{"level":"info","ts":1675346378.0725162,"caller":"service/connect_service.go:108","msg":"metrics listening at 8014","component":"service"}
{"level":"info","ts":1675346378.0725548,"caller":"file/filepath_sync.go:29","msg":"Starting filepath sync notifier","component":"sync","sync":"filepath"}
{"level":"info","ts":1675346378.0742724,"caller":"file/filepath_sync.go:49","msg":"Watching filepath: /etc/flagd/flags.json","component":"sync","sync":"filepath"}

@PB-TW
Copy link
Author

PB-TW commented Feb 3, 2023

Thanks a lot for the support!
@toddbaert Your link helped. Clearing out the ~/.colima/ folder made it work for me now as well! So nothing wrong on your side and just one of Colima's quirks.

@PB-TW PB-TW closed this as completed Feb 3, 2023
@toddbaert
Copy link
Member

@PB-TW great news! Thanks for your interest in the project. Please don't hesitate to reach out if you need any more help or support, or you'd like to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation Needs Triage This issue needs to be investigated by a maintainer
Projects
None yet
Development

No branches or pull requests

4 participants