Newer
Older
# Getting started with Ecolyo Agent
This section will allow you to launch a proper local environment for Ecolyo-Agent
!!! info ""
If you are a new developer tasked to work on this project, check the [setup your environment](../../setup_your_environment.md).
##  Repositories
This project is split between a backend and frontend, each project has its own repository.
[Ecolyo-Agent front-end gitlab repository](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/backoffice-client)
[Ecolyo-Agent backend gitlab repository](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/backoffice-server)
## Local usage
To install required node modules, open a terminal on the root folder of the backoffice-client project and type the following command:
Before launching the application, ensure you've properly filled the `.env` file according to the template. If needed please refer to a team member.
In order to launch the project in local with the backend working launch the following command
```bash
yarn local-up
```
This command will launch the app from the _docker-compose.local.yml_ file, which will launch 3 docker images and start the react app with _yarn start_
- The backend Go app, from the image located on its Gitlab repository
- The Nginx server with a local configuration located in nginx/site.conf
To stop it properly use
```bash
yarn local-down
```
This app runs in https, such as the backend, to access it go on https://localhost/
Also make sure you have HTTPS env variable set to true.
Do not use the app with the port 3000, you won't be able to login.
> :warning: **If you are launching the project from a Windows OS** : Make sure to comment the 'extra_hosts' lines in the docker-compose.local file. Otherwise, you you won't be able to access your machine's localhost from the docker container.
In order to get Backend documentation, please refer directly to the [backend readme](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/backoffice-server/-/blob/dev/README.md)
The nginx server redirects https requests from front-end to the backend on port 1443.
- `nginx/site.conf`, used for local development
- `nginx/site.prod.conf`, used for production
The nginx server needs local ssl certificates in order to run an interact with backend, these certificates are present in the project.
To check if the application starts successfully, launch the command
```bash
docker logs backoffice-client_backend_1
```
You should obtain the following messages:
> Token signing key set
> Mock OAuth2 server Listening on: http://localhost:8090
Once the application is started, you can access it here: [localhost](https://localhost)
In order to test the app on alpha you can do the following steps:
- Build locally your docker image for the client and/or the server
docker build . -t registry.forge.grandlyon.com/web-et-numerique/factory/llle_project/backoffice-<server/client>:your-tag
docker push registry.forge.grandlyon.com/web-et-numerique/factory/llle_project/backoffice-<server/client>:your-tag
```
- Connect to alpha in ssh, go to ecolyo-agent > docker-compose.yml and change the image tag for client and/or server
- Then launch the app, it will pull automatically the new images
docker-compose up -d
```
- If you have access denied issue, try to docker login
docker login registry.forge.grandlyon.com/web-et-numerique/factory/llle_project/
- If you want to update alpha using the same image tag with edited image, just pull manually your new image and rebuild the concerned image
docker pull registry.forge.grandlyon.com/web-et-numerique/factory/llle_project/backoffice-<server/client>:your-tag
If you need to work with prices on alpha, you will need to init the prices database.
docker ps
```
- Then get into the container
docker exec -it <container-id> bash
```
- Then execute the mysql script that imports all the prices in DB
mysql --local-infile=1 -uroot -p backoffice < /dbinit/dbinit.sql
```
You will be prompted for the admin password, use the db password set in the .env file.
Now you're ready to edit your prices on alpha !