# Local stack

![gitlab](../img/gitlab-logo.svg)  [cozy-stack](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/cozy-stack)

## Why are we cloning the official repo ?

Cozy Cloud has chosen to not maintain the official [docker image](https://hub.docker.com/r/cozy/cozy-app-dev) properly. This is why we have a mirroring version of their official repository with some custom docker configuration improving:

* CouchDB version 3.2.2

## What changes should be done by cozy in order to upgrade their image ?

Cozy should upgrade their CouchDB version inside their image. But unfortunately, the base image `debian:stretch-slim` does not support ERLANG/OTP>=19, and CouchDB need at least a version >=20 for their `3.2.2` version, see [official doc](https://docs.couchdb.org/en/stable/whatsnew/3.2.html#id2).

As a consequence they should upgrade their base image to at least `debian:buster`. But this add a new issue, the official binary of CouchDB cannot be built on this version according to some missing libraries.

That's why we took the shortcut of using an official [CouchDB image](https://hub.docker.com/_/couchdb)

## How to build new version of the stack ?

Be sure to have a local version of the projet. Manually add a new remote origin https://github.com/cozy/cozy-stack named cozy. 

Run the following commands :

```bash
git pull cozy master
git push origin master
```

Then rebase the `feat/stack-pipeline` with last changes form master.

If we want to build a new stack version it's easy! A manual pipeline has been created. You just need to run the following steps:

* Run the manual pipeline attached to our gitlab CI/CD
* Enter the requested parameter `VERSION` and a value (ex: 1.5.7)

![Stack Pipeline](/img/stack-pipeline.png)

The image will be automatically built based on the branch and store in the registry.