Skip to content
Snippets Groups Projects
environments.md 4.02 KiB
Newer Older
# Environments

We have 2 environments available for this project:
Bastien DUMONT's avatar
Bastien DUMONT committed

Bastien DUMONT's avatar
Bastien DUMONT committed
- A **prod** environment hosted on Cozy and managed by Cozy
- A **dev** environment hosted on scaleway and managed by the dev team

## Dev environment aka alpha

You need to install an ssh tool like Putty or [MobaXterm](https://mobaxterm.mobatek.net/download.html) in order to connect to the server.
Connection to the server is made using ssh key, you need to generate your own and ask administrator to allow your ssh key.
Hugo NOUTS's avatar
Hugo NOUTS committed
Once done, you should be able to connect to the server using your private key.
Bastien DUMONT's avatar
Bastien DUMONT committed
### CouchDB from Alpha
Bastien DUMONT's avatar
Bastien DUMONT committed

Bastien DUMONT's avatar
Bastien DUMONT committed
To connect to the database from your local computer, you need to create an SSH tunnel and forward ports to your local machine :
Bastien DUMONT's avatar
Bastien DUMONT committed

```console
ssh root@51.158.104.84 -L 8082:localhost:5984
```
Bastien DUMONT's avatar
Bastien DUMONT committed

Bastien DUMONT's avatar
Bastien DUMONT committed
Then you can browse to [http://localhost:8082/\_utils/](http://localhost:8082/_utils/) and enter the credentials specified in the file `easy-cozy/docker-compose.yml`

#### Access data from an instance

The DB contains tables for each instance. They all are prefixed with a hash. To see instances hashes, search for `global/instances` you will find documents containing `domains` & `prefix`.

The **prefix** will allow you to search for specific tables among the instances.

:::note Example

`cozyc5eac7b18cb26075ac6aa8233748dfd2/com-grandlyon-ecolyo-profile`

:::
Bastien DUMONT's avatar
Bastien DUMONT committed
It is based on the easy-cozy project available on [Gitlab](https://forge.grandlyon.com/pocs/cozy/easy-cozy)

On the server, the .env file has been initialize with the good secrets (see the .env.template) and also initialize to create instance with Ecolyo and the 3 needed konnectors by default.

Bastien DUMONT's avatar
Bastien DUMONT committed
This project will build and run 3 images:

- the cozy stack
- the couch db
Hugo NOUTS's avatar
Hugo NOUTS committed
- keycloak
Hugo NOUTS's avatar
Hugo NOUTS committed
To run the project please refer to the documentation on the Gitlab project.
Once the project is up and running, we are able to create, update and delete instances.
Let's see more details in the [dedicated section](/docs/easycozy/scripts.md).
Konnector for Ecolyo need proxy for the Oauth dance. The proxy is also mounted on the same instance as the Cozy stack and based on the project available on Gitlab: https://forge.grandlyon.com/pocs/cozy/cozy-oauth-proxy
Bastien DUMONT's avatar
Bastien DUMONT committed
The proxy is written in Go language. The "main.go" file contains all the source code and also the default variables.
Default variables are the one used for the dev environment but we will overwrite them for the production.

To Launch the proxy, just pull the project and use the docker-compose file with following commands:
Bastien DUMONT's avatar
Bastien DUMONT committed

```sh
git pull https://forge.grandlyon.com/pocs/cozy/cozy-oauth-proxy
cd cozy-oauth-proxy
docker-compose up -d
```

### Ecolyo and konnectors

By default the version present on the "build-dev" branch is used to install Ecolyo app and konnectors on a new instance.

Some scripts has been created in order to install, update, downgrade, remove app and konnectors. Please refer to the [dedicated section](/docs/easycozy/scripts.md) for more information.

## Prod environment

This environment is fully managed by Cozy team.

### Cozy stack

Fully managed by Cozy team.

### Proxy

Bastien DUMONT's avatar
Bastien DUMONT committed
A dedicated proxy is deployed on Cozy side to allow konnector to make the Oauth dance.
Hugo NOUTS's avatar
Hugo NOUTS committed
The proxy deployed is based on the project available on the Gitlab but variables are overwritten using flags by the Cozy team in order to fit to the environment.

For each modification in production, it needs:
Bastien DUMONT's avatar
Bastien DUMONT committed

Hugo NOUTS's avatar
Hugo NOUTS committed
- to be done on the Gitlab project
Hugo NOUTS's avatar
Hugo NOUTS committed
- to be tested in dev environment
Hugo NOUTS's avatar
Hugo NOUTS committed
After that we should ask Cozy to pull the modification from the Gitlab in order to have them in production.

### Ecolyo and konnectors

The production environment is based on the build branch which should reflect the build of sources present on master branch.

Each deployment is done manually for each app/konnector by:
Bastien DUMONT's avatar
Bastien DUMONT committed

- building the application (yarn build)
- deploy the build on the build branch (yarn deploy)
Hugo NOUTS's avatar
Hugo NOUTS committed
- publishing content of build branch into Cozy repository (yarn cozyPublish)
Bastien DUMONT's avatar
Bastien DUMONT committed
Once it is published, Cozy team should validate it before deploying the new app version into all Cozy Grand Lyon instances.