installation.md 2.85 KB
Newer Older
Sebastian Castro's avatar
Sebastian Castro committed
1
2
3
Installation and Production Instructions
========================================

4
5
*Last update : 2018/06/04*

Sebastian Castro's avatar
Sebastian Castro committed
6
7
Feel free to add some more informations if you solve installation issues !

8
**There is a script for debian installation** named install_debian.sh in this docs directory ! The script is more appropriate for production server installation, but having a look to the script can probably help you for some steps.
Sebastian Castro's avatar
Sebastian Castro committed
9

Sebastian Castro's avatar
Sebastian Castro committed
10
11
12
13
14
15
16
Requirements
------------

1. Php
2. [Composer](https://getcomposer.org/download/) 
3. [Nodejs](https://nodejs.org/en/download/)
4. [Git](https://git-scm.com/)
Sebastian Castro's avatar
Sebastian Castro committed
17
5. Web Server (Apache, Ngninx, [Wamp server](http://www.wampserver.com/) ...)
Sebastian Castro's avatar
Sebastian Castro committed
18
6. MongoDB (http://php.net/manual/fr/mongodb.installation.php)
Sebastian Castro's avatar
Sebastian Castro committed
19

20
The project is using php5. **If you want to use php7**, you will need to install the [MongoPhpAdapter](https://github.com/alcaeus/mongo-php-adapter)
21
22
23
24
25
To do so, please run :
```
composer config "platform.ext-mongo" "1.6.16" && composer require alcaeus/mongo-php-adapter
```

Sebastian Castro's avatar
Sebastian Castro committed
26
27
28
Installation
------------

29
### Cloning repo (clone dev branch)
Sebastian Castro's avatar
Sebastian Castro committed
30
31
```
cd path-to-php-server-folder (default linux /var/www/html, windows c:/wamp/www... )
32
33
git clone https://github.com/pixelhumain/GoGoCarto
cd GoGoCarto/
Sebastian Castro's avatar
Sebastian Castro committed
34
35
36
37
38
```

### Installing dependencies 
Php dependency (symfony, bundles...) 
```
Sebastian Castro's avatar
Sebastian Castro committed
39
composer install
Sebastian Castro's avatar
Sebastian Castro committed
40
```
Sebastian Castro's avatar
Sebastian Castro committed
41
*During installation, config/parameters file will be created, leave default fields*
Sebastian Castro's avatar
Sebastian Castro committed
42
43
44

Workflow dependencies (compiling sass and javascript)
```
Sebastian Castro's avatar
Sebastian Castro committed
45
npm install gulp
Sebastian Castro's avatar
Sebastian Castro committed
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
npm install
```

Start
-----
Dumping assets
```
php bin/console assets:install --symlink web
```

First build of Javascript and Css
```
gulp build
```

Start watching for file change (automatic recompile)
```
gulp watch
```


Generate Database
-----------------

70
71
Go to symfony console : http://localhost/GoGoCarto/web/app_dev.php/_console
Run the followings command
Sebastian Castro's avatar
Sebastian Castro committed
72
```
Sebastian Castro's avatar
Sebastian Castro committed
73
doctrine:mongodb:schema:create
Sebastian Castro's avatar
Sebastian Castro committed
74
75
doctrine:mongodb:generate:hydrators
doctrine:mongodb:generate:proxies
Sebastian Castro's avatar
Sebastian Castro committed
76
doctrine:mongodb:fixtures:load
Sebastian Castro's avatar
Sebastian Castro committed
77
78
```

79
The last command will generate a basic configuration, and two default users : "admin/admin" and "user/user"
Sebastian Castro's avatar
Sebastian Castro committed
80

Sebastian Castro's avatar
Sebastian Castro committed
81
Then generate if necessary random point on the map :
Sebastian Castro's avatar
Sebastian Castro committed
82
app:elements:generate 200
Sebastian Castro's avatar
Sebastian Castro committed
83
84

Everthing is ready, enjoy :
85
http://localhost/GoGoCarto/web/app_dev.php
Sebastian Castro's avatar
Sebastian Castro committed
86
87
88
89

Production
----------

Sebastian Castro's avatar
Sebastian Castro committed
90
91
92
93
94
95
96
97
1. Dump assetic in symfony console to update the web/templates files
```assetic:dump```

2. Generate compressed js and css files
```
gulp build
gulp production
```
Sebastian Castro's avatar
Sebastian Castro committed
98

Sebastian Castro's avatar
Sebastian Castro committed
99
3. enable gz compression in your web server
Sebastian Castro's avatar
Sebastian Castro committed
100

Sebastian Castro's avatar
Sebastian Castro committed
101
4. In the distant console (http://yoursite.com/web/app_dev.php/_console)
Sebastian Castro's avatar
Sebastian Castro committed
102
103
104
```
cache:clear --env=prod
```
105

106
107
108
109
110
111
112
113
114
115
116
5. Make sure that the var folder is writable ```chmod -R 771 var/```



Issues
-------

If you creating an element you ahev the issue "cannot load method bcmod from namespace ..."
You need to install the bc-math module
```
sudo apt install php7.0-bcmath
117
118
119
120
121
```

If memory limits while using composer
```
COMPOSER_MEMORY_LIMIT=-1 composer ...
122
```