Skip to content

Created Initialization Script + Documentation#1171

Open
conzty01 wants to merge 9 commits intoRunestoneInteractive:mainfrom
conzty01:main
Open

Created Initialization Script + Documentation#1171
conzty01 wants to merge 9 commits intoRunestoneInteractive:mainfrom
conzty01:main

Conversation

@conzty01
Copy link

@conzty01 conzty01 commented Mar 6, 2026

I created an initialization script that can be used to get the project set up and running locally with an interactive wizard instead of the manual steps outlined in the running.rst documentation. This script has been tested in a Windows WSL environment but has been built to function in UNIX environments. Unfortunately, I don't have the resources to test in Linux or MacOS at the moment, but can work on getting that done if necessary.

This script essentially runs through the steps outlined in the running.rst documentation in an interactive way-- prompting the user for paths or values. It detects when the script has been run more than once and backs up any .env files in the root directory and provides options for how to handle an existing database:

  1. Skip initialization and continue
  2. Reset database
  3. Exit script and manually intervene

I'd appreciate some feedback on the portions regarding adding a course as I ran into difficulties even with the manual steps in that area. I'm not sure if the docs are out of date, or I am just not understanding something but I'd be happy to take another look and alter the prompts so that this part of the process makes sense for a new user.

This PR was created with the assistance of GitHub Copilot.

@conzty01 conzty01 requested a review from bnmnetp as a code owner March 6, 2026 21:40
@bnmnetp
Copy link
Member

bnmnetp commented Mar 7, 2026

@conzty01 Thanks for your contribution! I'll have a closer look at it early next week.

@bnmnetp
Copy link
Member

bnmnetp commented Mar 10, 2026

Trying it out now, just keeping a running list of issues or updates.

  1. Should check that the user is in the docker group or they will get a message that docker is not running.
  2. I think it would be ideal to have this script run like other things such as poetry where we can use curl to grab it, have it start up and fetch the sample.env as well as the docker_compose.yml file so the user does not need to clone the rs repo.

I think I need to spin up a test droplet to go further. (which I will do) Happy to answer questions about adding books, as I think the docs there should be up to date.

@conzty01 conzty01 marked this pull request as draft March 10, 2026 03:54
@bnmnetp
Copy link
Member

bnmnetp commented Mar 10, 2026

OK, I got to the point of adding a book.

[X] ERROR: Failed to add book to database
[!] WARNING: Failed to add book to database, but repository is cloned

There is a subset of books that are automatically added by the initdb command including thinkcspy. Which is what I was trying. But I don't think that the addbookauthor subcommand should be failing due to that.

@bnmnetp
Copy link
Member

bnmnetp commented Mar 10, 2026

I checked the database after the failure and thinkcspy was not in the library table. I ran:

docker compose run --rm rsmanage rsmanage addbookauthor --book thinkcspy --author testuser1

That was successful.

@bnmnetp
Copy link
Member

bnmnetp commented Mar 10, 2026

So I think the real error is:

the input device is not a TTY

Maybe adding the book as I showed above would be the way forward rather than doing it interactively.

@conzty01
Copy link
Author

conzty01 commented Mar 10, 2026

Thanks for the feedback! I've updated the script which should make it less likely for us to run into weird issues with being interactive. I think this may have been the cause of the issues we were having creating a book.

That said, there is still a small roadblock in trying to make this script a one-line install using pipes. The root of the issue stems from the fact that piping the output of curl into bash means that the script cannot read from the keyboard for stdin. This becomes a problem since we repeatedly prompt the user for certain decisions or values in the current iteration of the setup script.

One workaround to keep this on a single line would be process substitution. With that, the command would end up looking like this:

bash <(curl -fsSL https://raw.githubusercontent.com/RunestoneInteractive/rs/main/init_runestone.sh)

In my opinion, this syntax is a bit unintuitive for those that aren't terminal power-users (myself included) and I wouldn't want to confuse/deter anybody from the automated setup process (though maybe it's a teaching moment?). However, it is just a single line and perhaps the chances are good that a person reading the docs would just copy and paste it in to their terminal anyway.

If you are satisfied with this implementation, I can update the docs to reflect the new command and talk a bit more about the various parts of the process.

@bnmnetp
Copy link
Member

bnmnetp commented Mar 11, 2026

Yeah, this is nearly identical to the command on brew.sh for installing homebrew. I think we would do exactly the same thing in our README and other web sites and give them a button to copy the command and paste it into the CLI.

@conzty01
Copy link
Author

Finished last touches and documentation updates for this PR. Please let me know if there is anything else you'd like included or if anything needs to be updated.

@conzty01 conzty01 marked this pull request as ready for review March 13, 2026 18:33
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.

2 participants