{"id":21301745,"url":"https://github.com/funbox/init-exporter","last_synced_at":"2025-07-11T20:31:23.732Z","repository":{"id":6236295,"uuid":"55154965","full_name":"funbox/init-exporter","owner":"funbox","description":"Utility for exporting services described by Procfile to init system","archived":false,"fork":false,"pushed_at":"2025-05-27T10:23:39.000Z","size":517,"stargazers_count":28,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-27T11:34:25.629Z","etag":null,"topics":["golang","ruby","systemd","upstart"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/funbox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-03-31T14:00:26.000Z","updated_at":"2025-03-03T21:46:25.000Z","dependencies_parsed_at":"2023-10-03T14:21:39.792Z","dependency_job_id":"6f783211-d858-40ac-b56f-fdbc88e92212","html_url":"https://github.com/funbox/init-exporter","commit_stats":null,"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/funbox/init-exporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funbox%2Finit-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funbox%2Finit-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funbox%2Finit-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funbox%2Finit-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/funbox","download_url":"https://codeload.github.com/funbox/init-exporter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funbox%2Finit-exporter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264892205,"owners_count":23679252,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","ruby","systemd","upstart"],"created_at":"2024-11-21T15:50:40.401Z","updated_at":"2025-07-11T20:31:18.721Z","avatar_url":"https://github.com/funbox.png","language":"Go","readme":"## `init-exporter` [![CI](https://github.com/funbox/init-exporter/actions/workflows/ci.yml/badge.svg)](https://github.com/funbox/init-exporter/actions/workflows/ci.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/funbox/init-exporter)](https://goreportcard.com/report/github.com/funbox/init-exporter) [![License](https://gh.kaos.st/mit.svg)](LICENSE)\n\nUtility for exporting services described by Procfile to init system.\nSupported init systems: upstart and systemd\n\n* [Installation](#installation)\n* [Configuration](#configuration)\n* [Usage](#usage)\n  * [Procfile v.1](#procfile-v1)\n  * [Procfile v.2](#procfile-v2)\n* [Exporting](#exporting)\n* [Command options](#command-options)\n* [Build status](#build-status)\n* [License](#license)\n\n### Installation\n\n#### From source\n\nTo build the init-exporter from scratch, make sure you have a working Go 1.18+ workspace ([instructions](https://golang.org/doc/install)), then:\n\n```bash\ngo get -d github.com/funbox/init-exporter\ncd $GOPATH/src/github.com/funbox/init-exporter\nmake deps all\nsudo make install\n```\n\n#### From [ESSENTIAL KAOS Public Repository](https://yum.kaos.st)\n\n```bash\nsudo yum install -y https://yum.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '\"' | cut -d':' -f5).noarch.rpm\nsudo yum install init-exporter\n```\n\n### Configuration\n\nThe export process can be configured through the config `/etc/init-exporter.conf`:\n\n```ini\n# Default configuration for init-exporter\n\n[main]\n\n  # Default run user\n  run-user: service\n\n  # Default run group\n  run-group: service\n\n  # Prefix used for exported units and helpers\n  prefix: fb-\n\n[procfile]\n\n  # Enable/disable support of version 1 proc files\n  version1: false\n\n  # Enable/disable support of version 2 proc files\n  version2: true\n\n[paths]\n\n  # Working dir\n  working-dir: /tmp\n\n  # Path to directory with helpers\n  helper-dir: /var/local/init-exporter/helpers\n\n  # Path to directory with systemd configs\n  systemd-dir: /etc/systemd/system\n\n  # Path to directory with upstart configs\n  upstart-dir: /etc/init\n\n[defaults]\n\n  # Number of Processes (0 - disabled)\n  nproc: 10240\n\n  # Number of File Descriptors (0 - disabled)\n  nofile: 10240\n\n  # Enable or disable respawn by default here\n  respawn: true\n\n  # Respawn count\n  respawn-count: 10\n\n  # Respawn interval\n  respawn-interval: 15\n\n  # Kill timeout (0 - disabled)\n  kill-timeout: 60\n\n[log]\n\n  # Enable or disable logging here\n  enabled: true\n\n  # Log file directory\n  dir: /var/log/init-exporter\n\n  # Path to log file\n  file: {log:dir}/init-exporter.log\n\n  # Default log file permissions\n  perms: 0644\n\n  # Minimal log level (debug/info/warn/error/crit)\n  level: info\n```\n\nTo give a certain user (i.e. `deployuser`) the ability to use this script, you can place the following lines into `sudoers` file:\n\n```bash\n# Commands required for manipulating jobs\nCmnd_Alias UPSTART = /sbin/start, /sbin/stop, /sbin/restart\nCmnd_Alias SYSTEMD = /usr/bin/systemctl\nCmnd_Alias EXPORTER = /usr/local/bin/init-exporter\n\n...\n\n# Allow deploy user to manipulate jobs\ndeployuser        ALL=(deployuser) NOPASSWD: ALL, (root) NOPASSWD: UPSTART, SYSTEMD, EXPORTER\n```\n\n### Usage\n\n`init-exporter` is able to process two versions of Procfiles. Utility automatically recognises used format.\n\n#### Procfile v.1\n\nAfter init-exporter is installed and configured, you may export background jobs\nfrom an arbitrary Procfile-like file of the following format:\n\n```yaml\ncmdlabel1: cmd1\ncmdlabel2: cmd2\n```\n\ni.e. a file `./myprocfile` containing:\n\n```yaml\nmy_tail_cmd: /usr/bin/tail -F /var/log/messages\nmy_another_tail_cmd: /usr/bin/tail -F /var/log/messages\n```\n\nFor security purposes, command labels are allowed to contain only letters, digits, and underscores.\n\n#### Procfile v.2\n\nAnother format of Procfile scripts is YAML config. A configuration script may\nlook like this:\n\n```yaml\nversion: 2\n\nstart_on_runlevel: 3\nstop_on_runlevel: 3\n\nenv:\n  RAILS_ENV: production\n  TEST: true\n\nworking_directory: /srv/projects/my_website/current\n\ncommands:\n  my_tail_cmd:\n    command: /usr/bin/tail -F /var/log/messages\n    respawn:\n      count: 5\n      interval: 10\n    env:\n      RAILS_ENV: staging # if needs to be redefined or extended\n    working_directory: '/var/...' # if needs to be redefined\n\n  my_another_tail_cmd:\n    command: /usr/bin/tail -F /var/log/messages\n    kill_timeout: 60\n    kill_signal: SIGQUIT\n    reload_signal: SIGUSR2\n    env_file: shared/staging.env\n    respawn: false # by default respawn option is enabled\n\n  my_one_another_tail_cmd:\n    pre: /usr/bin/echo pre_command\n    command: /usr/bin/tail -F /var/log/messages\n    post: /usr/bin/echo post_command\n    log: /var/log/messages_copy\n\n  my_multi_tail_cmd:\n    command: /usr/bin/tail -F /var/log/messages\n    count: 2\n```\n\n`start_on_runlevel` and `stop_on_runlevel` are two global options that can't be\nredefined per-command.\n\n`working_directory` will generate the following line:\n\n```bash\ncd 'your/working/directory' \u0026\u0026 your_command\n```\n\n`env` params can be redefined and extended in per-command options. Note that\nyou can't remove a globally defined `env` variable.\nFor Procfile example given earlier the generated command will look like:\n\n```bash\nenv RAILS_ENV=staging TEST=true your_command\n```\n\n`log` option lets you override the default log location (`/var/log/fb-my_website/my_one_another_tail_cmd.log`).\n\n`kill_timeout` option lets you override the default process kill timeout of 30 seconds.\n\n`kill_signal` specifies which signal to use when killing a service.\n\n`reload_signal` specifies which signal to use when reloading a service.\n\n`env_file` absolute or relative path to file with environment variables.\n\n`respawn` option controls how often the job can fail. If the job restarts more\noften than `count` times in `interval`, it won't be restarted anymore.\n\nOptions `working_directory`, `env`, `log`, `respawn` can be\ndefined both as global and as per-command options.\n\n### Exporting\n\nTo export a Procfile you should run\n\n```bash\nsudo init-exporter -p ./myprocfile -f format myapp\n```\nWhere `myapp` is the application name. This name only affects the names of generated files. For security purposes, app name is also allowed to contain only letters, digits and underscores.\n\nFormat is name of init system `(upstart | systemd)`.\n\nAssuming that default options are used, the following files and folders will be generated (in case of upstart format):\n\nin `/etc/init/`:\n\n```\nfb-myapp-my_another_tail_cmd.conf\nfb-myapp-my_tail_cmd.conf\nfb-myapp.conf\n```\n\nin `/var/local/init-exporter/helpers`:\n\n```\nfb-myapp-my_another_tail_cmd.sh\nfb-myapp-my_tail_cmd.sh\n```\n\nPrefix `fb-` (which can be customised through config) is added to avoid collisions with other jobs.\nAfter this `my_tail_cmd`, for example, will be able to be started as an Upstart job:\n\n```bash\nsudo start fb-myapp-my_tail_cmd\n...\nsudo stop fb-myapp-my_tail_cmd\n```\n\nIt's stdout/stderr will be redirected to `/var/log/fb-myapp/my_tail_cmd.log`.\n\nTo start/stop all application commands at once, you can run:\n\n```bash\nsudo start fb-myapp\n...\nsudo stop fb-myapp\n```\n\nTo remove init scripts and helpers for a particular application you can run\n\n```bash\nsudo init-exporter -u -f upstart myapp\n```\n\nThe logs are not cleared in this case. Also, all old application scripts are cleared before each export.\n\n### Command options\n\n```\nUsage: init-exporter {options} app-name\n\nOptions\n\n  --procfile, -p file             Path to procfile\n  --dry-start, -d                 Dry start (don't export anything, just parse and test procfile)\n  --disable-validation, -D        Disable application validation\n  --unistall, -u                  Remove scripts and helpers for a particular application\n  --format, -f upstart|systemd    Format of generated configs\n  --no-colors, -nc                Disable colors in output\n  --help, -h                      Show this help message\n  --version, -v                   Show version\n\nExamples\n\n  init-exporter -p ./myprocfile -f systemd myapp\n  Export given procfile to systemd as myapp\n\n  init-exporter -u -f systemd myapp\n  Uninstall myapp from systemd\n\n  init-exporter -p ./myprocfile -f upstart myapp\n  Export given procfile to upstart as myapp\n\n  init-exporter -u -f upstart myapp\n  Uninstall myapp from upstart\n\n```\n\n### Build status\n\n| Branch | Status |\n|--------|--------|\n| Stable | [![CI](https://github.com/funbox/init-exporter/actions/workflows/ci.yml/badge.svg)](https://github.com/funbox/init-exporter/actions/workflows/ci.yml) |\n| Unstable | [![CI](https://github.com/funbox/init-exporter/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/funbox/init-exporter/actions/workflows/ci.yml) |\n\n### License\n\n`init-exporter` is released under the MIT license (see [LICENSE](LICENSE))\n\n[![Sponsored by FunBox](https://funbox.ru/badges/sponsored_by_funbox_grayscale.svg)](https://funbox.ru)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffunbox%2Finit-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffunbox%2Finit-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffunbox%2Finit-exporter/lists"}