Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is config.sessionStartupCustom possible on Workbench? #344

Open
SamEdwardes opened this issue Mar 3, 2023 · 2 comments
Open

Is config.sessionStartupCustom possible on Workbench? #344

SamEdwardes opened this issue Mar 3, 2023 · 2 comments
Labels

Comments

@SamEdwardes
Copy link
Contributor

SamEdwardes commented Mar 3, 2023

The Workbench Helm chart currently has a config.startupCustom key. For example:

startupCustom:
create-users-ongoing.sh: |
#!/bin/bash
for user in users.txt; do
USERNAME=$(cat users.txt | grep -v '^\s*#'| cut -d: -f1)
USERID=$(cat users.txt | grep -v '^\s*#'| cut -d: -f2)
echo "$USERNAME"
PASSWORD=$(cat users.txt | grep -v '^\s*#'| cut -d: -f3)
useradd -u $USERID -m -s /bin/bash -N $USERNAME
echo "$USERNAME:$PASSWORD" | sudo chpasswd
done;
echo 'sleeping forever'
while :; do read; done

Would it be possible to have scripts that run when a IDE session starts? The motivation for this is a want to create a symlink on the session container before the IDE starts. For example:

config:
  session:
    repos.conf:
      RSPM: https://packagemanager.rstudio.com/cran/__linux__/jammy/latest
      CRAN: https://packagemanager.rstudio.com/cran/__linux__/jammy/latest
  sessionStartupCustom:
    symlink-odbc.sh: |
      #!/bin/bash
      ln -s /mnt/session-secret/odbc.ini /ect/odbc.ini
  sessionSecret:
    odbc.ini: |
      [ProjectAbcDatabase]
      Database=project_abc
      Driver=PostgreSQL
      Password=password
      Port=5432
      Servername=database-postgresql
      UserName=posit_team

Or maybe there is a way to already do this?

@SamEdwardes SamEdwardes changed the title Is config.sessionCustomStartup possible on Workbench? Is config.sessionStartupCustom possible on Workbench? Mar 3, 2023
@colearendt colearendt added the rsw label Mar 30, 2023
@colearendt
Copy link
Contributor

I think for proper function, this would need to be built into the product. We have this doc here, but it is really gross and not something we would want to standardize:

https://support.posit.co/hc/en-us/articles/360059743753-Customizing-the-Entrypoint-with-RStudio-Workbench-RStudio-Server-Pro-Job-Launcher-and-Kubernetes

But maybe something like a /docker-entrypoint.d/ directory for session images that is respected and used by the rserver-launcher process could help with situations like this... although it would not help "launcher jobs," which do not run a parent binary. This is kinda the convention being set up here: rstudio/rstudio-docker-products#337

@SamEdwardes
Copy link
Contributor Author

Thanks for the input Cole. How does it work for config.startupCustom? Is that baked in at the product level? Could we just replicate the same logic to have a config.sessionStartupCustom?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants