Coder Social home page Coder Social logo

erlang-templates's Introduction

Erlang service template Build Status

Шаблон проекта для быстрого старта написания сервиса на Erlang, в комплекте:

  • rebar.config
  • release
  • Jenkinsfile
  • Dockerfile template
  • docker-compose config template
  • documentation stubs
  • common test stub
  • elvis ruleset

Чтобы опробовать в деле, надо всего лишь:

$ mkdir -p ~/.config/rebar3/templates
$ cd $_
$ git clone https://github.com/rbkmoney/erlang-templates.git .
$ cd ~
$ rebar3 new erlang-service name=snakeoil
$ cd snakeoil
$ git init
$ git submodule add -b master https://github.com/rbkmoney/build_utils.git build_utils
$ git submodule init
...
+ установить значения переменных BASE_IMAGE_TAG и BUILD_IMAGE_TAG в Makefile

Хозяйке на заметку. Для того, чтобы это всё заработало, необходимы следующие компоненты:

К счастью, теперь все это доступно в build образе, работать с которым легко и удобно через make:

  • wc_ - запустить в build контейнере
  • wdeps_ - запустить в build контейнере вместе с необходимыми зависимыми сервисами, используя docker-compose.
  • build_image - построить образ микросервиса
  • push_image - отправить образ микросервиса в docker registry

Чтобы получить описание и поддерживаемые переменные:

$ rebar3 new help erlang-service
erlang-service:
    custom template (~/.config/rebar3/templates/erlang-service.template)
    Description: Erlang OTP Service
    Variables:
        name="myapp" (Name of the service, an application with this name will also be created)
        description="A service that does something" (Short description of purpose of the service)
        version="1" (Initial version string)
        date="2016-01-26"
        datetime="2016-01-26T14:17:58+00:00"
        author_name="Author Name"
        author_email="[email protected]"
        copyright_year="2016"
        apps_dir="apps" (Directory where applications will be created if needed)

В случае необходимости доработки в первую очередь обращайтесь к официальной документации.

Внесение изменений

Из-за наличия в коде mustache-плейсхолдеров следующего вида ( file:service-templates/apps/app/test/app_tests_SUITE.erl):

-module({{name}}_tests_SUITE).

Форматирование через erlfmt становится нетривиальным.

Для этого в make format сделана подмена на в большинстве случаев приемлимый для парсинга код через find, xargs и sed ({{placeholder}} -> ___placeholder___) и должна работать для большинства случаев.

erlang-templates's People

Contributors

arentrue avatar petrkozorezov avatar keynslug avatar jrogov avatar trollfred avatar kpy3 avatar

Watchers

 avatar  avatar Anton Kuranda avatar  avatar CI bot avatar

Forkers

jrogov

erlang-templates's Issues

Remove rebar.config.script

rebar.config.script использовался только для настроек, специфичных для wercker. Поскольку мы перешли с wercker на Jenkins, текущий rebar.config.script не нужен и надо его удалить.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.