Skip to content
Snippets Groups Projects
Commit f4a90d39 authored by Marko Mecina's avatar Marko Mecina
Browse files

add make target for creating DB user

parent 31094b96
No related branches found
No related tags found
No related merge requests found
.PHONY: install-confignator ccs-storage codeblockreusefeature install-testlib .PHONY: confignator ccs-storage codeblockreusefeature install-testlib python-requirements db-user database-dev-env databases
# all: install install-database-dev-env install: python-requirements confignator ccs-storage codeblockreusefeature
install: install-python-requirements install-confignator ccs-storage codeblockreusefeature
databases: ccs-storage codeblockreusefeature databases: ccs-storage codeblockreusefeature
install-confignator: db-user:
sudo ./mk_mysql_user.sh $(USER) $(PW)
python-requirements:
@echo "+-----------------------------+"
@echo "| installing Python modules |"
@echo "+-----------------------------+"
if [ -z $VIRTUAL_ENV ]; then pip install --user -U -r $(CURDIR)/requirements.txt; else pip install -U -r $(CURDIR)/requirements.txt; fi
@echo "+-----------------------------+"
@echo "| installed Python modules |"
@echo "+-----------------------------+"
@echo
confignator:
@echo "+---------------------------------------+" @echo "+---------------------------------------+"
@echo "| installing confignator Python package |" @echo "| installing confignator Python package |"
@echo "+---------------------------------------+" @echo "+---------------------------------------+"
...@@ -18,36 +29,6 @@ install-confignator: ...@@ -18,36 +29,6 @@ install-confignator:
@echo "+--------------------------------------+" @echo "+--------------------------------------+"
@echo @echo
install-testlib:
@echo "+-----------------------------------+"
@echo "| installing testlib Python package |"
@echo "+-----------------------------------+"
$(MAKE) all -C $(CURDIR)/Tst/testing_library
@echo "+----------------------------------+"
@echo "| installed testlib Python package |"
@echo "+----------------------------------+"
@echo
install-database-dev-env:
@echo "+---------------------------------------------------+"
@echo "| installing Python dev packages for the database |"
@echo "+---------------------------------------------------+"
$(MAKE) install-devenv -C $(CURDIR)/Ccs/database
@echo "+---------------------------------------------------+"
@echo "| installed Python dev packages for the database |"
@echo "+---------------------------------------------------+"
@echo
install-python-requirements:
@echo "+-----------------------------+"
@echo "| installing Python modules |"
@echo "+-----------------------------+"
if [ -z $VIRTUAL_ENV ]; then pip install --user -U -r $(CURDIR)/requirements.txt; else pip install -U -r $(CURDIR)/requirements.txt; fi
@echo "+-----------------------------+"
@echo "| installed Python modules |"
@echo "+-----------------------------+"
@echo
ccs-storage: ccs-storage:
@echo "+----------------------------------------+" @echo "+----------------------------------------+"
@echo "| setting up the storage database schema |" @echo "| setting up the storage database schema |"
...@@ -68,6 +49,26 @@ codeblockreusefeature: ...@@ -68,6 +49,26 @@ codeblockreusefeature:
@echo "+---------------------------------------------------+" @echo "+---------------------------------------------------+"
@echo @echo
database-dev-env:
@echo "+---------------------------------------------------+"
@echo "| installing Python dev packages for the database |"
@echo "+---------------------------------------------------+"
$(MAKE) install-devenv -C $(CURDIR)/Ccs/database
@echo "+---------------------------------------------------+"
@echo "| installed Python dev packages for the database |"
@echo "+---------------------------------------------------+"
@echo
install-testlib:
@echo "+-----------------------------------+"
@echo "| installing testlib Python package |"
@echo "+-----------------------------------+"
$(MAKE) all -C $(CURDIR)/Tst/testing_library
@echo "+----------------------------------+"
@echo "| installed testlib Python package |"
@echo "+----------------------------------+"
@echo
set-start-scripts-permissions: set-start-scripts-permissions:
@echo "+-----------------------------------------------------+" @echo "+-----------------------------------------------------+"
@echo "| setting permissions for the start scripts (execute) |" @echo "| setting permissions for the start scripts (execute) |"
......
...@@ -19,12 +19,18 @@ This file documents the required steps to get the UVIE EGSE software up and runn ...@@ -19,12 +19,18 @@ This file documents the required steps to get the UVIE EGSE software up and runn
$> sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql $> sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
$> sudo systemctl enable --now mariadb $> sudo systemctl enable --now mariadb
$> sudo mariadb-secure-installation (optional) $> sudo mariadb-secure-installation (optional)
To create a MariaDB user, in the CCS base directory execute
$> make db-user USER=<user> PW=<password>
Alternatively, execute the following SQL statements:
mysql> CREATE USER 'user'@'localhost' IDENTIFIED BY 'password'; mysql> CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost'; mysql> GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost';
mysql> FLUSH PRIVILEGES; mysql> FLUSH PRIVILEGES;
4) Install Python packages. To install the required modules with pip in userspace or a venv, run 4) Install Python packages. To install the required modules with pip in userspace or a venv, run
'make install-python-requirements' in the CCS base directory or use 'pip install [--user] -r requirements.txt'. 'make python-requirements' in the CCS base directory or use 'pip install [--user] -r requirements.txt'.
If using a venv, it must have been created using the --system-site-packages option. If using a venv, it must have been created using the --system-site-packages option.
For more details, see requirements.txt For more details, see requirements.txt
...@@ -35,9 +41,8 @@ In the CCS base directory, ...@@ -35,9 +41,8 @@ In the CCS base directory,
- first configure the [database] section in egse.cfg! - first configure the [database] section in egse.cfg!
- then execute: - then execute:
$> make install-confignator $> make confignator
$> make ccs-storage $> make databases
$> make codeblockreusefeature
# MIB # MIB
Use CCS/Ccs/tools/import_mib.py to import a set of SCOS2000 MIB files into the MySQL mib-schema set in egse.cfg Use CCS/Ccs/tools/import_mib.py to import a set of SCOS2000 MIB files into the MySQL mib-schema set in egse.cfg
......
#!/bin/bash
USER=$1
PW=$2
mysql -e "CREATE USER '${USER}'@'localhost' IDENTIFIED BY '${PW}';"
mysql -e "GRANT ALL PRIVILEGES ON * . * TO '${USER}'@'localhost';"
mysql -e "FLUSH PRIVILEGES;"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment