mirror of
https://codeberg.org/catask-org/catask.git
synced 2025-04-19 13:23:41 -05:00
improve install script a little bit
This commit is contained in:
parent
bbe8994907
commit
d6acdb7919
1 changed files with 25 additions and 16 deletions
41
install.sh
41
install.sh
|
@ -1,9 +1,9 @@
|
||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
working_dir=~/.local/share/catask
|
working_dir=$PWD/catask
|
||||||
bold=$(tput bold)
|
bold=$(tput bold)
|
||||||
normal=$(tput sgr0)
|
normal=$(tput sgr0)
|
||||||
git_repo_url="https://git.mst.k.vu/mst/catask"
|
git_repo_url="https://git.mst.k.vu/catask-org/catask"
|
||||||
git_repo_issue_url="${git_repo_url}/issues/new"
|
git_repo_issue_url="${git_repo_url}/issues/new"
|
||||||
|
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
|
@ -12,9 +12,9 @@ echo "--------------------------"
|
||||||
echo
|
echo
|
||||||
echo "${bold}Cloning the repository...${normal}"
|
echo "${bold}Cloning the repository...${normal}"
|
||||||
# this might work... or not, who knows
|
# this might work... or not, who knows
|
||||||
id -u catask >/dev/null 2>&1 || sudo useradd -r -s /bin/false -m -d /etc/catask -U catask
|
# id -u catask >/dev/null 2>&1 || sudo useradd -r -s /bin/false -m -d $working_dir/home/catask -U catask
|
||||||
# cloning dev branch for now because the installer doesn't exist in main branch yet
|
# cloning dev branch for now because the installer doesn't exist in main branch yet
|
||||||
sudo git clone $git_repo_url $working_dir --branch dev
|
git clone $git_repo_url $working_dir
|
||||||
cd $working_dir
|
cd $working_dir
|
||||||
echo
|
echo
|
||||||
echo "${bold}Creating & activating virtual environment...${normal}"
|
echo "${bold}Creating & activating virtual environment...${normal}"
|
||||||
|
@ -64,10 +64,16 @@ echo
|
||||||
echo "${bold}Configuring CatAsk...${normal}"
|
echo "${bold}Configuring CatAsk...${normal}"
|
||||||
cp $working_dir/.env.example $working_dir/.env; cp $working_dir/config.example.json $working_dir/config.json
|
cp $working_dir/.env.example $working_dir/.env; cp $working_dir/config.example.json $working_dir/config.json
|
||||||
echo
|
echo
|
||||||
|
if ! command -v $EDITOR 2>&1 >/dev/null; then
|
||||||
|
echo "No default editor found, falling back to ${bold}nano${normal}..."
|
||||||
|
editor_=nano
|
||||||
|
else
|
||||||
|
editor_=$EDITOR
|
||||||
|
fi
|
||||||
read -n 1 -s -r -p "Press any key to open main config file..."
|
read -n 1 -s -r -p "Press any key to open main config file..."
|
||||||
nano config.json
|
$editor_ config.json
|
||||||
read -n 1 -s -r -p "Press any key to open .env config file..."
|
read -n 1 -s -r -p "Press any key to open .env config file..."
|
||||||
nano .env
|
$editor_ .env
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "${bold}Initializing the database...${normal}"
|
echo "${bold}Initializing the database...${normal}"
|
||||||
|
@ -89,17 +95,20 @@ if [[ "${sysd_service_input,,}" == 'n' ]]; then
|
||||||
echo "Replace ${bold}127.0.0.1:5000${normal} with address where CatAsk will run"
|
echo "Replace ${bold}127.0.0.1:5000${normal} with address where CatAsk will run"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
read -p "Address on which CatAsk will run (127.0.0.1:5000): " catask_addr
|
read -p "Address on which CatAsk will run (127.0.0.1:5000): " catask_addr
|
||||||
catask_addr=${catask_addr:-127.0.0.1:5000}
|
catask_addr=${catask_addr:-127.0.0.1:5000}
|
||||||
sudo cat > /etc/systemd/system/catask.service << EOF
|
sudo cat > /etc/systemd/system/catask.service << EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=catask
|
Description=CatAsk
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=catask
|
User=%u
|
||||||
WorkingDirectory=$PWD
|
WorkingDirectory=$working_dir
|
||||||
ExecStart=$PWD/venv/bin/python3 -m gunicorn -w 4 app:app -b $catask_addr
|
ExecStart=$working_dir/venv/bin/python3 -m gunicorn -w 4 app:app -b $catask_addr
|
||||||
EOF
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
echo "Created a systemd service with these contents:"
|
echo "Created a systemd service with these contents:"
|
||||||
echo "-----------------------"
|
echo "-----------------------"
|
||||||
|
|
Loading…
Add table
Reference in a new issue