Package: ribosome.tool
RibosomeThe purpose of this tool is to improve release culture for small projects,
to provide usefulconventionsand suitablevocabularyfor speaking about
software pieces, and to simplify making and deploying simple services.Ribosome imposes some reasonable concepts and assumptions that, I believe,
can clarify the release process and be helpful for a wide range of projects.Let's begin with the description of what I consider the proper release process.
You have a project - some version controlled thing, a source code repository
for example. At some point in time, you decide to freeze its state by tagging
with version. Then you build it, run tests against it, and archive all needed files
as the release (release archive). You upload the archive to some persistent
storage for further use. The next step is to deploy the release to some working
place and run by loading one or more services with appropriate configurations
attached. Notice, it isessentialto support the clear separation between release,
deploy and run stages. Also, valuable properties are reproducibility and
idempotence of steps. In a nutshell, exactly process described can be achieved
with the help of Ribosome and a bit of discipline.Getting startedRibosome is available on PyPI:https://pypi.org/project/ribosome.tool/To install usepipenv(or pip, of course):$ pipenv install ribosome.toolRead help:$ ribosome --help

Usage: ribosome [OPTIONS] COMMAND [ARGS]...

  Yet another project deploy and release tool

Options:
  -v, --verbose  More detailed logging to console
  -f, --force    Rewrite existing files
  --version      Show the version and exit.
  --help         Show this message and exit.

Commands:
  deploy   Deploy release artifacts to host
  do       Run command for service at remote host
  gc       Uninstall deployed versions at remote host
  init     Initialize Ribosome project
  jump     Reload all services to version at remote host
  load     Load service at remote host
  ls       List deployed versions at remote host
  release  Make release and publish artifacts
  show     Show loaded services at remote host
  unload   Unload service at remote host
  version  Show version or update meta descriptorAnd help for specific command:$ ribosome <command> --helpTypical workflowFor a start, in the root of your project's folder, the filecodons.yamlshould be placed - this is where various settings for Ribosome live.
You can generate an empty one by the command:$ ribosome initSuppose you have already configured your project for Ribosome viacodons.yaml-
I will describe later how to do this.Ribosome releases project versions, i.e., named tags of source code repository.
Tag expected to be in one of the forms:N.N.N,N.N.NaN,N.N.NbNanddev.XXXX-
whereNis for a number andXXXXfor any alphanumerical suffix with dots inside allowed.At any time you can find out what version your project folder is:$ ribosome version infoAfter you tagged repository with a version, you can make a release:$ ribosome releaseDuring this process release archive is made and uploaded to Amazon S3 bucket.
Credentials for S3 access expected to bealready configuredin the environment.
Please, consider to useshared credentials fileand specify AWS profile incodons.yaml.Any uploaded to S3 release can be deployed to remote host accessible via SSH:$ ribosome deploy <version> <host>At remote host~/releasesfolder is used for archives upload and~/projectsis used for release deployment and management.
During deploy process runtime environment will be set up.
After that release files and runtime are considered immutable.This and any other Ribosome operations using SSH (the ones takinghostparameter)
require you to configure host settings and alias inside~/.ssh/config.For deployed release you can load and unload service(s):$ ribosome load <version> <service> <config> <host>In case of a simple upgrade, when all services of interest are already running at host,
you can quickly reload all of them (jump) to the new version:$ ribosome jump <version> <host>Load, unload and jump commands require entering sudo password for the remote host.When (un)loading services Ribosome save their status in files~/projects/<project>/services.index.yamlso you can easily view
the state of the remote host for current project via command:$ ribosome show <host>Alternatively, adding an option-awill scan for services of all projects
deployed at host:$ ribosome show <host> -aAt any time you can list deployed versions for current project with:$ ribosome ls <host>or get a list for all projects with-aoption.Deployed versions can be removed from remote host with:$ ribosome gc <versions> <host>where first argument is versions pattern - symbols*and?are recognized.
Versions with services currently loaded cannot be removed by this command,
you should unload all services from version to be able to remove it.Project configurationTechnically, Ribosome is just simple commands and remote commands runner
with few features for SCM management.
It does not do anything special or complex in terms of functionality.
What it does do - is the separation of concerns and operations specifications
to enforce and support the release process with reproducibility and immutability in mind.Ribosome on its own does not know how toreleaseprojects orloadservices.
It provides only thestructureorinterfacefor these operations.So, to configure a project for Ribosome via the filecodons.yaml-
you need to provide build, setup and other commands - your project's release process
implementation of Ribosome interface.Please, see examples forNginx configuration filesandDjango project.AcknowledgmentsThis project is created with the support ofOrderrycompany,
my thanks for the opportunities and understanding.For the idea of the nameRibosomemy gratitude goes toIevgeniia Prekrasna.