Commit a06be8ab authored by ymir's avatar ymir

update deployment script

parent 2adb32e8
......@@ -39,7 +39,7 @@ deploy_development:
- sed -i s/"{ENV}"/"dev"/g install/host.sh
- sed -i s/"{SSH_USER_NAME}"/"${SSH_USER_NAME}"/g install/host.sh
# copy install script
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} -r install/*.sh ${SSH_USER_NAME}@91.121.9.53:/tmp
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} -r install/* ${SSH_USER_NAME}@91.121.9.53:/tmp
# run install
- sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 bash /tmp/host.sh
environment:
......
#!/usr/bin/env bash
# coding=utf-8
set -xe
# un-install existing command line tool
pip3 uninstall -y pythoncommontools || echo 0
pip3 uninstall -y neuralnetworkcommon || echo 0
pip3 uninstall -y neuralnetworktrainercli || echo 0
rm -Rf /root/.cache/pip/
# install command line tool & dependencies
apt-get install -y openssh-client sshpass python3 python3-pip python3-psutil python3-numpy python3-requests
pip3 install --extra-index-url http://91.121.9.53:81/archive --trusted-host 91.121.9.53 pythoncommontools neuralnetworkcommon neuralnetworktrainercli
# set-up configuration
mkdir -p /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/conf
mkdir -p /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/help
export SSHPASS={SSH_USER_PASS}
sshpass -e scp -o stricthostkeychecking=no -P {SSH_PORT} {SSH_USER_NAME}@91.121.9.53:/home/{SSH_USER_NAME}/shared/configuration/neuralnetworktrainercli/{ENVIRONMENT}.neuralnetworktrainercli.conf /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/conf/neuralnetworktrainercli.conf
sshpass -e scp -o stricthostkeychecking=no -P {SSH_PORT} {SSH_USER_NAME}@91.121.9.53:/home/{SSH_USER_NAME}/docker/continuous_integration/apache_pip/html/archive/neuralnetworktrainercli/neuralnetworktrainercli-{CI_BUILD_REF_NAME}.tar.gz /tmp
unset SSHPASS
tar -xzvf /tmp/neuralnetworktrainercli-{CI_BUILD_REF_NAME}.tar.gz -C /tmp
cp /tmp/neuralnetworktrainercli/help/neuralnetworktrainercli.sh /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/help
rm -Rf /tmp/neuralnetworktrainercli* /tmp/setup.py
# make program executable
chmod +x /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/neuralnetworktrainercli.py
ln -fs /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/neuralnetworktrainercli.py /usr/local/bin/neuralnetworktrainercli
......@@ -14,6 +14,14 @@ pip3 install --extra-index-url http://91.121.9.53:81/archive --trusted-host 91.1
# copy configuration file
mkdir -p /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/conf
mv /tmp/neuralnetworktrainercli.conf /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/conf
# copy help file
mkdir -p /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/help
pip3 download --extra-index-url http://91.121.9.53:81/archive --trusted-host 91.121.9.53 neuralnetworktrainercli || echo 0
mv neuralnetworktrainercli-*.tar.gz /tmp/neuralnetworktrainercli.tar.gz
tar -xzvf /tmp/neuralnetworktrainercli.tar.gz -C /tmp
mv /tmp/neuralnetworktrainercli/help/neuralnetworktrainercli.sh /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/help
# set file as executable & reference in path
chmod +x /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/neuralnetworktrainercli.py
ln -s /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/neuralnetworktrainercli.py /usr/local/bin/neuralnetworktrainercli
# remove temporary files
rm -R /tmp/neuralnetworktrainercli*
......@@ -9,3 +9,5 @@ docker cp /home/{SSH_USER_NAME}/shared/configuration/neuralnetworktrainercli/{EN
docker start ymirfrostgiant_{ENV}_console
docker exec -t ymirfrostgiant_{ENV}_console bash -c "bash /tmp/console.sh;rm /tmp/console.sh"
rm /tmp/*.sh
echo "INFO : test commands regarding test.txt"
cat /tmp/test.txt
# in container, as ROOT, check status (start/stop if needed)
neuralNetworkTrainerServiceDaemon status
# in container, as GUEST, call service (same port in every environement)
curl -v http://localhost:5000/neuralnetwork/trainer/perceptron
curl -v http://localhost:80/neuralnetwork/trainer/perceptron
curl -v http://localhost/neuralnetwork/trainer/perceptron
# outside container, call service (adapt port regarding environement : dev=>8001, stg=>8002, prd=>8003)
curl -v http://localhost:#PORT#/neuralnetwork/trainer/perceptron
curl -v http://yggdrasil:#PORT#/neuralnetwork/trainer/perceptron
#######################################
neuralnetworktrainercli --help
neuralnetworktrainercli read perceptron
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