Unverified Commit 7f0f7667 authored by Sebastian Castro's avatar Sebastian Castro
Browse files

Improve documentation

parent 2eceef4e
......@@ -22,7 +22,8 @@ CSRF_PROTECTION=false # active csrf protection on production servers
###< symfony/framework-bundle ###
###> doctrine/mongodb-odm-bundle ###
MONGODB_URL=mongodb://mongo:27017
MONGODB_URL=mongodb://mongo:27017
# If you don't use docker : MONGODB_URL=mongodb://localhost:27017
DATABASE_NAME=gogocarto_default
###< doctrine/mongodb-odm-bundle ###
......
......@@ -41,10 +41,7 @@ Stack
Symfony4, MongoDB, Typescript
Documentation
Installation
-------------
- [Installation intructions](docs/installation.md)
- [Project structure](docs/project-structure.md)
- [Coding conventions](docs/coding-conventions.md)
- [How to contribute](docs/contributing.md)
[Installation intructions](docs/installation.md)
Coding Conventions
==================
Naming Convention
-----------------
PHP
- Folder: UperCamelCase
- Classes: UpperCamelCase
HTML (Twig templates), JavaScript/TypeScript and CSS
- Folder: dashed-case
- Filenames: dashed-case
JavaScript
- Classes: UpperCamelCase
- functionName: lowerCamelCase
- variables: lowerCamelCase
HTML/CSS
- Classes-and-ids: dashed-case
PHP
---
To fix code style in PHP, run:
```shell
make cs-fix
```
JavaScript
----------
### Curly Bracket
Line return after functionName and parameters:
```
myFunction(myParameter)
{
// stuffs
}
```
Or inline function declaration `function() { return foo; }`
### Code Indentation
Always use 3 spaces for indentation of code blocks.
### Spaces Around Operators
Always put spaces around operators ( = + - * / ), and after commas:
```
const x = y + z;
const values = ["Volvo", "Saab", "Fiat"];
```
Contributing
============
Always create a branch for your specific purpose (example: "feature-share", or relative to particular issue: "issue-#456-bug-in-geocoder")
When you're done with your work, create a merge request and wait for the validation by the administrator.
Please comment as possible your work!
......@@ -289,16 +289,4 @@ server {
ln -nsf /etc/nginx/sites-available/${WEB_URL} /etc/nginx/sites-enabled/${WEB_URL}
nginx -t && service nginx restart
# TODO add crontab automatically
# for Normal instance
# @daily php $WEB_DIR/GoGoCarto/bin/console --env=prod app:elements:checkvote
# @hourly php $WEB_DIR/GoGoCarto/bin/console --env=prod app:users:sendNewsletter
# @hourly php $WEB_DIR/GoGoCarto/bin/console --env=prod app:webhooks:post
# @daily php $WEB_DIR/GoGoCarto/bin/console --env=prod app:elements:checkExternalSourceToUpdate
# for SAAS instance
# * * * * * php $WEB_DIR/GoGoCarto/bin/console --env=prod app:main-command
# @daily php $WEB_DIR/GoGoCarto/bin/console --env=prod app:saas:update-projects-info
# @daily php $WEB_DIR/GoGoCarto/bin/console --env=prod app:projects:check-for-deleting
# * * * * * cd /var/www/gogocarto && sh bin/execute_custom_domain.sh
\ No newline at end of file
# TODO add crontab automatically
\ No newline at end of file
......@@ -3,27 +3,39 @@ Installation and Production Instructions
Feel free to add some more information if you solve installation issues!
Quick Install
-------------
Installation with Docker
------------
With the Docker installation, you have all the required softwares installed in two containers (`gogocarto` and `mongo`).
* Run `make build` to build the container images.
* Run `make up` to launch the containers.
* Enter the `gogocarto` container with this command: `make shell` or `docker exec -it gogocarto bash` (you can execute this one anywhere)
* Run `make init` from within the `gogocarto` container. This will launch all the required commands to finish the installation.
- **Debian script**: there is a script for Debian installation named `install_debian.sh` in this docs directory! After installation, go to `http://localhost/GoGoCarto/web/project/initialize` to initialize your project.
* Go to `http://localhost:3008/index.php/project/initialize` to initialize the project.
- **Docker containers**: please follow the instructions [here](installation_docker.md).
### Local docker-compose
Manual Install: Requirements
If you have a specific environment, need for custom env vars, want to avoid exposing ports, etc, you can create a copy of `docker/docker-compose.yml` named `docker/docker-compose.local.yml` (it will be gitignored).
Manual Install
------------
Main requirements are :
1. PHP 7.4
2. [Composer](https://getcomposer.org/download/)
3. [Nodejs](https://nodejs.org/en/download/)
4. [Git](https://git-scm.com/)
5. Web Server (Apache, Nginx, [Wamp server](http://www.wampserver.com/) ...)
6. MongoDB (http://php.net/manual/fr/mongodb.installation.php) -> !!Version 3.4 or below!!!
5. Web Server (Apache, Nginx)
6. [MongoDB](http://php.net/manual/fr/mongodb.installation.php)
Consider the [Docker installation](installation_docker.md) if you run into troubles installing these softwares.
Installation
------------
Please refer to the dockerfile to know all dependencies : [DockerFile](../docker/server/Dockerfile)
### Cloning Repository
......@@ -45,26 +57,48 @@ Execute the command:
make init
```
It will:
- install the dependencies
- install and build the assets
- load the fixtures
Now initialize your project with the following route:
`http://localhost/GoGoCarto/web/project/initialize`
`http://localhost/GoGoCarto/web/index.php/project/initialize`
Start
-----
SAAS Mode (Software As A Service)
--------------------------
Instead of having a single GoGoCarto instance, you can transform your site in a "farm" by turning env variable USE_AS_SAAS to true
For Development
--------------
Start watching for file changes (automatic recompilation):
```shell
gulp watch
make watch
```
For Production
--------------
### Cron Tabs
Here are the following cron tab you need to configure
```shell
# for a Normal instance
@daily php GOGOCARTO_DIR/bin/console --env=prod app:elements:checkvote
@hourly php GOGOCARTO_DIR/bin/console --env=prod app:users:sendNewsletter
@hourly php GOGOCARTO_DIR/bin/console --env=prod app:webhooks:post
@daily php GOGOCARTO_DIR/bin/console --env=prod app:elements:checkExternalSourceToUpdate
```
```shell
# for a SAAS instance
* * * * * php GOGOCARTO_DIR/bin/console --env=prod app:main-command
@daily php GOGOCARTO_DIR/bin/console --env=prod app:saas:update-projects-info
@daily php GOGOCARTO_DIR/bin/console --env=prod app:projects:check-for-deleting
* * * * * cd GOGOCARTO_DIR && sh bin/execute_custom_domain.sh
```
Updating your Production Install
---------------------
### Updating GoGoCarto
Each time you want to update GoGoCarto, run:
......@@ -72,11 +106,11 @@ Each time you want to update GoGoCarto, run:
make gogo-update
```
You can have a look to [the CHANGELOG](../CHANGELOG.md) to know what are the new features.
You can have a look to [the CHANGELOG](../CHANGELOG.md) to know what are the new features and breaking changes.
Issues
------
--------------
If memory limits while using Composer:
......
Installation under Docker
=========================
With the Docker installation, you have all the required softwares installed in two containers (`gogocarto` and `mongo`).
* Run `make build` to build the container images.
* Run `make up` to launch the containers.
* Enter the `gogocarto` container with this command: `make shell` or `docker exec -it gogocarto bash` (you can execute this one anywhere)
* Run `make init` from within the `gogocarto` container. This will launch all the required commands to finish the installation.
* Go to `http://localhost:3008/project/initialize` to initialize the project.
### Local docker-compose
If you have a specific environment, need for custom env vars, want to avoid exposing ports, etc, you can create a copy of `docker/docker-compose.yml` named `docker/docker-compose.local.yml` (it will be gitignored).
Project Structure
=================
The project is currently organized in two bundles :
- CoreBundle : home page, basic back office (configure credits, home page info etc...)
- GeoDirectoryBundle : The Directory itself, including the client side and back office app. We're planning to make this bundle reusable, so be sure to put all things directly linked to the directory in this bundle.
In each bundle :
- Javascript/TypeScript sources `Resources/js`
- SCSS sources `Resources/scss`
- Javascript compiled folder `web/js`
- CSS compiled folder `web/assets/css`
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