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

Forcing EVE to use V1 API while #16 is getting fixed #17

Merged
merged 1 commit into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ var serverCmd = &cobra.Command{
if err != nil {
log.Fatalf("error writing hosts file: %v", err)
}

rootCert, err := ioutil.ReadFile(serverCert)
if err != nil {
log.Fatalf("error reading %s file: %v", serverCert, err)
}
err = ioutil.WriteFile(path.Join(configDir, "root-certificate.pem"), rootCert, 0644)
if err != nil {
log.Fatalf("error writing root-certificate.pem file: %v", err)
}

// FIXME: this is going away as part of fixing https://github.com/lf-edge/adam/issues/16
err = ioutil.WriteFile(path.Join(configDir, "Force-API-V1"), []byte{}, 0644)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these not go into eve-embedded.sh rather than here? This /config/Force-API-V1 file is only in the embedded context, and only makes sense to eve itself.

I don't object to adding some capabilities to adam itself, so that we can eventually get rid of eve-embedded.sh (I was thinking about it, actually), but let's not put them in in an unstructured way. This whole thing can be done in a single cp command and a single echo command in eve-embedded.sh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it actually has to go everywhere -- not just into embedded. Otherwise there's absolutely no way for us to signal to the user that this needs to be somehow handed over to EVE via its config.

In fact, that the whole point of Adam generating an EVE config -- it needs to have a way to signal of what options need to be there for it to actually function.

Hence I think it actually belongs here -- the only other alternative @deitch is to completely drop this EVE configuration generation -- 'cuz it really has to be complete or it needs to be dropped.

The thing we don't want it to be is misleading -- that's the worst option of all.

Copy link
Contributor

Choose a reason for hiding this comment

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

Adam already was writing out an eve-compatible config to a local directory when run in adam server mode. Right. In that case, this makes sense.

if err != nil {
log.Fatalf("error writing Force-API-V1 file: %v", err)
}
log.Printf("EVE-compatible configuration directory output to %s", configDir)

s := &server.Server{
Expand Down
6 changes: 2 additions & 4 deletions scripts/eve-embedded.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ bootstrap() {

# if this is the first run on this /persist -- generate everything
if [ ! -d $DB ]; then
adam generate --db-url $DB --server --hosts 127.0.0.1,localhost --cn localhost.localdomain
cp $DB/server.pem /config/root-certificate.pem
echo $SERVER > /config/server
rvs marked this conversation as resolved.
Show resolved Hide resolved
adam generate --db-url $DB --server --hosts 127.0.0.1,localhost --cn localhost
bootstrap &
fi

adam server --port $PORT --db-url $DB --conf-dir $DB/eve-conf --server-cert $DB/server.pem --server-key $DB/server-key.pem
adam server --port $PORT --db-url $DB --conf-dir /config --server-cert $DB/server.pem --server-key $DB/server-key.pem