Commit 89d3845f authored by Raphael Beer's avatar Raphael Beer

Fix: install and restart script

parent 5250af43
......@@ -56,11 +56,6 @@ node_modules
!.env.example
.ht*
# starter scripts with possibly sensitive data
dev.sh
start.sh
restart.sh
# python misc
.venv
mprofile_*.dat
FROM python:3.5.7-slim-buster
RUN mkdir /app
WORKDIR /app
ADD requirements.txt /app/
ADD . /app
RUN pip3 install --no-cache-dir -r ./requirements.txt
WORKDIR /app
RUN ./install.sh
### Docker
Follow the quickstart instructions in our docker repo's [README](https://github.com/shadowban-eu/docker#shadowbandev).
### Install/Run
You need [virtualenv](https://pypi.org/project/virtualenv/) in $PATH, as both
`./install.sh` and `./docker-entry.sh` work on a venv in ./.venv
```bash
$ git clone https://github.com/shadowban-eu/shadowban-testing ./shadowban-testing; cd $_
$ ./install.sh
$ ./docker-entry.sh .env.example # takes any .env file
```
......
echo -n "Looking for python3: "
if ! hash python3 &> /dev/null; then
echo -e "\nFatal: Please install Python3 to use this program!"
exit 1
fi
echo "OK"
if [ ! -f .venv/bin/activate ]; then
echo "Creating new venv in: ./.venv"
virtualenv ./.venv
fi
echo "Loading virtualenv: ./.venv"
source ./.venv/bin/activate
#!/usr/bin/env bash
if [ -f $1 ]; then
source ./_venv
if [ "$1" != "" ] && [ -f $1 ]; then
echo "Using provided .env file: $1"
export $(cat $1 | xargs)
shift
......
#!/usr/bin/env bash
source ./_venv
echo "Installing dependencies..."
pip3 install -r requirements.txt --no-cache-dir
if [ $? -eq 0 ]; then
echo -e "\n----------------------------"
echo -e "Almost done! \\o/\n"
echo "Run 'PYTHON_ENV=[development|prodcution] ./docker-entry.sh .env.example' to start the server!"
echo -e "\nIf you want to make changes to the python packages, e.g. 'pip3 install ...', activate the venv, first: '. .venv/bin/activate'"
fi
if [ "$1" != "" ] && [ -f $1 ]; then
ENV_FILE=$1
else
ENV_FILE=.env
fi
echo 'Stopping service'
pkill -f twitter-auth-key
if [ $? -ne 0 ]; then
echo "Service not running. Aborting."
exit 1
fi
if [ "$1" == "-k" ]; then
echo "Deleting logs"
rm ./logs/*
fi
echo 'Starting service'
./docker-entry.sh $ENV_FILE
#!/usr/bin/env bash
echo -n "Looking for Python3: "
if ! hash python3; then
echo -n "\nPlease install Python3 to use this program!"
fi
echo "OK"
echo "Installing dependencies..."
pip3 install -r requirements.txt --no-cache-dir
echo -e "\n----------------------------"
echo "All done! \o/"
echo "Run 'PYTON_ENV=[development|prodcution] ./run.sh' to start the server!"
......@@ -4,20 +4,12 @@ attrs==20.3.0
beautifulsoup4==4.9.3
bs4==0.0.1
chardet==3.0.4
cycler==0.10.0
daemon==1.2
idna==2.10
kiwisolver==1.3.1
matplotlib==3.3.3
memory-profiler==0.58.0
multidict==5.1.0
numpy==1.19.4
Pillow==8.0.1
psutil==5.7.3
pymongo==3.11.2
pyparsing==2.4.7
python-dateutil==2.8.1
six==1.15.0
soupsieve==2.1
typing-extensions==3.7.4.3
yarl==1.6.3
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment