|
| 1 | +# INSTALLATION |
| 2 | + |
| 3 | +This project provides two things: a **library that integrates |
| 4 | +the exchangerate.io api for codeigniter** and **a currency conversion rate manager** |
| 5 | +in two flavours: for pc (Web interface) and for devices (androit phones or tables). |
| 6 | + |
| 7 | +It is a client-service philosophy, the server side customer side is |
| 8 | +consumed by the device (phones, tablets) or by the interface (web on pc) as client side. |
| 9 | + |
| 10 | +## Requirements |
| 11 | + |
| 12 | +Note you can just install in same machine both sides of the sistem. |
| 13 | + |
| 14 | +### Hardware requirements |
| 15 | + |
| 16 | +* Server computer: |
| 17 | + * Any computer device capable of any Unix based OS no matter if 32 or 64 bit |
| 18 | + * Internet connection |
| 19 | + * RAM: depends of load, 1G for mostly local intranet with 500 users |
| 20 | +* Client device |
| 21 | + * PC (any that supports browsing) or Phone (androit for apk app, Iphone must use browser) |
| 22 | + * Internet connection |
| 23 | + |
| 24 | +### Software requirements |
| 25 | + |
| 26 | +* Server computer: |
| 27 | + * OS: |
| 28 | + * Debian: 6.0+ with venenux repos enabled |
| 29 | + * Alpine: 3.10+ |
| 30 | + * VenenuX: 0.9 or 9.0+ (Debian based) |
| 31 | + * Devuan: 1.0+ |
| 32 | + * DBMS: |
| 33 | + * Sqlite 3.0+ |
| 34 | + * PercodaDB (mariadb or mysql should work but yo will be by your own) |
| 35 | + * PostsgreSQL 8.0+ |
| 36 | + * ODBC (any odbc valid that supports aliasing in queries and transactions) |
| 37 | + * PHP: 5.6+ |
| 38 | + * cURL |
| 39 | + * JSON |
| 40 | + * sqlite/mysql/odbc/psql (based on the selected DBMS) |
| 41 | + * WEBSERVER |
| 42 | + * lighttpd 1.4.32+ |
| 43 | + * for any other you are on your own but will just work |
| 44 | + * wget |
| 45 | + * gzip |
| 46 | + * coreutils or busybox |
| 47 | + |
| 48 | +## Instalacion deploy |
| 49 | + |
| 50 | +We will use Debian 9 as example, but will just work for older or newer if |
| 51 | +you added VenenuX repositories |
| 52 | + |
| 53 | +First of all you need a valid OS as described before, later must setup common |
| 54 | +programs, later setup the database and finally tune up the webserver for instance. |
| 55 | + |
| 56 | +#### Use case install with debian 9 and mysql |
| 57 | + |
| 58 | +**1 - Instalatino of software** this will assume you already setup VenenuX repositories. |
| 59 | + |
| 60 | + |
| 61 | +``` |
| 62 | +apt-get install git lighttpd mysql-server php7.3-cgi php7.3-gd php7.3-mysql php7.3-mcryp php7.3-curl php7.3-odbc lighttpd lighttpd-mod-openssl |
| 63 | +``` |
| 64 | + |
| 65 | +**2 - preparation of the place** |
| 66 | + |
| 67 | +``` |
| 68 | +mkdir -p /home/intranet/elcurrency |
| 69 | +
|
| 70 | +wget -t0 -O elcurrency.tar.gz https://gitlab.com/codeigniterpower/codeigniter-currencylib/-/archive/main/codeigniter-currencylib-main.tar.gz |
| 71 | +
|
| 72 | +mysql -u root -p -e "CREATE USER 'sysdbuser'@'localhost' IDENTIFIED BY 'sysdbuser.1';" |
| 73 | +
|
| 74 | +nano /home/intranet/elsistema/elcurrency/elcurrencyweb/config/database.php |
| 75 | +
|
| 76 | +mysql -u root -p -D elcurrencydb -e "CREATE DATABASE elcurrencydb;" |
| 77 | +
|
| 78 | +mysql -u root -p -D elcurrencydb -e "GRANT ALL PRIVILEGES ON elcurrency% . * TO 'sysdbuser'@'localhost';" |
| 79 | +
|
| 80 | +mysql -u sysdbuser -p -D elcurrencydb < /home/intranet/elsistema/elcurrency/elcurrencydb/elcurrencydb.sql |
| 81 | +
|
| 82 | +ln -s /home/intranet/elsistema/elcurrency/elcurrencyfiles/99-elcurrency.conf /etc/lighttpd/conf-available/99-elcurrency.conf |
| 83 | +
|
| 84 | +lighty-enable-mod alias elcurrency;/etc/init.d/lighttpd restart |
| 85 | +``` |
| 86 | + |
| 87 | +Next use http://localhost/elcurrency to check |
| 88 | + |
| 89 | +## Develoment deploy |
| 90 | + |
| 91 | +We only used Debian as main OS for development and Geany as oficial editor. |
| 92 | + |
| 93 | +### 1 requirements |
| 94 | + |
| 95 | +For hardware we recommended as minimal: |
| 96 | + |
| 97 | +* CPU: any x86 based no matter if 32bit or 64bit |
| 98 | +* RAM: 4G+ |
| 99 | + |
| 100 | +For software we need apart of Debian based system: |
| 101 | + |
| 102 | +* Debian (minimal as Debian 7 based but not Debian 10 or testing) |
| 103 | +* git (manejador de repositorio y proyecto) `apt-get install git git-core giggle` |
| 104 | +* mysql (manejador y servidor DB que hara de pivote) `apt-get install mysql-client mysql-server` |
| 105 | +* odbc, myodbc, freetds (coneccion DB mysql, ODBC para sybase y mssql) `apt-get install libmyodbc tdsodbc` |
| 106 | +* geany (editor para manejo php asi como ver el preview) `apt-get install geany geany-plugin-webhelper` |
| 107 | +* lighttpd/apache2 (webserver localmente para trabajar el webview) `apt-get install lighttpd` |
| 108 | +* php (interprete) en debians o devuans `apt-get install php-cgi php-mysql php-odbc php-sqlite php-gd php-mcrypt php-curl` |
| 109 | +* curl (invocar urls) `apt-get install curl` |
| 110 | + |
| 111 | +Database management are made by usage or MysqlWorkbench, so you must use `apt-get install mysql-workbench` |
| 112 | +that will be only valid for Debian 6, Debian 7, Debian 8, Debian 9 and Debian 12, or any Debian based on those. |
| 113 | + |
| 114 | +### 2 Configure environment |
| 115 | + |
| 116 | +``` |
| 117 | +git config --global status.submoduleSummary true |
| 118 | +git config --global diff.submodule log |
| 119 | +git config --global fetch.recurseSubmodules on-demand |
| 120 | +git config --global user.email apellido_nombre@intranet1.net.ve |
| 121 | +git config --global http.postBuffer 524288000 |
| 122 | +
|
| 123 | +ln -s ~/Devel ~/public_html |
| 124 | +
|
| 125 | +chown -R general:www-data /home/general/Devel |
| 126 | +find /home/general/Devel/ -type f -exec chmod 664 {} ";" |
| 127 | +find /home/general/Devel/ -type d -exec chmod 775 {} ";" |
| 128 | +
|
| 129 | +apt-get install mariadb-server mariadb-client mysqlworkbench lighttpd \ |
| 130 | + php-fpm php-cgi php-gd php-mysql apt-get install geany geany-addons |
| 131 | +
|
| 132 | +lighty-enable-mod accesslog cgi dir-listing fastcgi proxy status userdir usertrack php-fastcgi |
| 133 | +
|
| 134 | +/usr/sbin/service lighttpd restart |
| 135 | +
|
| 136 | +ln -s /home/general/Devel /var/www/Devel |
| 137 | +ln -s /home/general/Devel /var/www/html/Devel |
| 138 | +
|
| 139 | +exit |
| 140 | +``` |
| 141 | + |
| 142 | +### 3 clone the sources |
| 143 | + |
| 144 | + |
| 145 | +``` |
| 146 | +mkdir -p ~/Devel |
| 147 | +cd Devel |
| 148 | +git clone --recursive http://tijerazo.net/elgit/tijerazo/elcurrency.git |
| 149 | +cd elcurrency |
| 150 | +git pull |
| 151 | +git submodule init |
| 152 | +git submodule update --rebase |
| 153 | +git submodule foreach git checkout master |
| 154 | +git submodule foreach git pull |
| 155 | +``` |
| 156 | + |
| 157 | +### 5 Inicialize DBMS |
| 158 | + |
| 159 | + |
| 160 | +``` bash |
| 161 | +su |
| 162 | +mysql -u root -p -e 'CREATE SCHEMA elcurrencydb'` |
| 163 | +mysql -u root -p elcurrencydb < elcurrencydb/elcurrencydb.sql |
| 164 | +``` |
| 165 | + |
| 166 | +Example usage |
| 167 | + |
| 168 | + |
| 169 | +``` php |
| 170 | + $dbmy = $this->load->database('elcurrencydb', TRUE); |
| 171 | + $driverconected = $dbmy->initialize(); |
| 172 | + if($driverconected != TRUE) |
| 173 | + return FALSE; |
| 174 | + $queryprovprod = $dbmy->query("SELECT * FROM tabla"); |
| 175 | + $arreglo_reporte = $queryprovprod->result_array(); |
| 176 | +``` |
| 177 | + |
0 commit comments