Skip to content

Conversation

@oleksandr-nc
Copy link
Contributor

Fixes: #78

Also this PR adds printing of the FRP configs if HP_VERBOSE_START is set to 1

Docker compose to test (analogue of redeploy.sh from this repo):

services:
  appapi-harp:
    image: nextcloud-appapi-harp:local
    container_name: appapi-harp
    hostname: appapi-harp
    restart: unless-stopped
    environment:
      - HP_SHARED_KEY="some_very_secure_password"
      - NC_INSTANCE_URL="http://nextcloud.local"
      - HP_EXAPPS_ADDRESS="appapi-harp:8780"
      - HP_LOG_LEVEL=info
      - HP_VERBOSE_START=1
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ../certs:/certs
    ports:
      - "8780:8780"
      - "8782:8782"
    healthcheck:
      test: ["CMD", "/healthcheck.sh"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s

networks:
  default:
    name: master_default
    external: true
  1. Build the local image first:
    docker build -t nextcloud-appapi-harp:local .

  2. Run with docker-compose:
    docker compose -f development/docker-compose.test.yml up

Without this fix we can only observe such information:

2026-01-06T11:41:54.675068657Z [2026-01-06T11:41:54+0000] [INFO] 127.0.0.1 [06/Jan/2026:11:41:54 +0000] "GET /info HTTP/1.1" 200 175 "-" "curl/8.14.1"
2026-01-06T11:41:54.675320738Z INFO: Waiting for SPOA port 127.0.0.1:9600...
2026-01-06T11:41:54.676466645Z INFO: Starting FRP server on 0.0.0.0:8782...
2026-01-06T11:41:54.676554713Z INFO: Waiting for FRP server port 127.0.0.1:8782...
2026-01-06T11:41:55.179112939Z INFO: Starting FRP client for Docker Engine...
2026-01-06T11:41:55.179149960Z INFO: Starting HAProxy...
2026-01-06T11:41:55.182541122Z error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type v1.ClientConfig
2026-01-06T11:41:55.183047798Z [NOTICE]   (1) : Initializing new worker (50)
2026-01-06T11:41:55.185275359Z [NOTICE]   (1) : haproxy version is 3.1.2-cda631a
2026-01-06T11:41:55.185287533Z [WARNING]  (1) : Process 41 exited with code 1 (Exit)
2026-01-06T11:41:55.208666626Z [NOTICE]   (1) : Loading success.

When running on this branch the output will include FRP configs and deploy will work ok:

2026-01-06T11:43:21.998757669Z INFO: FRP server configuration generated at /frps.toml.
2026-01-06T11:43:21.998762367Z INFO: Generated /frps.toml:
2026-01-06T11:43:21.998972438Z bindAddr = "0.0.0.0"
2026-01-06T11:43:21.998982808Z bindPort = 8782
2026-01-06T11:43:21.998985042Z proxyBindAddr = "127.0.0.1"
2026-01-06T11:43:21.998986255Z 
2026-01-06T11:43:21.998987207Z transport.tls.force = true
2026-01-06T11:43:21.998988168Z transport.tls.certFile = "/certs/frp/server.crt"
2026-01-06T11:43:21.998988990Z transport.tls.keyFile = "/certs/frp/server.key"
2026-01-06T11:43:21.998989791Z transport.tls.trustedCaFile = "/certs/frp/ca.crt"
2026-01-06T11:43:21.998990623Z 
2026-01-06T11:43:21.998991324Z log.to = "/frps.log"
2026-01-06T11:43:21.998992096Z log.level = "info"
2026-01-06T11:43:21.998992887Z log.maxDays = 3
2026-01-06T11:43:21.998993639Z 
2026-01-06T11:43:21.998994340Z maxPortsPerClient = 1
2026-01-06T11:43:21.998995092Z allowPorts = [
2026-01-06T11:43:21.998995813Z   { start = 23000, end = 23999 },
2026-01-06T11:43:21.999000151Z   { start = 24000, end = 24099 }
2026-01-06T11:43:21.999001003Z ]
2026-01-06T11:43:21.999001734Z 
2026-01-06T11:43:21.999002436Z [[httpPlugins]]
2026-01-06T11:43:21.999003207Z addr = "127.0.0.1:8200"
2026-01-06T11:43:21.999004009Z path = "/frp_handler"
2026-01-06T11:43:21.999004780Z ops = ["Login"]
2026-01-06T11:43:21.999180215Z INFO: Detected /var/run/docker.sock, generating /frpc-docker.toml configuration file...
2026-01-06T11:43:21.999960564Z INFO: Generated /frpc-docker.toml:
2026-01-06T11:43:22.000195472Z serverAddr = "127.0.0.1"
2026-01-06T11:43:22.000203397Z serverPort = 8782
2026-01-06T11:43:22.000205020Z 
2026-01-06T11:43:22.000206012Z transport.tls.enable = true
2026-01-06T11:43:22.000206824Z transport.tls.certFile = "/certs/frp/client.crt"
2026-01-06T11:43:22.000207686Z transport.tls.keyFile = "/certs/frp/client.key"
2026-01-06T11:43:22.000208988Z transport.tls.trustedCaFile = "/certs/frp/ca.crt"
2026-01-06T11:43:22.000210311Z transport.tls.serverName = "harp.nc"
2026-01-06T11:43:22.000211583Z 
2026-01-06T11:43:22.000212795Z metadatas.token = "some_very_secure_password"
2026-01-06T11:43:22.000214088Z 
2026-01-06T11:43:22.000216733Z [[proxies]]
2026-01-06T11:43:22.000217534Z remotePort = 24000
2026-01-06T11:43:22.000218276Z type = "tcp"
2026-01-06T11:43:22.000219057Z name = "bundled-deploy-daemon"
2026-01-06T11:43:22.000219889Z [proxies.plugin]
2026-01-06T11:43:22.000220650Z type = "unix_domain_socket"
2026-01-06T11:43:22.000221502Z unixPath = "/var/run/docker.sock"
2026-01-06T11:43:22.000276888Z INFO: Starting Python HaProxy Agent on 127.0.0.1:8200 and 127.0.0.1:9600...
2026-01-06T11:43:22.000377449Z INFO: Waiting for HaRP Agent HTTP (GET http://127.0.0.1:8200/info) to be ready...
2026-01-06T11:43:22.206705834Z [2026-01-06T11:43:22+0000] [INFO] Starting both servers: SPOA on 127.0.0.1:9600, HTTP on 127.0.0.1:8200
2026-01-06T11:43:22.207014784Z [2026-01-06T11:43:22+0000] [INFO] HTTP server listening at 127.0.0.1:8200
2026-01-06T11:43:22.207170962Z [2026-01-06T11:43:22+0000] [INFO] HAProxy SPO Agent listening at 127.0.0.1:9600
2026-01-06T11:43:22.506969437Z [2026-01-06T11:43:22+0000] [INFO] 127.0.0.1 [06/Jan/2026:11:43:22 +0000] "GET /info HTTP/1.1" 200 175 "-" "curl/8.14.1"
2026-01-06T11:43:22.507092832Z INFO: Waiting for SPOA port 127.0.0.1:9600...
2026-01-06T11:43:22.508156622Z INFO: Starting FRP server on 0.0.0.0:8782...
2026-01-06T11:43:22.508200967Z INFO: Waiting for FRP server port 127.0.0.1:8782...
2026-01-06T11:43:23.010519290Z INFO: Starting FRP client for Docker Engine...
2026-01-06T11:43:23.010554637Z INFO: Starting HAProxy...
2026-01-06T11:43:23.013948122Z 2026-01-06 11:43:23.013 [I] [sub/root.go:142] start frpc service for config file [/frpc-docker.toml]
2026-01-06T11:43:23.013969252Z 2026-01-06 11:43:23.013 [I] [client/service.go:295] try to connect to server...
2026-01-06T11:43:23.014287470Z [NOTICE]   (1) : Initializing new worker (71)
2026-01-06T11:43:23.018731008Z [2026-01-06T11:43:23+0000] [INFO] 127.0.0.1 [06/Jan/2026:11:43:23 +0000] "POST /frp_handler?op=Login&version=0.1.0 HTTP/1.1" 200 194 "-" "Go-http-client/1.1"
2026-01-06T11:43:23.018851638Z 2026-01-06 11:43:23.018 [I] [client/service.go:287] [cba2c6c0d8cc8904] login to server success, get run id [cba2c6c0d8cc8904]
2026-01-06T11:43:23.018947702Z 2026-01-06 11:43:23.018 [I] [proxy/proxy_manager.go:173] [cba2c6c0d8cc8904] proxy added: [bundled-deploy-daemon]
2026-01-06T11:43:23.019763168Z 2026-01-06 11:43:23.019 [I] [client/control.go:168] [cba2c6c0d8cc8904] [bundled-deploy-daemon] start proxy success
2026-01-06T11:43:23.036991982Z [NOTICE]   (1) : Loading success.

Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
Copy link
Contributor

@kyteinsky kyteinsky left a comment

Choose a reason for hiding this comment

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

🚀

@oleksandr-nc oleksandr-nc merged commit ce8caf4 into main Jan 7, 2026
3 checks passed
@oleksandr-nc oleksandr-nc deleted the fix/yaml-quotes branch January 7, 2026 07:17
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.

Cannot unmarshal string into Go value of type v1.ClientConfig

3 participants