From 5584506473adbe0a86d20888a99864e9b168b7d8 Mon Sep 17 00:00:00 2001 From: Jan Mach <jan.mach@cesnet.cz> Date: Sat, 1 Jan 2022 09:09:49 +0100 Subject: [PATCH] Updated Vagrant based development documentation to be more clear. (Redmine issue: #7041) --- Makefile | 2 +- doc/sphinx/_doclib/development.rst | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 63dff67f..b0f425a1 100644 --- a/Makefile +++ b/Makefile @@ -501,7 +501,7 @@ data-fetch-dbsnapshot: FORCE data-import-dbsnapshot: FORCE @echo "\n$(GREEN)*** Importing latest production database dump ***$(NC)\n" - @sudo -u postgres pg_restore --verbose --format=d --dbname=mentat_main ./data/devsnapshot/main + @sudo -u postgres pg_restore --verbose --clean --if-exists --format=d --dbname=mentat_main ./data/devsnapshot/main @sudo -u postgres psql mentat_main -c "COPY reports_events ($(cat /vagrant/data/devsnapshot/main/reports_events.cols)) FROM stdin;" < ./data/devsnapshot/chunks/reports_events.dat @sudo -u postgres psql mentat_main -c "COPY statistics_events ($(cat /vagrant/data/devsnapshot/main/statistics_events.cols)) FROM stdin;" < ./data/devsnapshot/chunks/statistics_events.dat @sudo -u postgres psql mentat_main -c "COPY changelogs_items ($(cat /vagrant/data/devsnapshot/main/changelogs_items.cols)) FROM stdin;" < ./data/devsnapshot/chunks/changelogs_items.dat diff --git a/doc/sphinx/_doclib/development.rst b/doc/sphinx/_doclib/development.rst index 83888c4c..e8f8dc62 100644 --- a/doc/sphinx/_doclib/development.rst +++ b/doc/sphinx/_doclib/development.rst @@ -690,12 +690,24 @@ initial tips: .. code-block:: shell + # Alias to quickly sudo su to mentat system user + sm # Stands for 'sudoSuMentat' + # Alias to quickly sudo su to vagrant system user + sv # Stands for 'sudoSuVagrant' # Alias to quickly enter work directory: wd # Stands for 'WorkDirectory' # Alias to enable Python virtual environment: ve # Stands for 'VirtualEnvironment' -Basically you should execute both of these aliases in succesion to end up with a prompt like this +The ``mentat`` user is the system user preconfigured to run Mentat. The ``vagrant`` user is a system user that owns +all project files. If you need to execute Mentat scripts and daemons, you should always switch to ``mentat`` +user. If you need to work with the files and Vagrant box, you should always switch to ``vagrant`` user. +It is possible, that both of these user accounts will be merged in the future. However now the roles +are kept separate, because the usage of ``mentat`` user mimics the environment on production and ``vagrant`` user +is deeply baked into Vagrant and the change could be distruptive. By default by executing ``vagrant ssh`` +command you will be connected as vagrant user. + +Basically you should always execute ``ve`` alias to activate virtual environment and to end up with a prompt like this and be ready to work: .. code-block:: shell -- GitLab