Skip to content

Commit

Permalink
Provide stolonctl environment variables to shells (#79)
Browse files Browse the repository at this point in the history
Fixes #13.  We want to set the environment variables
stolonctl expects (STOLONCTL_CLUSTER_NAME, etc.) on shells
so users can fly ssh console in and run stolonctl to more
easily administrate their cluster.

Those environment variables are written to a file at
/data/.env by the "start" Go program after the defaults
are set.

Unfortunately, the shell that is created by hallpass appears to be
hard coded to /bin/sh, is not a login shell nor controllable by
/etc/passwd, so our best option is to use the POSIX ENV variable.
  • Loading branch information
Jacob Greenleaf authored Oct 2, 2022
1 parent 97d2adb commit aa228da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ RUN useradd -ms /bin/bash stolon
RUN mkdir -p /run/haproxy/
COPY --from=flyutil /fly/bin/* /usr/local/bin/

ENV ENV="/fly/set-stolon-environment.sh"

EXPOSE 5432

CMD ["start"]
5 changes: 5 additions & 0 deletions scripts/set-stolon-environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

if [ -f /data/.env ]; then
export $(cat /data/.env)
fi

0 comments on commit aa228da

Please sign in to comment.