0.2.4 • Published 3 years ago

freted v0.2.4

Weekly downloads
26
License
MIT
Repository
github
Last release
3 years ago

freted

oclif Version Downloads/week License

freted banner

About

$ freted uses Docker and Git to manage environments for local development of distributed systems. It works like a dependency manager (like Composer and npm) to resolve dependencies and start all on your local machine.

Technology

  • Docker
  • Node
  • Oclif
  • TypeScript
  • Traefik

Requirements

To use freted you need the following dependencies installed in your machine:

  • Docker
  • Git
  • Node >= 10

Getting started

To start using freted, follow those steps:

1. Install freted

Using NPM

$ npm install -g freted

2. Authenticate with GitLab or GitHub

$ freted login

3. Start a service

Enter the service name as an argument to the start command. The service name is the URL of the repository without the protocol. For example, for the repository https://github.com/myorg/myproject the name is github.com/myorg/myproject.

If the repository don't exists locally, freted will clone in your workspace if you granted your credentials using $ freted login.

If you are working on a new project and it doesn't have a repository yet, freted will try to resolve the local directory within your workspace.

$ freted start github.com/myorg/myproject

This command will resolve and start the project and all it's dependencies and print a resume of all services.

Configuring services

To allow a project to be run with freted, create a file on the root of your project named freted.yml with the following content:

name: github.com/myorg/myproject
description: My awesome project

You can find a full example of a config file on the repository at here.

Commands

You can define the commands to setup, start and stop your services.

  • setup: will be run when you start the service for the first time.
  • start: will be run when you start the service.
  • stop: will be run when you stop the service.
setup:
  - docker-compose build

start:
  - docker-compose up -d

stop:
  - docker-compose down

Dependencies

freted is also a dependency manager. If you have a service (like a SPA) that depends on another (like an API), you can declare this dependency on freted.yml:

dependencies:
  - github.com/myorg/myproject2

optionalDependencies:
  - github.com/myorg/myproject3

Credentials and instructions

You can use the freted.yml to put default credentials and quick notes for the developers. Those instructions will be shown on the terminal after the application starts.

instructions:
  - Sign-in using one of the credentials provided.

credentials:
  - name: Active user
    description: User active on the app
    email: foo@bar.com
    password: mysecretpass

HTTP entrypoint

freted uses Traefik to facilitate the organization and communication between all services. The Traefik container is automatically managed by freted.

If your service can be accessed through HTTP, edit the freted.yml and add the following config:

routes:
  - host: myproject.myorg.local
    backend: docker
    destination: mycontainer_app
    port: 80

The field destination must be the name of the running container. With docker compose, set the field container_name on the service and use the same name here.

CLI Usage

$ npm install -g freted
$ freted COMMAND
running command...
$ freted (-v|--version|version)
freted/0.2.4 darwin-x64 node-v12.17.0
$ freted --help [COMMAND]
USAGE
  $ freted COMMAND
...

Commands

freted configure

configure freted

USAGE
  $ freted configure

EXAMPLE
  $ freted configure

See code: src/commands/configure.ts

freted help [COMMAND]

display help for freted

USAGE
  $ freted help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

freted inspect SERVICE

inspect a service

USAGE
  $ freted inspect SERVICE

ARGUMENTS
  SERVICE  name of the service

EXAMPLE
  $ freted inspect github.com/myorg/myproject

See code: src/commands/inspect.ts

freted login

authenticate to supported providers

USAGE
  $ freted login

EXAMPLE
  $ freted login

See code: src/commands/login.ts

freted logs

show services logs

USAGE
  $ freted logs

EXAMPLE
  $ freted logs

See code: src/commands/logs.ts

freted restart SERVICE

restart a service

USAGE
  $ freted restart SERVICE

ARGUMENTS
  SERVICE  name of the service to restart

EXAMPLE
  $ freted restart github.com/myorg/myproject

See code: src/commands/restart.ts

freted start SERVICE

start a service

USAGE
  $ freted start SERVICE

ARGUMENTS
  SERVICE  name of the service to start

OPTIONS
  --no-dependencies           don't start service dependencies
  --no-optional-dependencies  don't start service optional dependencies

EXAMPLE
  $ freted start github.com/myorg/myproject

See code: src/commands/start.ts

freted stop SERVICE

stop a service

USAGE
  $ freted stop SERVICE

ARGUMENTS
  SERVICE  name of the service to stop

OPTIONS
  --no-dependencies           don't start service dependencies
  --no-optional-dependencies  don't start service optional dependencies

EXAMPLE
  $ freted stop github.com/myorg/myproject

See code: src/commands/stop.ts