forked from chef/chef-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Habitization - supersedes PR#1416
This is a branch copy of chef#1416 rebased and with all commits squashed and authors attributed below. and are functional. Co-authored-by: Elliott Davis <edavis@chef.io> Co-authored-by: Irving Popovetsky <irving@chef.io> Co-authored-by: Mark Anderson <mark@chef.io> Co-authored-by: Nolan Davidson <ndavidson@chef.io> Co-authored-by: Thomas Cate <thomascate@gmail.com> Signed-off-by: Jeremy J. Miller <jm@chef.io>
- Loading branch information
Showing
103 changed files
with
4,605 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,7 @@ compile_commands.json | |
*.tfstate | ||
*.tfstate.backup | ||
*_override.tf | ||
|
||
# Habitat | ||
results | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# Configurable environment variables: | ||
# HAB_ORIGIN - denotes the docker origin (dockerhub ID) | ||
# VERSION - the version identifier tag on the packages | ||
# AUTOMATE_ENABLED - enable the Automate data collector (true or false) | ||
# AUTOMATE_SERVER - the IP address or hostname of the Automate server | ||
# AUTOMATE_TOKEN - the token for the Automate server data collector | ||
# USER_ID - the user ID to use | ||
# GROUP_ID - the group ID to use | ||
|
||
version: '2.1' | ||
services: | ||
postgresql: | ||
image: chefdemo/postgresql:stable | ||
environment: | ||
HAB_POSTGRESQL: | | ||
[superuser] | ||
name = 'hab' | ||
password = 'chefrocks' | ||
volumes: | ||
- postgresql-data:/hab/svc/postgresql/data:Z | ||
|
||
chef-server-ctl: | ||
image: ${HAB_ORIGIN:-chefserverofficial}/chef-server-ctl:${VERSION:-latest} | ||
user: ${USER_ID:-42}:${GROUP_ID:-42} | ||
cap_drop: | ||
- NET_BIND_SERVICE | ||
- SETUID | ||
- SETGID | ||
command: --peer postgresql | ||
environment: | ||
HAB_CHEF_SERVER_CTL: | | ||
[chef_server_api] | ||
ip = '${HOST_IP:-172.17.0.1}' | ||
[secrets.data_collector] | ||
token = "${AUTOMATE_TOKEN:-93a49a4f2482c64126f7b6015e6b0f30284287ee4054ff8807fb63d9cbd1c506}" | ||
elasticsearch: | ||
image: chefdemo/elasticsearch:stable | ||
command: --peer postgresql | ||
ulimits: | ||
nofile: | ||
soft: 65536 | ||
hard: 65536 | ||
volumes: | ||
- elasticsearch-data:/hab/svc/elasticsearch/data:Z | ||
|
||
oc_id: | ||
image: ${HAB_ORIGIN:-chefserverofficial}/oc_id:${VERSION:-latest} | ||
user: ${USER_ID:-42}:${GROUP_ID:-42} | ||
cap_drop: | ||
- NET_BIND_SERVICE | ||
- SETUID | ||
- SETGID | ||
command: --peer postgresql | ||
--bind database:postgresql.default | ||
--bind chef-server-ctl:chef-server-ctl.default | ||
|
||
bookshelf: | ||
image: ${HAB_ORIGIN:-chefserverofficial}/bookshelf:${VERSION:-latest} | ||
user: ${USER_ID:-42}:${GROUP_ID:-42} | ||
cap_drop: | ||
- NET_BIND_SERVICE | ||
- SETUID | ||
- SETGID | ||
command: --peer postgresql | ||
--bind database:postgresql.default | ||
--bind chef-server-ctl:chef-server-ctl.default | ||
|
||
oc_bifrost: | ||
image: ${HAB_ORIGIN:-chefserverofficial}/oc_bifrost:${VERSION:-latest} | ||
user: ${USER_ID:-42}:${GROUP_ID:-42} | ||
cap_drop: | ||
- NET_BIND_SERVICE | ||
- SETUID | ||
- SETGID | ||
command: --peer postgresql | ||
--bind database:postgresql.default | ||
--bind chef-server-ctl:chef-server-ctl.default | ||
|
||
oc_erchef: | ||
image: ${HAB_ORIGIN:-chefserverofficial}/oc_erchef:${VERSION:-latest} | ||
user: ${USER_ID:-42}:${GROUP_ID:-42} | ||
cap_drop: | ||
- NET_BIND_SERVICE | ||
- SETUID | ||
- SETGID | ||
command: --peer postgresql | ||
--bind bookshelf:bookshelf.default | ||
--bind oc_bifrost:oc_bifrost.default | ||
--bind database:postgresql.default | ||
--bind elasticsearch:elasticsearch.default | ||
--bind chef-server-ctl:chef-server-ctl.default | ||
environment: | ||
HAB_OC_ERCHEF: | | ||
[chef_authn] | ||
keygen_cache_workers=2 | ||
keygen_cache_size=10 | ||
keygen_start_size=0 | ||
keygen_timeout=20000 | ||
[data_collector] | ||
enabled = ${AUTOMATE_ENABLED:-false} | ||
server = "${AUTOMATE_SERVER:-localhost}" | ||
port = 443 | ||
chef-server-nginx: | ||
image: ${HAB_ORIGIN:-chefserverofficial}/chef-server-nginx:${VERSION:-latest} | ||
user: ${USER_ID:-42}:${GROUP_ID:-42} | ||
cap_drop: | ||
- NET_BIND_SERVICE | ||
- SETUID | ||
- SETGID | ||
command: --peer postgresql | ||
--bind oc_erchef:oc_erchef.default | ||
--bind oc_bifrost:oc_bifrost.default | ||
--bind oc_id:oc_id.default | ||
--bind bookshelf:bookshelf.default | ||
--bind elasticsearch:elasticsearch.default | ||
--bind chef-server-ctl:chef-server-ctl.default | ||
volumes: | ||
- nginx-data:/hab/svc/chef-server-nginx/data:Z | ||
ports: | ||
- 80:8080 | ||
- 443:8443 | ||
|
||
volumes: | ||
postgresql-data: | ||
elasticsearch-data: | ||
nginx-data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash -e | ||
|
||
# this script builds all the essential habitat packages for running Chef Server | ||
# additionaly, it exports them as a local docker image | ||
|
||
CHEF_SERVER_SRC='/src/src' | ||
|
||
for dir in dbdpg oc-id openresty-noroot nginx bookshelf chef-server-ctl oc_bifrost oc_erchef; do | ||
cd $CHEF_SERVER_SRC/$dir | ||
echo "[STATUS] building $dir" | ||
build > /var/log/build-${dir}-$(date +%s).log | ||
if [[ $dir =~ dbdpg ]]; then continue; fi | ||
echo "[STATUS] exporting $dir pkg to docker daemon" | ||
hab pkg export docker --non-root -i "chefserverofficial/{{pkg_name}}" $(ls -1t results/*.hart | head -1) | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash -e | ||
|
||
# TODO: not sure how to handle this. Sqitch bombs when it can't find the timezone | ||
export TZ="UTC" | ||
|
||
export PERL5LIB="$(cat "$(hab pkg path "chef-server/dbdpg")/LD_RUN_PATH")" | ||
export PATH=$PATH:$(hab pkg path "core/postgresql")/bin:$(hab pkg path "core/sqitch")/bin | ||
|
||
{{#if bind.database}} | ||
{{#eachAlive bind.database.members as |member|}} | ||
{{#if @last}} | ||
HOST="{{member.sys.ip}}" | ||
PORT="{{member.cfg.port}}" | ||
USER="{{member.cfg.superuser_name}}" | ||
PASS="{{member.cfg.superuser_password}}" | ||
DB="bookshelf" | ||
{{/if}} | ||
{{/eachAlive}} | ||
{{else}} | ||
HOST="{{cfg.postgresql.vip}}" | ||
PORT="{{cfg.postgresql.port}}" | ||
USER="{{cfg.sql_user}}" | ||
PASS="{{cfg.sql_password}}" | ||
DB="bookshelf" | ||
{{/if}} | ||
|
||
PG_ARGS="--host "$HOST" --port "$PORT" --username "$USER"" | ||
export PGPASSWORD="$PASS" | ||
|
||
# Wait until postgres is ready | ||
until pg_isready $PG_ARGS --quiet; do :; done | ||
|
||
# Create delivery db for sqitch to deploy to | ||
createdb $PG_ARGS $DB "bookshelf" | ||
|
||
# Install uuid-ossp extension | ||
psql $PG_ARGS --command 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp"' $DB | ||
|
||
cd "{{pkg.path}}/schema" || exit | ||
sqitch --quiet --engine pg deploy "db:pg://${USER}:${PASS}@${HOST}/$DB" |
Oops, something went wrong.