[42bd667] | 1 | #/bin/bash |
---|
| 2 | |
---|
| 3 | read -p "Insert installer path [$(cd ../../../; pwd)/deploy]: " DST_PATH |
---|
| 4 | DST_PATH=${DST_PATH:-$(cd ../../../; pwd)/deploy} |
---|
| 5 | |
---|
| 6 | read -p "Insert source path [$PWD]: " SRC_PATH |
---|
| 7 | SRC_PATH=${SRC_PATH:-$PWD} |
---|
| 8 | |
---|
| 9 | ################# |
---|
| 10 | # |
---|
| 11 | # Minify js code |
---|
| 12 | # |
---|
| 13 | ################# |
---|
| 14 | |
---|
| 15 | minify -r --type=js $SRC_PATH/static/js/rlabs > $SRC_PATH/static/js/rlabs-min.js |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | ########################### |
---|
| 19 | # |
---|
| 20 | # Create package rlabs code |
---|
| 21 | # |
---|
| 22 | ########################### |
---|
| 23 | |
---|
| 24 | cd $DST_PATH/rlabs_installer/packages |
---|
| 25 | tar xf web2py_rlabs.tar.gz |
---|
| 26 | |
---|
| 27 | DST_RLABS="$DST_PATH/rlabs_installer/packages/web2py_rlabs/applications/rlabs/" |
---|
| 28 | DST_RLABS_DOCKER="$DST_PATH/rlabs-docker/web2py-rlabs/applications/rlabs/" |
---|
| 29 | |
---|
| 30 | ################################## |
---|
| 31 | # Clean template folder docker |
---|
| 32 | ################################## |
---|
| 33 | |
---|
| 34 | rm -fR $DST_RLABS_DOCKER/databases/* |
---|
| 35 | rm -fR $DST_RLABS_DOCKER/controllers/* |
---|
| 36 | rm -fR $DST_RLABS_DOCKER/languages/* |
---|
| 37 | rm -fR $DST_RLABS_DOCKER/models/* |
---|
| 38 | rm -fR $DST_RLABS_DOCKER/modules/* |
---|
| 39 | rm -fR $DST_RLABS_DOCKER/static/* |
---|
| 40 | rm -fR $DST_RLABS_DOCKER/views/* |
---|
| 41 | rm -fR $DST_RLABS_DOCKER/sessions/* |
---|
| 42 | rm -fR $DST_RLABS_DOCKER/*.log |
---|
| 43 | rm -fR $DST_RLABS_DOCKER/errors/* |
---|
| 44 | |
---|
| 45 | ################################## |
---|
| 46 | # Clean template folder |
---|
| 47 | ################################## |
---|
| 48 | |
---|
| 49 | rm -fR $DST_RLABS/databases/* |
---|
| 50 | rm -fR $DST_RLABS/private/* |
---|
| 51 | rm -fR $DST_RLABS/controllers/* |
---|
| 52 | rm -fR $DST_RLABS/languages/* |
---|
| 53 | rm -fR $DST_RLABS/models/* |
---|
| 54 | rm -fR $DST_RLABS/modules/* |
---|
| 55 | rm -fR $DST_RLABS/static/* |
---|
| 56 | rm -fR $DST_RLABS/views/* |
---|
| 57 | rm -fR $DST_RLABS/sessions/* |
---|
| 58 | rm -fR $DST_RLABS/*.log |
---|
| 59 | rm -fR $DST_RLABS/errors/* |
---|
| 60 | |
---|
| 61 | ############################### |
---|
| 62 | # Updade code docker |
---|
| 63 | ############################### |
---|
| 64 | |
---|
| 65 | cp -aR -f $SRC_PATH/controllers $DST_RLABS_DOCKER |
---|
| 66 | cp -aR -f $SRC_PATH/languages $DST_RLABS_DOCKER |
---|
| 67 | cp -aR -f $SRC_PATH/models $DST_RLABS_DOCKER |
---|
| 68 | cp -aR -f $SRC_PATH/modules $DST_RLABS_DOCKER |
---|
| 69 | cp -aR -f $SRC_PATH/static $DST_RLABS_DOCKER |
---|
| 70 | cp -aR -f $SRC_PATH/views $DST_RLABS_DOCKER |
---|
| 71 | cp -aR -f $SRC_PATH/scripts $DST_RLABS_DOCKER |
---|
| 72 | |
---|
| 73 | ############################### |
---|
| 74 | # Updade code |
---|
| 75 | ############################### |
---|
| 76 | |
---|
| 77 | cp -aR -f $SRC_PATH/private $DST_RLABS |
---|
| 78 | cp -aR -f $SRC_PATH/controllers $DST_RLABS |
---|
| 79 | cp -aR -f $SRC_PATH/languages $DST_RLABS |
---|
| 80 | cp -aR -f $SRC_PATH/models $DST_RLABS |
---|
| 81 | cp -aR -f $SRC_PATH/modules $DST_RLABS |
---|
| 82 | cp -aR -f $SRC_PATH/static $DST_RLABS |
---|
| 83 | cp -aR -f $SRC_PATH/views $DST_RLABS |
---|
| 84 | cp -aR -f $SRC_PATH/scripts $DST_RLABS |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | cd $DST_PATH/rlabs_installer/packages |
---|
| 89 | |
---|
| 90 | mv web2py_rlabs.tar.gz web2py_rlabs.backup.tar.gz |
---|
| 91 | tar -czvf web2py_rlabs.tar.gz web2py_rlabs/ && rm -f web2py_rlabs.backup.tar.gz |
---|
| 92 | rm -fr web2py_rlabs |
---|
| 93 | |
---|
| 94 | ########################### |
---|
| 95 | # |
---|
| 96 | # Get posgresql db schema |
---|
| 97 | # |
---|
| 98 | ########################### |
---|
| 99 | |
---|
[f03481a] | 100 | #sudo -u postgres pg_dump -s openrlabs > openrlabs.sql |
---|
| 101 | pg_dump -U openrlabs -h 127.0.0.1 -p 5432 -s openrlabs > openrlabs.sql |
---|
[335213f] | 102 | cp openrlabs.sql $DST_PATH/rlabs-docker/postgres/ |
---|
[42bd667] | 103 | |
---|
| 104 | ############################## |
---|
| 105 | # |
---|
| 106 | # Create package web2py_source code |
---|
| 107 | # |
---|
| 108 | ############################## |
---|
| 109 | |
---|
| 110 | cd $DST_PATH |
---|
| 111 | cd ../web2py_source/ |
---|
| 112 | git checkout v2.19.1 |
---|
| 113 | cd ../ |
---|
| 114 | tar -czvf web2py_source.tar.gz web2py_source/ |
---|
| 115 | mv web2py_source.tar.gz $DST_PATH/rlabs_installer/packages |
---|
| 116 | |
---|
| 117 | ########################### |
---|
| 118 | # |
---|
| 119 | # Packing installer |
---|
| 120 | # |
---|
| 121 | ########################### |
---|
| 122 | |
---|
| 123 | cd $DST_PATH/ |
---|
| 124 | |
---|
| 125 | current_time=$(date "+%Y%m%d%H") |
---|
| 126 | tar -czvf rlabs_installer.$current_time.tar.gz rlabs_installer/ |
---|
| 127 | tar -czpf rlabs_docker.$current_time.tar.gz rlabs-docker/ |
---|
| 128 | |
---|