Skip to content

Instantly share code, notes, and snippets.

@abhi1010
Last active February 25, 2021 02:59
Show Gist options
  • Save abhi1010/791a85b7a7f29a67294e to your computer and use it in GitHub Desktop.
Save abhi1010/791a85b7a7f29a67294e to your computer and use it in GitHub Desktop.
Testing Reconwise from scratch
# become root
sudo su -
# enter docker img
docker exec -it $(docker ps -q) bash
# kill all main.py
ps -ef | egrep python | awk '{print $2}' | xargs kill -9
# restart v1 in docker
cd /ws/reconwisev1/src/
source /ws/ve_envs/rwv1/bin/activate
nohup python3.7 /ws/reconwisev1/src/main/python/main.py -c main/resources/prod-config.ini > /var/shared/v1_nohup.log 2>&1 &
## Change only the first three variables. Rest should be same.
DIR='/tmp/'
GIT_LOCATION='https://[email protected]/tildesg/reconwisev1.git'
VENV=$DIR/v_env_rw1
## You cannot change the following
RW='reconwisev1'
cd $DIR
### Delete the folders if they already exist
rm -rf $VENV
rm -rf $RW
echo "Removed $VENV and $RW folders from $DIR"
git clone $GIT_LOCATION
echo "git clone complete"
### Checkout the latest code from master branch
cd $RW && git fetch && git checkout master && cd ../
echo "Git Retrieval complete. About to try virtual environment setup. Will take a while"
echo "folder= $PWD"
### Create virtualenv folder
virtualenv -p python3.4 $VENV
### Activate the env and ensure the versions
source $VENV/bin/activate
which python && python --version
### Install the requirements
pip3.4 install -r $RW/requirements.txt
### Set the pythonpath so that "py.test-3.4" knows how to search the paths relatively
export PYTHONPATH=test/python/reconwisetestPy:main/python
### The following cd is important for PYTHONPATH to work.
cd $DIR/$RW/src/
## Before we continue, do we have a DB with data that is ready to be used?
mysql -u shippable < main/scripts/db_scripts.sql
#### Once you are in that path, the whole project is relative to this path (because of PYTHONPATH) so run the command from within that folder
py.test-3.4 test/python/reconwisetestPy/test.py --maxfail=3 -s --full-trace --tb=long

Change only the first three variables. Rest should be same.

DIR='/tmp/' GIT_LOCATION='https://[email protected]/tildesg/reconwisev1.git' VENV=$DIR/v_env_rw1

You cannot change the following

RW='reconwisev1' cd $DIR

Delete the folders if they already exist

rm -rf $VENV rm -rf $RW

echo "Removed $VENV and $RW folders from $DIR"

git clone $GIT_LOCATION echo "git clone complete"

Checkout the latest code from master branch

cd $RW && git fetch && git checkout master && cd ../

echo "Git Retrieval complete. About to try virtual environment setup. Will take a while" echo "folder= $PWD"

Create virtualenv folder

virtualenv -p python3.4 $VENV

Activate the env and ensure the versions

source $VENV/bin/activate which python && python --version

Install the requirements

pip3.4 install -r $RW/requirements.txt

Set the pythonpath so that "py.test-3.4" knows how to search the paths relatively

export PYTHONPATH=test/python/reconwisetestPy:main/python

The following cd is important for PYTHONPATH to work.

cd $DIR/$RW/src/

Before we continue, do we have a DB with data that is ready to be used?

mysql -u shippable < main/scripts/db_scripts.sql

Once you are in that path, the whole project is relative to this path (because of PYTHONPATH) so run the command from within that folder

py.test-3.4 test/python/reconwisetestPy/test.py --maxfail=3 -s --full-trace --tb=long

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment