Commit 9ace4e1f authored by Marcello Pivanti's avatar Marcello Pivanti
Browse files

Added README

parent b6bcd24d
# AMOS Basic Template
`by EliteDivision`
This is a skeleton based on [Yii 2 Template](http://www.yiiframework.com/)
The template includes three tiers: front end, back end, and console, each of which is a separate Yii application.
The template is designed to work in a team development environment. It supports deploying the application in different environments.
## Platform requirements
### Hardware
#### Minimum
- STORAGE 200 GB.
- RAM 8GB
- CPU 4 Core
#### Recommended
- STORAGE 500 GB.
- RAM 16GB
- CPU 8 Core
### Software
- Debian >= 8, CentOS >= 7
- Apache >= 2.4.29
- Php 7.0.X
- MariaDB 10.2.X / MySQL 5.7.X
- [Composer Dependency Manager](https://www.yiiframework.com/doc/guide/2.0/en/start-installation#installing-composer)
#### Required Apache/Lighttpd extensions
access_compat, alias, auth, autoindex, deflate, dir, env, filter, mime, mpm_prefork, negotiation, php7.0, reqtimeout, rewrite, setenvif, status
#### Required PHP extensions
apc, bcmath, ctype, curl, dom, exif, fileinfo, ftp, gd, gettext, iconv, imagick, intl, json, mbstring, mcrypt, mysqli, opcache, pdo, pdo_mysql, posix, soap, ssl, xml, xsl, zip
#### Required MySQL Options
In file `my.ini` in Windows or `my.cnf` in Linux, from the clause **sql-mode** *remove* options `STRICT_TRANS_TABLES`and `ONLY_FULL_GROUP_BY`
to set it as follows
```
[mysql]
sql_mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
```
## DIRECTORY STRUCTURE
```
common
config/ contains shared configurations
mail/ contains view files for e-mails
models/ contains model classes used in both backend and frontend
console
config/ contains console configurations
controllers/ contains console controllers (commands)
migrations/ contains database migrations
models/ contains console-specific model classes
runtime/ contains files generated during runtime
backend
assets/ contains application assets such as JavaScript and CSS
config/ contains backend configurations
controllers/ contains Web controller classes
models/ contains backend-specific model classes
runtime/ contains files generated during runtime
views/ contains view files for the Web application
web/ contains the entry script and Web resources
frontend
assets/ contains application assets such as JavaScript and CSS
config/ contains frontend configurations
controllers/ contains Web controller classes
models/ contains frontend-specific model classes
runtime/ contains files generated during runtime
views/ contains view files for the Web application
web/ contains the entry script and Web resources
widgets/ contains frontend widgets
vendor/ contains dependent 3rd-party packages
environments/ contains environment-based overrides
tests contains various tests for the advanced application
codeception/ contains tests developed with Codeception PHP Testing Framework
```
## Platform configuration/initialization
Please select the environment you want to configure the platform with, follows the default
- Development
- Production
Nowadays main differences between default environments are:
|Feature | Developments | Production |
|-|-|-|
| [Gii](https://www.yiiframework.com/doc/guide/2.0/en/start-gii) | Enabled | Not Enabled |
| [Debug](https://www.yiiframework.com/extension/yiisoft/yii2-debug/doc/guide/2.0/en/installation) | Enabled | Not Enabled |
| [Cache](https://www.yiiframework.com/doc/guide/2.0/en/caching-data) | [Dummycache](https://www.yiiframework.com/doc/api/2.0/yii-caching-dummycache) | [File cache](https://www.yiiframework.com/doc/api/2.0/yii-caching-filecache)|
| [Mailer](https://www.yiiframework.com/doc/guide/2.0/en/tutorial-mailing) | [Mail to file](https://www.yiiframework.com/doc/api/2.0/yii-mail-basemailer#$useFileTransport-detail) | Send mail |
Default environments can be copied or modified as needed.
Each new environment needs an entry into file "*environments/index.php*" to allow the init system to use it, and should be as follows
```
'ENVIRONMENT_NAME_HERE' => [
'path' => 'ENVIRONMENT_DIRECTORY_HERE',
'setWritable' => [
'backend/runtime',
'backend/web/assets',
'common/uploads',
'common/uploads/store',
'common/uploads/temp',
'frontend/runtime',
'frontend/web/assets',
],
'setExecutable' => [
'yii',
'tests/codeception/bin/yii',
],
'setCookieValidationKey' => [
'backend/config/main-local.php',
'frontend/config/main-local.php',
],
],
```
Please substitute the placeholders `ENVIRONMENT_NAME_HERE`, `ENVIRONMENT_DIRECTORY_HERE` with proper strings.
### Database
Before to install the platform, please create the database that will be layed at the base of it, e.g.
```
# mysql -u DB_USERNAME_HERE -pDB_PASSWORD_HERE -e "CREATE DATABASE
\`DB_NAME_HERE\` COLLATE 'utf8_general_ci';"
```
Then configure the [database connection](https://www.yiiframework.com/doc/guide/2.0/en/start-databases) into file "*environments/ENVIRONMENT_DIRECTORY_HERE/common/config/main-local.php*" as follows
```
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=DB_NAME_HERE',
'username' => 'DB_USERNAME_HERE',
'password' => 'DB_PASSWORD_HERE',
'charset' => 'utf8',
],
]
```
Obviuosly into the file path put the directory where your selected environments is (prod, test, dev, demo, new1, etc.)
and substitute the placeholders `DB_NAME_HERE`, `DB_USERNAME_HERE`, `DB_PASSWORD_HERE` with proper strings.
### Environment initialization
Once the environment to be used is properly configured, run the following command to apply configurations to platform
```
# php init
```
### Packages depandency management
Run the following command to download all the required packages
```
# composer update
```
### Database migration
Run the following command to create tables and views into database, and fill it up with basic data
```
# php yii migrate
```
### Start up account
After installation, the only accout available into the platform is an administrative account having
`username`: demo
`password`: Demo123!
Please change it after first login.
......@@ -21,7 +21,7 @@ return [
'enableSchemaCache' => true,
'schemaCacheDuration' => 88000,
'schemaCache' => 'schemaCache',
'attributes'=>[
'attributes' => [
PDO::ATTR_PERSISTENT => true
]
],
......
......@@ -19,7 +19,7 @@ return [
'enabled' => true, //Enable the assistance button
'type' => 'url', //Assistance button mode: url or email
'email' => 'ADD_HERE_EMAIL_ASSISTENZA_1', //Assistance mail
'url' => 'ADD_HERE_ASSISTANCE_URL' //Url to the assistance page
'url' => '/ticket/assistenza/cerca-faq' //Url to the assistance page
],
'user.passwordResetTokenExpire' => 604800,
'google_places_api_key' => 'ADD_HERE_GOOGLE_PLACES_KEY',
......
......@@ -15,7 +15,7 @@ return [
'forceCopy' => false,
'hashCallback' => function ($path) {
return hash('md4', $path);
},
},
'converter' => [
'class' => 'cakebake\lessphp\AssetConverter',
'compress' => true,
......@@ -38,7 +38,7 @@ return [
'translateCache' => [
'class' => 'yii\caching\FileCache',
'cachePath' => '@runtime/translateCache'
],
],
'schemaCache' => [
'class' => 'yii\caching\FileCache',
'cachePath' => '@runtime/schemaCache'
......@@ -89,4 +89,4 @@ return [
'<module:[\w-]+>/<controller:[\w-]+>/<action:[\w-]+>/<id:\d+>] => <module>/<controller>/<action>',
),
],
];
\ No newline at end of file
];
......@@ -29,8 +29,8 @@ return [
'logo' => '/img/EROI_acronimo.png',
'favicon' => 'aster-favicon.ico',
'platform' => [
'frontendUrl' => 'ADD_HERE_FRONTEND_URL',
'backendUrl' => 'ADD_HERE_BACKEND_URL',
'frontendUrl' => 'ADD_HERE_FULLY_QUALIFIED_DOMAIN_FRONTEND',
'backendUrl' => 'ADD_HERE_FULLY_QUALIFIED_DOMAIN_BACKEND',
],
'footerText' => TRUE,
'disableBulletCounters' => true,
......
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