mirror of
https://codeberg.org/catask-org/catask.git
synced 2025-04-19 13:23:41 -05:00
remove pooling options from connectToDb() as it has caused issues
This commit is contained in:
parent
c85e4397b5
commit
82c6a8b67b
3 changed files with 53 additions and 16 deletions
|
@ -62,8 +62,6 @@ def connectToDb():
|
||||||
password=dbPass,
|
password=dbPass,
|
||||||
database=dbName,
|
database=dbName,
|
||||||
port=dbPort,
|
port=dbPort,
|
||||||
pool_name=f"{const.appName}-pool",
|
|
||||||
pool_size=32,
|
|
||||||
autocommit=True
|
autocommit=True
|
||||||
)
|
)
|
||||||
return conn
|
return conn
|
||||||
|
|
66
install.sh
66
install.sh
|
@ -1,31 +1,69 @@
|
||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
# work in progress
|
working_dir=~/tmp/catask
|
||||||
id -u catask >/dev/null 2>&1 || sudo useradd -r -s /bin/false -m -d /etc/catask -U catask
|
|
||||||
# cloning branch dev for now because the installer doesn't exist in main branch yet
|
|
||||||
git clone https://git.gay/mst/catask ~/tmp/catask --branch dev
|
|
||||||
cd ~/tmp/catask
|
|
||||||
|
|
||||||
commit_short_hash=$(git rev-parse --short HEAD)
|
|
||||||
bold=$(tput bold)
|
bold=$(tput bold)
|
||||||
normal=$(tput sgr0)
|
normal=$(tput sgr0)
|
||||||
|
git_repo_url="https://git.mst.k.vu/mst/catask"
|
||||||
|
git_repo_issue_url="${git_repo_url}/issues/new"
|
||||||
|
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
echo "${bold}Installing CatAsk (commit ${commit_short_hash})...${normal}"
|
echo "${bold}Installing CatAsk...${normal}"
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
echo
|
echo
|
||||||
|
echo "${bold}Cloning the repository...${normal}"
|
||||||
|
# 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
|
||||||
|
# cloning dev branch for now because the installer doesn't exist in main branch yet
|
||||||
|
git clone $git_repo_url $working_dir --branch dev
|
||||||
|
cd $working_dir
|
||||||
|
echo
|
||||||
echo "${bold}Creating & activating virtual environment...${normal}"
|
echo "${bold}Creating & activating virtual environment...${normal}"
|
||||||
python3 -m venv venv && . venv/bin/activate
|
python3 -m venv venv && . venv/bin/activate
|
||||||
echo
|
echo
|
||||||
echo "${bold}Installing required packages...${normal}"
|
echo "${bold}Installing required packages...${normal}"
|
||||||
|
echo
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
# move to /etc/catask after installing packages
|
# move to /etc/catask after installing packages
|
||||||
sudo cp -r ~/tmp/catask/ /etc/catask/
|
sudo mv $working_dir /etc/
|
||||||
|
working_dir="/etc/catask"
|
||||||
|
|
||||||
|
# check if redis is installed
|
||||||
|
if ! command -v redis-cli 2>&1 >/dev/null; then
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "${bold}Installing Redis...${normal}"
|
||||||
|
# grab variables from os-release file
|
||||||
|
. /etc/os-release
|
||||||
|
os_like=$ID_LIKE
|
||||||
|
case "$os_like" in
|
||||||
|
debian)
|
||||||
|
# standard redis install instructions from https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/#install-on-ubuntudebian
|
||||||
|
sudo apt-get install lsb-release curl gpg
|
||||||
|
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
|
||||||
|
sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
|
||||||
|
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install redis
|
||||||
|
;;
|
||||||
|
fedora)
|
||||||
|
# standard redis install instructions from https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/#install-on-red-hatrocky
|
||||||
|
sudo dnf install redis
|
||||||
|
sudo systemctl enable redis
|
||||||
|
sudo systemctl start redis
|
||||||
|
;;
|
||||||
|
# if id isn't like debian or fedora
|
||||||
|
*)
|
||||||
|
echo "Distribution '$os_like' isn't yet supported. File an issue at ${git_repo_issue_url}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "${bold}Configuring CatAsk...${normal}"
|
echo "${bold}Configuring CatAsk...${normal}"
|
||||||
cp .env.example .env; cp config.example.json config.json
|
cd $working_dir
|
||||||
|
cp $working_dir/.env.example $working_dir/.env; cp $working_dir/config.example.json $working_dir/config.json
|
||||||
echo
|
echo
|
||||||
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
|
nano config.json
|
||||||
|
@ -33,10 +71,10 @@ read -n 1 -s -r -p "Press any key to open .env config file..."
|
||||||
nano .env
|
nano .env
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo 'Initializing the database...'
|
echo "${bold}Initializing the database...${normal}"
|
||||||
if flask init-db; then : ; else
|
if flask init-db; then : ; else
|
||||||
echo 'If the error is "MySQL Connection not available." then you can safely ignore it'
|
# echo 'If the error is "MySQL Connection not available." then you can safely ignore it'
|
||||||
echo 'Otherwise, create an issue at https://git.mst.k.vu/mst/catask/issues/new'
|
echo "Otherwise, create an issue at ${git_repo_issue_url}"
|
||||||
read -p "Proceed? (y/N) " proceed_after_error
|
read -p "Proceed? (y/N) " proceed_after_error
|
||||||
proceed_after_error="${proceed_after_error,,}"
|
proceed_after_error="${proceed_after_error,,}"
|
||||||
echo $proceed_after_error
|
echo $proceed_after_error
|
||||||
|
@ -49,7 +87,7 @@ fi
|
||||||
|
|
||||||
read -p "Do you want to install CatAsk as a systemd service? (Y/n) " sysd_service_input
|
read -p "Do you want to install CatAsk as a systemd service? (Y/n) " sysd_service_input
|
||||||
|
|
||||||
if [[ "$sysd_service_input" == 'n' ]]; then
|
if [[ "${sysd_service_input,,}" == 'n' ]]; then
|
||||||
echo "Start CatAsk with: ${bold}gunicorn -w 4 app:app -b 127.0.0.1:5000${normal}"
|
echo "Start CatAsk with: ${bold}gunicorn -w 4 app:app -b 127.0.0.1:5000${normal}"
|
||||||
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
|
||||||
|
|
|
@ -7,3 +7,4 @@ bleach
|
||||||
pathlib
|
pathlib
|
||||||
Flask-Compress
|
Flask-Compress
|
||||||
gunicorn
|
gunicorn
|
||||||
|
Flask-Limiter
|
||||||
|
|
Loading…
Add table
Reference in a new issue