installation.md 2.82 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
39
40
```

### Installing dependencies 
Php dependency (symfony, bundles...) 
```
php path-to/composer.phar install or composer install
```
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
70
npm install -g gulp
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
-----------------

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

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

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

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

Production
----------

Sebastian Castro's avatar
Sebastian Castro committed
91
92
93
94
95
96
97
98
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
99

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

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

107
108
109
110
111
112
113
114
115
116
117
118
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
```