{"id":31968419,"url":"https://github.com/ihcsim/cockroachdb-formula","last_synced_at":"2026-05-14T20:03:05.891Z","repository":{"id":149608231,"uuid":"80650530","full_name":"ihcsim/cockroachdb-formula","owner":"ihcsim","description":"Salt formula for cockroachdb","archived":false,"fork":false,"pushed_at":"2017-02-18T05:23:13.000Z","size":42,"stargazers_count":2,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-24T04:46:07.242Z","etag":null,"topics":["cockroachdb","saltstack","saltstack-formula"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/ihcsim.png","metadata":{"files":{"readme":"README.rst","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-02-01T18:31:22.000Z","updated_at":"2017-02-14T18:00:59.000Z","dependencies_parsed_at":"2023-04-25T11:32:42.988Z","dependency_job_id":null,"html_url":"https://github.com/ihcsim/cockroachdb-formula","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ihcsim/cockroachdb-formula","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihcsim%2Fcockroachdb-formula","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihcsim%2Fcockroachdb-formula/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihcsim%2Fcockroachdb-formula/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihcsim%2Fcockroachdb-formula/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ihcsim","download_url":"https://codeload.github.com/ihcsim/cockroachdb-formula/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihcsim%2Fcockroachdb-formula/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33041204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cockroachdb","saltstack","saltstack-formula"],"created_at":"2025-10-14T18:52:41.378Z","updated_at":"2026-05-14T20:03:05.885Z","avatar_url":"https://github.com/ihcsim.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"===========\nCockroachDB\n===========\n.. image:: https://app.codeship.com/projects/fcaedd30-d7c1-0134-f965-4e471868a2e5/status?branch=master\n  :target: https://app.codeship.com/projects/203122\n\nFormula to install and configure `CockroachDB \u003chttps://github.com/cockroachdb/cockroach\u003e`_.\n\n.. note::\n\n    See the full `Salt Formulas installation and usage instructions\n    \u003chttp://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html\u003e`_.\n\nAvailable states\n================\n.. contents::\n    :local:\n\n``cockroachdb``\n---------------\nThis state installs a single instance of CockroachDB on a minion. All supported runtime options can be passed to the instance using the ``cockroachdb.runtime_options`` pillar. The following pillar starts an insecure CockroachDB instance at localhost:26257, configured to write its data to ``/opt/cockroachdb/data`` and logs to ``/opt/cockroachdb/log``.\n\n.. code:: yaml\n\n  cockroachdb:\n    runtime_options:\n      - --insecure=true\n      - --host=localhost\n      - --port=26257\n      - --store=path=/opt/cockroachdb/data\n      - --log-dir=/opt/cockroachdb/log\n\nThe ``cockroachdb/scripts/default.yml`` file contains a set of default values that can be overridden using pillar data.\n\nTo start a `cluster \u003chttps://www.cockroachlabs.com/docs/start-a-local-cluster.html\u003e`_, provide the ``--join`` flag to the ``cockroachdb.runtime_options`` pillar. The following example states and pillar starts a cluster of 3 instances, with nodes ``db-01``, ``db-02``, ``db-03``, and run a user-provided ``initdb.sql`` SQL script.\n\n``salt/top.sls``\n\n.. code:: yaml\n\n  base:\n    'db-01':\n      - cockroachdb.initdb\n    'not db-01':\n      - cockroachdb\n\n``pillar/top.sls``\n\n.. code:: yaml\n\n  base:\n    'db-01':\n      - cockroachdb.initdb\n    'not db-01':\n      - cockroachdb.cluster\n\n``pillar/cockroachdb/initdb.sls``\n\n.. code:: yaml\n\n  {% set ipv4_addrs = {'private':'127.0.0.1', 'public':'127.0.0.1'} -%}\n  {% for ipv4_addr in salt['grains.get']('ipv4', '127.0.0.1') -%}\n  {% if salt['network.is_private'](ipv4_addr) if not salt['network.is_loopback']('ipv4_addr') -%}\n  {% do ipv4_addrs.update({'private': ipv4_addr}) -%}\n  {% elif not salt['network.is_private']('ipv4_addr') -%}\n  {% do ipv4_addrs.update({'public': ipv4_addr}) -%}\n  {% endif -%}\n  {% endfor -%}\n  cockroachdb:\n    initdb:\n      user: maxroach\n      database: maxroachdb\n\n      sql:\n        script: salt://cockroachdb/files/initdb.sql\n        keep: false\n\n    runtime_options:\n      - --insecure=true\n      - --host={{ ipv4_addrs['private'] }}\n      - --http-host={{ ipv4_addrs['public'] }}\n      - --store=path=/etc/cockroachdb/data\n\n``pillar/cockroachdb/cluster.sls``\n\n.. code:: yaml\n\n  {% set ipv4_addrs = {'private':'127.0.0.1', 'public':'127.0.0.1'} -%}\n  {% for ipv4_addr in salt['grains.get']('ipv4', '127.0.0.1') -%}\n  {% if salt['network.is_private'](ipv4_addr) if not salt['network.is_loopback']('ipv4_addr') -%}\n  {% do ipv4_addrs.update({'private': ipv4_addr}) -%}\n  {% elif not salt['network.is_private']('ipv4_addr') -%}\n  {% do ipv4_addrs.update({'public': ipv4_addr}) -%}\n  {% endif -%}\n  {% endfor -%}\n  cockroachdb:\n    runtime_options:\n      - --join=\u003cdb-01-static-ipv4-address\u003e\n      - --insecure=true\n      - --host={{ ipv4_addrs['private'] }}\n      - --http-host={{ ipv4_addrs['public'] }}\n      - --store=path=/etc/cockroachdb/data\n\n``cockroachdb.initdb``\n----------------------\nThis state initializes the CockroachDB instance with a user-provided superuser and its database. In addition, a user-provided SQL script located at ``cockroachdb.initdb.sql.script`` is executed on-start. The following pillar instructs CockroachDB to create a superuser ``maxroach`` and its database ``maxroachdb`` after the instance is started successfully. Any SQL queries provided at ``cockroachdb/files/queries.sql`` will be also run after the instance is ready.\n\n.. code:: yaml\n\n  cockroachdb:\n    initdb:\n      dbuser: maxroach\n      database: maxroachdb\n\n      sql:\n        script: salt://cockroachdb/files/queries.sql\n\nAn example user-provided SQL script can be found in ``cockroachdb/files/initdb.sql``. This script will automatically be executed as ``cockroachdb.initdb.dbuser`` in ``cockroachdb.initdb.database`` on-start. This script will be re-executed on-restart. The minion can be instructed to delete this SQL script after the first execution using the ``cockroachdn.initdb.sql.keep`` pillar data.\n\nThe ``pillar.example`` file provides further example.\n\nTesting\n=======\nTesting is done using `salt-kitchen \u003chttps://github.com/simonmcc/kitchen-salt\u003e`_ and `serverspec \u003chttp://serverspec.org/\u003e`_. These libraries will need to be installed before running the tests. To run the test:\n\n.. code:: sh\n\n  $ bundle install\n  $ kitchen test\n\nHere's a summary of the test suites:\n\n+--------------+-------------------------------------------------+-----------------------------+\n| Test Suites  | Description                                     | Paths                       |\n+--------------+-------------------------------------------------+-----------------------------+\n| ``default``  | Use ``cockroachdb/default.yml`` as pillar source| ``test/integration/default``|\n+--------------+-------------------------------------------------+-----------------------------+\n| ``pillar``   | Use ``pillar.example`` as pillar source         | ``test/integration/pillar`` |\n+--------------+-------------------------------------------------+-----------------------------+\n| ``initdb``   | Test initdb behaviour                           | ``test/integration/initdb`` |\n+--------------+-------------------------------------------------+-----------------------------+\n\n``kitchen test`` is the meta-action that automates all the end-to-end test actions. To speed up the development test-code-verify cycle, use the ``converge`` and ``verify`` actions:\n\n.. code:: sh\n\n  $ kitchen create\n  $ kitchen converge\n  $ kitchen verify\n\nIf an error occurred complaining that `Vagrant is unable to mount the VirtualBox shared file system because vboxsf is not available \u003chttp://stackoverflow.com/q/22717428/1144203\u003e`_, then run the following command to install the VirtualBox guest additions:\n\n.. code:: shell\n\n  $ vagrant plugin install vagrant-vbguest\n\nLicense\n=======\nRefers to the `LICENSE \u003cLICENSE\u003e`_ file. CockroachDB is an `open source project \u003chttps://github.com/cockroachdb/cockroach/blob/master/LICENSE\u003e`_.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fihcsim%2Fcockroachdb-formula","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fihcsim%2Fcockroachdb-formula","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fihcsim%2Fcockroachdb-formula/lists"}