Skip to content
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
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ and the container exits with the same status when that service exits.
```dockerfile
COPY beam-init beamctl /usr/local/bin/

ENV BEAM_INIT_ENABLE_API=1
ENTRYPOINT ["/usr/local/bin/beam-init"]
CMD ["/usr/local/bin/my-app", "--listen", "0.0.0.0:8080"]
```

`BEAM_INIT_ENABLE_API=1` enables the local Unix socket used by `beamctl` to interact with `beam-init`.

```shell
# Start and inspect an additional service.
beamctl start --name my-app -- /usr/local/bin/my-app --listen 0.0.0.0:8080
Expand Down
10 changes: 3 additions & 7 deletions beam-init/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,14 @@ async fn main() {
let old_sigmask = signal_stream::init(&[SIGCHLD], tx_event.clone())
.expect("failed to initialize the signal stream");

let fdstore = if cfg!(feature = "unstable-pty")
&& env::var("BEAM_INIT_ENABLE_API").as_deref() == Ok("1")
{
let fdstore = if cfg!(feature = "unstable-pty") {
fdstore::FdStore::bind_socket().expect("failed to bind fdstore socket")
} else {
fdstore::FdStore::no_socket()
};

if env::var("BEAM_INIT_ENABLE_API").as_deref() == Ok("1") {
// Listen for API commands
api_impl::bind_api_socket(tx_event.clone()).expect("failed to bind api socket");
}
// Listen for API commands
api_impl::bind_api_socket(tx_event.clone()).expect("failed to bind api socket");

let mut service_manager = ServiceManager::new(old_sigmask, tx_event, fdstore);
loop {
Expand Down
1 change: 0 additions & 1 deletion test.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ RUN apt-get install --update -y python3 python3-psutil
COPY --from=builder /beam-init /bin/init
COPY --from=builder /beamctl /bin/beamctl

ENV BEAM_INIT_ENABLE_API=1
ENV BEAM_INIT_ENABLE_DEBUG_LOGS=1
ENV RUST_BACKTRACE=1

Expand Down