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

PROP-27 - Implement Registry proxy #32

Merged
merged 42 commits into from
Dec 20, 2024
Merged

Conversation

nyagamunene
Copy link
Contributor

@nyagamunene nyagamunene commented Dec 9, 2024

What type of PR is this?

What does this do?

Which issue(s) does this PR fix/relate to?

Have you included tests for your changes?

Did you document any new/modified features?

Notes

@nyagamunene nyagamunene self-assigned this Dec 9, 2024
@nyagamunene nyagamunene marked this pull request as ready for review December 11, 2024 13:37
cmd/proxy/.env Outdated Show resolved Hide resolved
cmd/proxy/main.go Outdated Show resolved Hide resolved
cmd/proxy/main.go Outdated Show resolved Hide resolved
cmd/proxy/main.go Outdated Show resolved Hide resolved
cmd/proxy/main.go Outdated Show resolved Hide resolved
proxy/config/http.go Outdated Show resolved Hide resolved
proxy/mqtt/mqtt.go Outdated Show resolved Hide resolved
cmd/proxy/main.go Outdated Show resolved Hide resolved
cmd/proxy/main.go Outdated Show resolved Hide resolved
cmd/proxy/main.go Outdated Show resolved Hide resolved
proxy/config/http.go Outdated Show resolved Hide resolved
proxy/config/mqtt.go Outdated Show resolved Hide resolved
cmd/proxy/main.go Outdated Show resolved Hide resolved
proxy/README.md Outdated Show resolved Hide resolved
proxy/config/http.go Outdated Show resolved Hide resolved
proxy/config/mqtt.go Outdated Show resolved Hide resolved
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
cmd/proxy/main.go Outdated Show resolved Hide resolved
logger := slog.New(logHandler)
slog.SetDefault(logger)

mqttCfg := config.MQTTProxyConfig{}
Copy link
Member

Choose a reason for hiding this comment

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

There is some stutter here in config MQTT Proxy Config

You can move the configs to the proxy package and import it as

mqttConfig := proxy.MQTTConfig{}

ID string
FunctionName string
WasmFile []byte
WasmFileDownloadPath string
Copy link
Member

Choose a reason for hiding this comment

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

Can this be changed to image URL?

proxy/service.go Outdated
case chunk := <-s.dataChan:
if err := s.mqttClient.PublishContainer(ctx, chunk); err != nil {
s.logger.Error("failed to publish container chunk",
"error", err,
Copy link
Member

Choose a reason for hiding this comment

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

use logger args

proxy/service.go Outdated

s.logger.Info("published container chunk",
"chunk_name", chunk.AppName,
"chunk_no", chunk.ChunkIdx,
Copy link
Member

Choose a reason for hiding this comment

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

same

proxy/service.go Outdated
continue
}

s.logger.Info("published container chunk",
Copy link
Member

Choose a reason for hiding this comment

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

Should this be debug information?

Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
test.md Outdated
@@ -102,3 +102,28 @@ export PROPLET_THING_ID=""
export PROPLET_THING_KEY=""
propeller-proplet
```

Copy link
Member

Choose a reason for hiding this comment

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

Move this to absmach/propeller-docs#6 and delete it here

LogLevel string `env:"PROXY_LOG_LEVEL" envDefault:"info"`

BrokerURL string `env:"PROXY_MQTT_ADDRESS" envDefault:"tcp://localhost:1883"`
PropletKey string `env:"PROXY_PROPLET_KEY,notEmpty"`
Copy link
Member

Choose a reason for hiding this comment

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

Align with the other env variable config

PROPLET_CHANNEL_ID
PROPLET_THING_ID
PROPLET_THING_KEY


ChunkSize int `env:"PROXY_CHUNK_SIZE" envDefault:"512000"`
Authenticate bool `env:"PROXY_AUTHENTICATE" envDefault:"false"`
Token string `env:"PROXY_REGISTRY_TOKEN" envDefault:""`
Copy link
Member

Choose a reason for hiding this comment

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

Do we need token and password or it is either one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its either of the 2

task/task.go Outdated
@@ -35,6 +33,7 @@ type Task struct {
ID string `json:"id"`
Name string `json:"name"`
State State `json:"state"`
ImageURL URLValue `json:"image_url,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

What about just string?

task/url.go Outdated
@@ -0,0 +1,45 @@
package task

Copy link
Member

Choose a reason for hiding this comment

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

Remove

Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Makefile Outdated
if [[ ! "$$file" =~ \.wasm$$ ]]; then \
cp "$$file" $(GOBIN)/propeller-`basename "$$file"`; \
fi \
if [ "$$file" = "$${file%%.wasm}" ]; then \
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use Makefile wildcard directive here to contract the filtering and selection for copying?

cp "$$file" $(GOBIN)/propeller-`basename "$$file"`; \
fi \
done
$(foreach f,$(wildcard $(BUILD_DIR)/*[!.wasm]),cp $(f) $(patsubst $(BUILD_DIR)/%,$(GOBIN)/propeller-%,$(f));)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible, in order to simplify handling of binaries, to have a subdir wasm within build dir, and put all Wasm binaries there. I guess these binaries are coming from examples, right? If really needed you can also add build/bin and build/wasm, but I do not think that we need build/bin (as most of the time we'll need just Propeller services (and not examples), and they can live directly in the top build dir, for convenience), but if this simplifies copying, then please go ahead and make both build/bin and build/wasm.

Copy link
Contributor

Choose a reason for hiding this comment

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

In fact, as you would need to prefix each bin anyway - I will merge as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it be possible, in order to simplify handling of binaries, to have a subdir wasm within build dir, and put all Wasm binaries there. I guess these binaries are coming from examples, right? If really needed you can also add build/bin and build/wasm, but I do not think that we need build/bin (as most of the time we'll need just Propeller services (and not examples), and they can live directly in the top build dir, for convenience), but if this simplifies copying, then please go ahead and make both build/bin and build/wasm.

We can implement this .

@drasko drasko merged commit 8a91d1c into absmach:main Dec 20, 2024
1 check passed
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.

Feature: Implement Registry proxy
3 participants