Compare commits

...

34 Commits

Author SHA1 Message Date
Gerardo GIl Elizeire 14fe0af2f6 Merge branch 'main' into add_python_scripts
refs #1689 - Add Convert IMG to VM
2025-03-18 16:50:42 +01:00
Gerardo GIl Elizeire 55b3304fea Merge pull request 'refs #1701 - 'convertVMtoIMG.py' improvement' (#27) from add_python_scripts into main
Reviewed-on: #27
2025-03-13 10:46:23 +01:00
Gerardo GIl Elizeire 20a1628dd3 Merge pull request 'refs #1701 - Fix script convertVMtoIMG.py' (#26) from add_python_scripts into main
Reviewed-on: #26
2025-03-12 17:33:28 +01:00
Gerardo GIl Elizeire bafa4c78fa Merge pull request 'refs #1681 - Add ogGit install status' (#25) from add_python_scripts into main
Reviewed-on: #25
2025-03-10 11:08:34 +01:00
Gerardo GIl Elizeire 064a8f1fab Merge pull request 'refs #1642 - Modify Cancel Transfers scripts' (#24) from add_python_scripts into main
Reviewed-on: #24
2025-03-05 15:34:29 +01:00
Gerardo GIl Elizeire 48dfc3d190 Merge pull request 'refs #1525 - Add Convert VM to IMG' (#23) from add_python_scripts into main
Reviewed-on: #23
2025-03-03 16:32:38 +01:00
Gerardo GIl Elizeire ffe8fb32be Merge pull request 'refs #1530 - Add 'backupImage.py' and related endpoint' (#22) from add_python_scripts into main
Reviewed-on: #22
2025-02-20 14:15:21 +01:00
Gerardo GIl Elizeire ba7d678e11 Merge pull request 'refs #1482 - Modify Paramiko SSH Client parameters' (#21) from add_python_scripts into main
Reviewed-on: #21
2025-02-11 10:34:28 +01:00
Gerardo GIl Elizeire 0b07704fa7 Merge pull request 'add_python_scripts' (#20) from add_python_scripts into main
Reviewed-on: #20
2025-02-06 16:33:53 +01:00
Gerardo GIl Elizeire 78e94d8a12 Merge pull request 'refs #1437 - Scripts corrections' (#19) from add_python_scripts into main
Reviewed-on: #19
2025-02-03 16:59:18 +01:00
Gerardo GIl Elizeire d8a0862bfd Merge pull request 'refs #1437 - Remove unnecessary sudo calls' (#18) from add_python_scripts into main
Reviewed-on: #18
2025-02-03 12:18:06 +01:00
Gerardo GIl Elizeire a1d4773c7e Merge pull request 'refs #1378 - Add API tests and modify API' (#17) from add_python_scripts into main
Reviewed-on: #17
2025-01-31 13:18:16 +01:00
Gerardo GIl Elizeire f7c2ad84f0 Merge pull request 'refs #1378 - Fix API tests errors' (#16) from add_python_scripts into main
Reviewed-on: #16
2025-01-28 10:42:28 +01:00
Gerardo GIl Elizeire 386cc01e7f Merge pull request 'refs #1346 - Add API tests' (#15) from add_python_scripts into main
Reviewed-on: #15
2025-01-24 11:35:38 +01:00
Gerardo GIl Elizeire dc1659c52a Merge pull request 'refs #1335 - Supress recursive image search' (#14) from add_python_scripts into main
Reviewed-on: #14
2025-01-10 12:43:37 +01:00
Gerardo GIl Elizeire 6083e8bbde Merge pull request 'refs #1294 - Modify logs format' (#13) from add_python_scripts into main
Reviewed-on: #13
2024-12-17 17:14:19 +01:00
Gerardo GIl Elizeire 62ff1a5257 Merge pull request 'refs #1242 - API logs improvement' (#12) from add_python_scripts into main
Reviewed-on: #12
2024-12-12 15:16:14 +01:00
Gerardo GIl Elizeire 44ea72930d Merge pull request 'refs #631 - Modify logs in API and some scripts' (#11) from add_python_scripts into main
Reviewed-on: #11
2024-12-02 10:37:42 +01:00
Gerardo GIl Elizeire 65d41f0c6a Merge pull request 'refs #631 - Add journalctl logs to scripts' (#10) from add_python_scripts into main
Reviewed-on: #10
2024-11-29 13:12:09 +01:00
Gerardo GIl Elizeire e9682a65e9 Merge pull request 'refs #631 - Add journalctl logs to API' (#9) from add_python_scripts into main
Reviewed-on: #9
2024-11-28 16:55:16 +01:00
Nicolas Arenas 9976714f79 Add python3-request 2024-11-26 13:27:10 +01:00
Gerardo GIl Elizeire b73e84b610 Merge pull request 'refs #631 - More API improvements' (#8) from add_python_scripts into main
Reviewed-on: #8
2024-11-22 10:52:17 +01:00
Gerardo GIl Elizeire 6650cb28af Merge pull request 'refs #631 - API improvement' (#7) from add_python_scripts into main
Reviewed-on: #7
2024-11-21 13:08:27 +01:00
Nicolas Arenas b3366b365e Adjust Ipcore parameter for installation 2024-11-20 18:26:00 +01:00
Gerardo GIl Elizeire 0f63862815 Merge pull request 'add_python_scripts' (#6) from add_python_scripts into main
Reviewed-on: #6
2024-11-20 12:58:31 +01:00
Nicolas Arenas f76a3368ac Merge pull request 'add_python_scripts' (#5) from add_python_scripts into main
Reviewed-on: #5
2024-11-15 13:28:25 +01:00
Nicolas Arenas 752aee1212 Merge pull request 'Updated permissions for all binary files' (#4) from fix_installer into main
Reviewed-on: #4
2024-11-13 23:27:00 +01:00
Nicolas Arenas f713469f6e Updated permissions for all binary files 2024-11-13 19:52:23 +01:00
Nicolas Arenas a6837f87b1 Merge pull request 'fix_installer' (#3) from fix_installer into main
Reviewed-on: #3
2024-11-13 14:52:57 +01:00
Nicolas Arenas 3990648345 - ticket #1140 se añade el paquete wakeonline
-ticket #1141 Se deshabilita uftp
2024-11-13 13:45:22 +01:00
Nicolas Arenas 5b10fdf1bd Ticket #1039 fix worong permissions in ogrepo-api service 2024-11-13 13:21:50 +01:00
Nicolas Arenas 7a7565de7f Fix wrong instaces of username for #1132 2024-11-13 13:12:35 +01:00
Nicolas Arenas bac07800b4 #1139 change default user and directories 2024-11-13 13:02:11 +01:00
Gerardo GIl Elizeire 3891130480 Merge pull request 'add_python_scripts' (#2) from add_python_scripts into main
Reviewed-on: #2
2024-11-11 15:01:31 +01:00
2 changed files with 22 additions and 16 deletions

View File

@ -3,8 +3,8 @@ Description=Gunicorn instance to serve repo_api
After=network.target
[Service]
User=ogrepository
Group=ogrepository
User=%%OGREPOSITORY_USER%%
Group=%%OGREPOSITORY_USER%%
WorkingDirectory=/opt/opengnsys/ogrepository/api
ExecStart=/usr/bin/gunicorn -w 4 -b 0.0.0.0:8006 repo_api:app

View File

@ -6,8 +6,9 @@ GIT_BRANCH=$1
GIT_REPO=https://ognproject.evlt.uma.es/gitea/opengnsys/ogrepository.git
GIT_SSL_NO_VERIFY=true
REPO_IP=${REPO_IP:-"127.0.0.1"}
SMBUSER=${SMBUSER:-"ogrepository"}
SMBPASS=${SMBPASS:-"ogrepository"}
CORE_IP=${CORE_IP:-"127.0.0.1"}
OGUSER=${OGUSER:-"opengnsys"}
OGPASS=${OGPASS:-"og"}
INSTALL_DIR=/opt/opengnsys/ogrepository
DOWNLOAD_DIR=/tmp/ogrepository
DEBIAN_FRONTEND=noninteractive
@ -18,7 +19,7 @@ clone_repository() {
local BRANCH=$1
rm -rf $DOWNLOAD_DIR
git clone -b "$BRANCH" $GIT_REPO $DOWNLOAD_DIR
chown -R ogrepository:ogrepository $DOWNLOAD_DIR
chown -R $OGUSER:$OGUSER $DOWNLOAD_DIR
}
check_root() {
@ -30,6 +31,8 @@ check_root() {
install_uftp() {
apt install uftp -y
systemctl stop uftp
systemctl disable uftp
}
install_updcast () {
@ -37,13 +40,13 @@ install_updcast () {
}
add_user_ogrepository() {
if ! id "ogrepository" &>/dev/null; then
if ! id "$OGUSER" &>/dev/null; then
echo "User ogrepository does not exist, creating it"
useradd -r -s /bin/bash ogrepository
useradd -r -s /bin/bash $OGUSER
fi
if [ ! -f /etc/sudoers.d/ogrepository ]; then
echo "User ogrepository does not have sudo permissions, adding it"
echo 'ogrepository ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/ogrepository
if [ ! -f /etc/sudoers.d/$OGUSER ]; then
echo "User $OGUSER does not have sudo permissions, adding it"
echo "$OGUSER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/"$OGUSER"
fi
}
@ -51,12 +54,12 @@ add_user_ogrepository() {
create_directories() {
mkdir -p $INSTALL_DIR
mkdir -p $INSTALL_DIR/images $INSTALL_DIR/images_trash/ $INSTALL_DIR/bin/ $INSTALL_DIR/etc/ $INSTALL_DIR/log/ $INSTALL_DIR/api/
chown -R ogrepository:ogrepository $INSTALL_DIR
chown -R $OGUSER:$OGUSER $INSTALL_DIR
}
install_dependencies() {
apt update -y
apt install -y git python3 python3-pip python3-flask python3-paramiko python3-psutil python3-flasgger debian-archive-keyring samba gunicorn
apt install -y git python3 python3-pip python3-flask python3-paramiko python3-psutil python3-flasgger debian-archive-keyring samba gunicorn wakeonlan python3-requests
}
install_ext_repo() {
@ -70,6 +73,7 @@ install_external_packages() {
install_ogrepo-api_service() {
cp -r $DOWNLOAD_DIR/installer/files/ogrepo-api.service /etc/systemd/system/ogrepo-api.service
sed -i "s/%%OGREPOSITORY_USER%%/$OGUSER/g" /etc/systemd/system/ogrepo-api.service
systemctl enable --now ogrepo-api
}
@ -77,18 +81,20 @@ install_files() {
cp -pr $DOWNLOAD_DIR/bin/* $INSTALL_DIR/bin/
cp -pr $DOWNLOAD_DIR/etc/* $INSTALL_DIR/etc/
cp -pr $DOWNLOAD_DIR/api/* $INSTALL_DIR/api/
chown -R ogrepository:ogrepository $INSTALL_DIR
chown -R $OGUSER:$OGUSER $INSTALL_DIR
chmod 755 $INSTALL_DIR/bin/*
echo IPlocal="$REPO_IP" > $INSTALL_DIR/etc/ogAdmRepo.cfg
sudo chown ogrepository:ogrepository $INSTALL_DIR/etc/ogAdmRepo.cfg
echo IPcore="$CORE_IP" >> $INSTALL_DIR/etc/ogAdmRepo.cfg
sudo chown $OGUSER:$OGUSER $INSTALL_DIR/etc/ogAdmRepo.cfg
}
configure_samba() {
echo "include = /etc/samba/smb.conf.ogrepository" >> /etc/samba/smb.conf
cp $DOWNLOAD_DIR/installer/files/ogrepo-smb.conf /etc/samba/smb.conf.ogrepository
sed -i "s/%%OGREPOSITORY_USER%%/$SMBUSER/g" /etc/samba/smb.conf.ogrepository
sed -i "s/%%OGREPOSITORY_USER%%/$OGUSER/g" /etc/samba/smb.conf.ogrepository
systemctl restart smbd
# Create default user ogrepository
(echo $SMBPASS; echo $SMBPASS) | smbpasswd -s -a $SMBUSER
(echo $OGPASS; echo $OGPASS) | smbpasswd -s -a $OGUSER
}