# dev-stacks
Docker-compose configuration files for development of Skinholdings projects in Test environment


#### Environments

| Project           | Dev hostname                                          | Live                                               |
|-------------------|-------------------------------------------------------|----------------------------------------------------|
| Skinscasino       | [dev.skins.testenv.io](https://dev.skins.testenv.io)  | [skins.casino](https://skins.casino/)              |
| Drakemall.com         | [dev.drakemall.com](https://dev.drakemall.com)        | [drakemall.com](https://drakemall.com)             |
| Drakemall.io         |         | [drakemall.io](https://drakemall.io)           
| Dragon            | [dev.drakemall.xyz](http://dev.drakemall.xyz)        |                                                    |
| Drakecase         | [dev.drakecase.ru](https://dev.drakecase.ru)          | [drakecase.ru](https://drakecase.ru)               |


#### Example of initial setup and deploy commands

```
git clone https://github.com/skinholdings/dev-stacks
cd dev-stacks

npm link

docker network create -d overlay --attachable global

dep-stack misc-deps
dep-stack drakemall
```

#### Shell variables:
- `DOCKER_DIR` if set, shall be used to locate docker-compose.yml files (default: `dev`)
- `DOCKER_HOST` if set, shall be used to define the machine where docker commands will be executed (default: `localhost`). This variable _has to be set_ if you plan to deploy to testenv, ex:
    ```
    export DOCKER_HOST=dev.drakemall.testenv.io
    ```

#### Scripts
(Run `npm link` from the root of the project, before using scripts)
- `dep-stack` - deploys selected .yml file to `DOCKER_HOST` (default: `localhost`), ex:
    ```
    dep-stack misc-deps
    dep-stack drakemall
    ```
- `images-from` - prints names of all images used in selected .yml file, ex:
    ```
    images-from drakemall
    ```
- `rm-stacks` - removes all currently running stacks, ex:
    ```
    rm-stacks
    ```
- `pull-images-from` - pulls all images one by one to hard drive from selected .yml file, ex:
    ```
    pull-images-from misc-deps
    ```
- `docker-clean` - removes dangling images and exited containers, ex:
    ```
    docker-clean
    ```

#### Docker
After stack is deployed, use these commands to your convenience:
```
docker service ls
docker service logs <service_id>
docker service logs <service_id> --follow
docker exec -it <container_id> <command>
```
