Openedx linux user creation before Tutor installation

Hi,

I am gathering info before installing the Tutor OpenEdX platform and yet from the official site installation I cannot find the part where the openedx linux user is created but I do in this guide.

It seems to me important enough to be mentioned in the official installation though. Shouldn’t be there too?

Don’t run Tutor with root. That is.

As it mention in guide you linked, no other reasons for dedicated tutor user.

And about your guide, I recommend you to add one more layer to it - install tutor using venv. It is really helpful when time comes to backup/update/development routine.

3 Likes

You’ll likely find that this specific bit of information is omitted in the official docs due to the wide support for different systems running docker and that the setup detail may thus vary (even if slightly) between systems. Ultimately the Linux user creation is a part of the Docker setup process, not specifically the Tutor setup.

In terms of being a sysadmin running a web server, the creation of a dedicated user account is pretty standard practice, running as root is highly discouraged, so it wouldn’t surprise me if that’s just assumed by the doc authors, though I agree there should probably at least be some footnote in the docs to remind about that requirement during setup.

And definitely agree with @kosolapovlb about using Python venv, good practice to keep your app environments distinct from your system environments. If you’re lazy and don’t want to have to manually activate your venv every time you SSH into your server you can add it to the .bashrc file of your Linux user to have it active automatically in your shell upon login…

2 Likes

So let me understand the process with python venv.

I run all the tutor commands after creating the user other than root while I am in a virtual environment?
If so how would it be possible and after I log out from ssh that the servers will be still running?

Sorry I am not very familiar with the whole virtual environment. All I know is that all packages are downloaded and installed, other than the default pip state when virtual environment was created, in a directory indicated. Leaving the shell will terminate the activation. Would that mean the end of the running processes of tutor/openedx?

Ok so lets assume you’ve created a linux user “tutor” and installed/set up your docker according to the documentation.
So now you’ve logged into the server with “ssh tutor@YourServerIP”
Now you create/activate your python venv, and PIP-install tutor and other desired plugins.

Once everything is set up and you’ve configured your tutor installation and started the instance then it will remain running until stopped. Closing your SSH session doesn’t normally stop the instance unless it’s not yet running as a daemon, to run as a daemon you should add the -d flag to start it, eg: tutor local start -d (see docs here)
to stop a daemonised instance you must run tutor local stop

If you close your SSH session and then reconnect, you must again activate your Python venv before you do anything with tutor.

If you don’t want to have to remember to manually activate your venv then add it to your PATH environment variable using the .bashrc file (eg: /home/tutor/.bashrc)

Assuming as an example that your venv is stored at /home/tutor/venv then you can append export PATH=~/venv/bin:$PATH to your .bashrc and close/reconnect your SSH session, it should now be active.
To confirm, you can type which python in the shell and you should expect it to print a path like /home/tutor/venv/bin/python
To confirm your Tutor instance is correctly installed to your venv you can also type which tutor and that should show the path to tutor in your venv: /home/tutor/venv/bin/tutor

hope this helps clear any confusion :slight_smile:

1 Like

Thank you it is clear enough for the installation.

Should you share where exactly the virtual environment helps with migrations?