FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important
information on the platform change.
08-18-2023 01:31 PM - edited 08-18-2023 01:38 PM
Hey all,
I am trying to develop an integration for the ctrlX CORE by building a webserver that serves a HTML page. I have followed the guide on reverse-proxy and I am using a unix socket.
I have also looked at both the Go and Python webserver example, and tried to compare as much as I could. I've uploaded the Go sample and it simply worked. I'm guessing its a small issue somewhere in the configuration, as I don't see any traffic coming to my webserver.
I am able to connect to my webserver via nc:
echo -e "GET /register-my-snap/ HTTP/1.1\r\nHost: localhost\r\n\r\n" | sudo nc -q2 -U /var/snap/my-snap-name/current/package-run/my-snap-name/web.sock
<!DOCTYPE html>
...
</html>
However when I try to access the link I've set up in my package-manifest.json I receive a "The app is currently not available" page. Is it possible to somewhere enable Caddy logging output? I've tried editing various files but did not find a solution. I can't see any reasonable information in the logbook/journalctl about why it could be failing.
my-snap-name.package-manifest.json:
{
"$schema": "https://json-schema.boschrexroth.com/ctrlx-automation/ctrlx-core/apps/package-manifest/package-manifest.v1.3.schema.json",
"version": "1.0.0",
"id": "my-snap-name",
"configuration": {
"appDirectories": [
{
"name": "my-snap",
"description": "my-snap",
"copyOnLoad": true
}
]
},
"services": {
"proxyMapping": [
{
"name": "my-snap-name.web",
"url": "/register-my-snap/",
"binding": "unix://{$SNAP_DATA}/package-run/my-snap-name/web.sock",
"restricted": []
}
]
},
"menus": {
"sidebar": [
{
"id": "my-snap-name",
"title": "My Snap",
"items": [
{
"id": "register",
"title": "Register My Snap",
"target": "_blank",
"link": "/register-my-snap/"
}
]
}
]
}
}
snapcraft.yaml:
name: my-snap-name
base: core20
version: '1.0.0'
grade: stable
confinement: strict
architectures:
- build-on: amd64
run-on: arm64
apps:
my-snap-name:
command: usr/bin/run.sh
daemon: simple
restart-condition: always
restart-delay: 5s
plugs:
- active-solution
- hardware-observe
- network
- network-bind
- network-control
plugs:
active-solution:
interface: content
content: solutions
target: $SNAP_COMMON/solutions
hooks:
connect-plug-active-solution:
plugs: [active-solution]
slots:
package-assets:
interface: content
content: package-assets
source:
read:
- $SNAP/package-assets/${SNAPCRAFT_PROJECT_NAME}
package-run:
interface: content
content: package-run
source:
write:
- $SNAP_DATA/package-run/${SNAPCRAFT_PROJECT_NAME}
parts:
my-snap:
source: bin/my-snap.deb
plugin: dump
webserver:
source: ./www
plugin: dump
organize:
'*' : www/
configs:
source: snap/local/configs
plugin: dump
organize:
'package-assets/*': package-assets/${SNAPCRAFT_PROJECT_NAME}/
Thank you all in advance!
Solved! Go to Solution.
08-21-2023 01:46 PM
It seems this has fixed itself, I think it may have been the app name not being identical to the snap name. Or potentially something wasn't correctly configured with the unix socket binding.