# @coweb/infrastructure

> Infrastructure tool for deployment

Latest version **1.4.0** (published 2019-06-02) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install @coweb/infrastructure
pnpm add @coweb/infrastructure
yarn add @coweb/infrastructure
bun add @coweb/infrastructure
```

Provides the command `cow`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2019-06-02 |
| First published | 2018-12-20 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 140.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Shepherds |
| Maintainers | ozyinc |

## Links

- npm: https://www.npmjs.com/package/@coweb/infrastructure
- Repository: http://gitlab.ceng.metu.edu.tr/Group3/infrastructure
- npm.io page: https://npm.io/package/@coweb/infrastructure

## Dependencies (4)

- [nomnom](https://npm.io/package/nomnom.md) ^1.8.1
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.12.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^7.0.0
- [kubernetes-client](https://npm.io/package/kubernetes-client.md) ^6.3.0

## Recent versions

- 1.4.0 (latest) — 2019-06-02
- 1.3.6 — 2019-05-12
- 1.3.5 — 2019-05-12
- 1.3.4 — 2019-05-12
- 1.3.3 — 2019-05-12
- 1.3.2 — 2019-05-12
- 1.3.1 — 2019-05-12
- 1.3.0 — 2019-03-23
- 1.2.0 — 2019-03-23
- 1.1.8 — 2018-12-25
- 1.1.7 — 2018-12-25
- 1.1.6 — 2018-12-25
- 1.1.5 — 2018-12-25
- 1.1.4 — 2018-12-25
- 1.1.3 — 2018-12-25
- … 7 more at https://npm.io/package/@coweb/infrastructure/versions

## README

COW: deployment/tool

[![pipeline status](http://gitlab.ceng.metu.edu.tr/Group3/infrastructure/badges/master/pipeline.svg)](http://gitlab.ceng.metu.edu.tr/Group3/infrastructure/commits/master)
[![coverage report](http://gitlab.ceng.metu.edu.tr/Group3/infrastructure/badges/master/coverage.svg)](http://gitlab.ceng.metu.edu.tr/Group3/infrastructure/commits/master)

### How to use

#### Installation 
```bash
npm i -g @cow/infrastructure
```

#### Connect to a server in cluster
Example is given below for MongoDB, other services can be accessed via similar mechanism
```bash
    ssh username@setupserver -L <targetport>:localhost:27017 # The port is the port you want your localhost to be exposed to
    cow expose mongo
```
### Deployment

There shall be a cow.yml file committed in your repository. If you have it then you can deploy any version of it with command:
```bash
cow deploy -v <version> -f cow.yml # (or any other path) 
```

### cow.yml structure
```yaml
meta:
    component: <specific component like core, newsgroup etc...>
    subservice: <specific service of that component like endpoint, scheduler etc...>
type: <the type of the deployment currently supported are `backend-npm` and `frontend-npm`>
spec: <type specific specifications>

```
#### backend-docker type
The spec requirements are as follows:
```yaml
replicaCount: <how many copies of the machine shall be created>
mapPorts:
  - from: <port that is exposed from code>
    to: <in-cluster access port>
    public: <if true then from port will be exposed publicly at /component-subservice/ with HTTPS>
resource:
    request:
        cpu: <minimum CPU requirement per time interval like 0.3 0.6>
        memory: <minimum RAM requirement specify like 300Mi 1Gi>
    limit:
        cpu: <maximum amount of CPU per time interval like 0.6 1.0>
        memory: <max RAM requirement, same syntax as requests>
readyAfterSeconds: <how many seconds shall I wait before it starts>
envs: <array of env values to be used>
injections:
- targetService: <the service that cow should inject content to>
  type: <a unique key that identifies the injection type, determined by target service>
  id: <a unique name that you give in your config file for this injection, this is not to be used by target service>
  content: < configuration content, target service has probably documented on what should go into this>
mounts:
- path: < where to add the persistent storage (all content in here will be wiped in the image, directories will be created> 
  size: < size of persistent storage, express in units of Mi, Gi >
  id: < a unique name that you give to this mounted disk >

```

Other types are deprecated.

---
_Source: https://npm.io/package/@coweb/infrastructure · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
