livecycle / livecycle/preevy

[Bug]: Incorrect PREEVY_BASE_URI values in combination with preevy.expose labels

Open
#620 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
2.2k
Forks
91
PR merge metrics
No merged PRs in 30d

Description

What happened?

When a single service has multiple ports mapped, but only exposes a single port via the preevy.expose label, the $PREEVY_BASE_URI_* variables are assigned values that do not contain the correct tunnel URI.

Add screenshots

N/A

Steps to reproduce the behavior

Here's a minimal docker-compose file that shows the issue:

services:

  # Maps multiple ports, but only exposes one of them via the label (NOT WORKING)
  node0:
    image: node:22
    container_name: node0
    ports:
      - 3000:3000
      - 3001:3001
    labels:
      preevy.expose: '3000'
    command: sh -c "while true; do sleep 30; done;"

  # Maps multiple ports, but does not use the label to limit which are exposed (WORKING)
  node1:
    image: node:22
    container_name: node1
    ports:
      - 3111:3111
      - 3112:3112
    command: sh -c "while true; do sleep 30; done;"

  # Maps a single port, and (redundantly) uses the label to expose it (WORKING)
  node2:
    image: node:22
    container_name: node2
    ports:
      - 3222:3222
    labels:
      preevy.expose: '3222'
    command: sh -c "while true; do sleep 30; done;"

  # This service is merely here to consume the PREEVY_BASE_URI_* variables and output them
  node:
    image: node:22
    container_name: node
    environment:
      PREEVY_BASE_URI_NODE0_3000: ${PREEVY_BASE_URI_NODE0_3000:-empty}
      PREEVY_BASE_URI_NODE1_3111: ${PREEVY_BASE_URI_NODE1_3111:-empty}
      PREEVY_BASE_URI_NODE2_3222: ${PREEVY_BASE_URI_NODE2_3222:-empty}
    command: sh -c "env | grep BASE_URI; while true; do sleep 30; done;"

Running preevy up spits out these tunnel urls:

 Service Port URL
 ─────── ──── ────────────────────────────────────────────────────────
 node0   3000 https://node0-demo-bug-main-randomxx.livecycle.run/
 node2   3222 https://node2-demo-bug-main-randomxx.livecycle.run/
 node1   3111 https://node1-3111-demo-bug-main-randomxx.livecycle.run/
 node1   3112 https://node1-3112-demo-bug-main-randomxx.livecycle.run/

But if you preevy ssh and then run docker logs node, you'll see that this is the output:

PREEVY_BASE_URI_NODE0_3000=https://node0-3000-demo-bug-main-randomxx.livecycle.run/
PREEVY_BASE_URI_NODE1_3111=https://node1-3111-demo-bug-main-randomxx.livecycle.run/
PREEVY_BASE_URI_NODE2_3222=https://node2-demo-bug-main-randomxx.livecycle.run/

The first url in the output—for node0—is incorrect, and there is no such tunnel for that URL. The others are correct

Expected behavior

The combination used by the node0 service—mapping multiple ports (3000, 3001), but only exposing a single port (3000) via the preevy.expose label—seems to cause an incorrect tunnel URI to be generated for the $PREEVY_BASE_URI_NODE0_3000 env var.

In this example, it sets that variable to:
PREEVY_BASE_URI_NODE0_3000=https://node0-3000-demo-bug-main-randomxx.livecycle.run/
when it should be:
PREEVY_BASE_URI_NODE0_3000=https://node0-demo-bug-main-randomxx.livecycle.run/

Note that the the URIs for node1 and node2 DO seem to work correctly.

  • node1 maps multiple ports, but does not use a preevy.expose label. This seems to work
  • node2 uses a preevy.expose label, but only maps a single port. This seems to work.
What OS are you seeing the problem on?

No response

Additional context

Version: preevy/0.0.67 darwin-arm64 node-v22.13.1
Driver: Lightsail

Record
  • I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the minimal docker-compose reproduction with preevy up, then inspect how the preevy.expose label affects the generated PREEVY_BASE_URI_* values. Use preevy ssh and docker logs node to compare the node0, node1, and node2 results. Done means node0 uses the single-port tunnel URL shown by preevy up, while the other two cases remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, typescript
Domain
cli, cloud, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.