## Installation for development or testing purpose only

⚠️ Use this method for development only. ⚠️

You will need:

- [Composer ](https://getcomposer.org);
- [Symfony-cli tool ](https://symfony.com/download);
- [docker ](https://docs.docker.com/engine/install/) and [docker-compose ](https://docs.docker.com/compose/)
- node > 20 and yarn 1.22

### First initialization

1. clone the repository and move to the cloned directory:

    ```bash
    git clone https://gitlab.com/Chill-Projet/chill-bundles.git
    cd chill-bundles
    ```

2. install dependencies using composer

    ```bash
    composer install
    ```

3. Install and compile assets:

    ```bash
    yarn install
    yarn run encore production
    ```

    **note** double-check that you have the node version > 20 using the `node --version` command.

4. Configure your project: create a `.env.local` file at the root, and add the admin password:

    **note** for this installation mode, the environment should always be "dev"
    ```
    APP_ENV=dev
    ADMIN_PASSWORD=\$2y\$13\$iyvJLuT4YEa6iWXyQV4/N.hNHpNG8kXlYDkkt5MkYy4FXcSwYAwmm
    ```
    **note**: if you copy-paste the line above, the password will be "admin".

5. Start the stack using `docker compose up -d`, check the status of the start with `docker compose ps`

6. Configure all the necessary third-party tools. On the first start, it may last a bit longer. You can always check with `docker compose ps`

    ```bash
    # Run migrations
    symfony console doctrine:migrations:migrate

    # Setup messenger
    symfony console messenger:setup-transports

    # Prepare some views
    symfony console chill:db:sync-views

    # Generate jwt token, required for some api features (webdav access, ...)
    symfony console lexik:jwt:generate-keypair
    ```

7. Add some fixtures

    This will truncate all the existing data of the database. But remember,
    we are in dev mode!

    ```bash
    symfony console doctrine:fixtures:load
    ```

8. launch symfony dev-server

    ```bash
    symfony server:start -d
    ```

And visit the web page it suggests. You can log in with user
`center a_social` and password `password`, or login `admin` with
the password you set.

### Stopping the server

   `symfony server:stop`

### Restart the webserver for a later start

   `symfony server:start -d`
   # this will automatically start the full docker compose services
