Skip to content

Commit

Permalink
Expeditor cleanups after review with releng:
Browse files Browse the repository at this point in the history
- Change pkg_origin to chef for all packages
- switch from hard-coded origins to flexible ones for dbdpg and
openresty-noroot
- remove unnecessary `pkg_{lib,bin,include}_dirs` statements from hab
plans in order to stop confusing binlink and build-time linking
- remove unnecessary `pkg_source="nosuchfile.tar.gz"` and corresponding
`do_download()` and `do_verify()` steps
- remove commented out things, echos and printenvs
- remove `openresty-lpeg` plan as it wasn't being used
- Making nginx access logging configurable so it works in dockerized and non-dockerized setups
- Pull in nginx mime.types rather than trying to guess the hab origin of
the package it resides in
- Stop hab plans from modifying the rebar3 that's checked in to the source tree

Signed-off-by: Irving Popovetsky <irving@chef.io>
  • Loading branch information
Irving Popovetsky committed May 4, 2018
1 parent d08efb2 commit cb86882
Show file tree
Hide file tree
Showing 20 changed files with 129 additions and 151 deletions.
24 changes: 15 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Configurable environment variables:
# HOST_IP - the docker host IP address
# DOCKER_ORIGIN - denotes the docker origin (dockerhub ID)
# VERSION - the version identifier tag on the packages
# VERSION - the version identifier tag on the packages
# DB_VERSION - the version identifier tag on the postgres/elasticsearch images (from a different origin)
# 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
Expand All @@ -11,7 +12,7 @@
version: '2.1'
services:
postgresql:
image: chefdemo/postgresql:stable
image: chefdemo/postgresql:${DB_VERSION:-stable}
environment:
HAB_POSTGRESQL: |
[superuser]
Expand All @@ -21,7 +22,7 @@ services:
- postgresql-data:/hab/svc/postgresql/data

chef-server-ctl:
image: ${DOCKER_ORIGIN:-chefservertesting}/chef-server-ctl:${VERSION:-localdev}
image: ${DOCKER_ORIGIN:-chef}/chef-server-ctl:${VERSION:-stable}
command: --peer postgresql
environment:
HAB_CHEF_SERVER_CTL: |
Expand All @@ -31,7 +32,7 @@ services:
token = "${AUTOMATE_TOKEN:-93a49a4f2482c64126f7b6015e6b0f30284287ee4054ff8807fb63d9cbd1c506}"
elasticsearch:
image: chefdemo/elasticsearch5:stable
image: chefdemo/elasticsearch5:${DB_VERSION:-stable}
command: --peer postgresql
ulimits:
nofile:
Expand All @@ -41,25 +42,25 @@ services:
- elasticsearch-data:/hab/svc/elasticsearch/data

oc_id:
image: ${DOCKER_ORIGIN:-chefservertesting}/oc_id:${VERSION:-localdev}
image: ${DOCKER_ORIGIN:-chef}/oc_id:${VERSION:-stable}
command: --peer postgresql
--bind database:postgresql.default
--bind chef-server-ctl:chef-server-ctl.default

bookshelf:
image: ${DOCKER_ORIGIN:-chefservertesting}/bookshelf:${VERSION:-localdev}
image: ${DOCKER_ORIGIN:-chef}/bookshelf:${VERSION:-stable}
command: --peer postgresql
--bind database:postgresql.default
--bind chef-server-ctl:chef-server-ctl.default

oc_bifrost:
image: ${DOCKER_ORIGIN:-chefservertesting}/oc_bifrost:${VERSION:-localdev}
image: ${DOCKER_ORIGIN:-chef}/oc_bifrost:${VERSION:-stable}
command: --peer postgresql
--bind database:postgresql.default
--bind chef-server-ctl:chef-server-ctl.default

oc_erchef:
image: ${DOCKER_ORIGIN:-chefservertesting}/oc_erchef:${VERSION:-localdev}
image: ${DOCKER_ORIGIN:-chef}/oc_erchef:${VERSION:-stable}
command: --peer postgresql
--bind bookshelf:bookshelf.default
--bind oc_bifrost:oc_bifrost.default
Expand All @@ -79,14 +80,19 @@ services:
port = 443
chef-server-nginx:
image: ${DOCKER_ORIGIN:-chefservertesting}/chef-server-nginx:${VERSION:-localdev}
image: ${DOCKER_ORIGIN:-chef}/chef-server-nginx:${VERSION:-stable}
tty: true
stdin_open: true
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:elasticsearch5.default
--bind chef-server-ctl:chef-server-ctl.default
environment:
HAB_CHEF_SERVER_NGINX: |
access_log = "/dev/tty"
ports:
- 80:8080
- 443:8443
Expand Down
1 change: 0 additions & 1 deletion src/bookshelf/habitat/config/database-migrations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# 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}}
Expand Down
17 changes: 2 additions & 15 deletions src/bookshelf/habitat/plan.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
pkg_name=bookshelf
pkg_origin=chef-server
pkg_origin=chef
pkg_license=('Apache-2.0')
pkg_maintainer="The Chef Server Maintainers <support@chef.io>"
pkg_source="nosuchfile.tar.gz"
pkg_deps=(
core/erlang18
core/cacerts
core/coreutils
core/gcc-libs
core/sqitch
chef-server/dbdpg
$HAB_ORIGIN/dbdpg
)
pkg_build_deps=(core/make core/git core/gcc)
pkg_lib_dirs=(lib)
pkg_include_dirs=(include)
pkg_bin_dirs=(bin)
pkg_description="Bookshelf is an S3 API compatible object store."
pkg_upstream_url="https://github.com/chef/chef-server"
Expand All @@ -39,14 +36,6 @@ do_before() {
update_pkg_version
}

do_download() {
return 0
}

do_verify() {
return 0
}

do_unpack() {
# Copy everything over to the cache path so we don't write out our compiled
# deps into the working directory, but into the cache directory.
Expand All @@ -70,8 +59,6 @@ do_prepare() {

git config --global http.sslCAInfo \
"$(pkg_path_for core/cacerts)"/ssl/certs/cacert.pem

fix_interpreter ./rebar3 core/coreutils bin/env
}


Expand Down
24 changes: 1 addition & 23 deletions src/chef-server-ctl/habitat/plan.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
pkg_name=chef-server-ctl
pkg_origin=chef-server
pkg_origin=chef
pkg_maintainer="The Chef Server Maintainers <support@chef.io>"
pkg_license=('Apache-2.0')
# pkg_source="http://some_source_url/releases/${pkg_name}-${pkg_version}.tar.gz"
# pkg_filename="${pkg_name}-${pkg_version}.tar.gz"
# pkg_shasum="TODO"
pkg_deps=(
core/coreutils
core/curl
Expand All @@ -15,27 +12,20 @@ pkg_deps=(
core/postgresql
)
pkg_build_deps=(
core/coreutils
core/glibc
core/git
core/diffutils
core/patch
core/make
core/gcc
)
pkg_lib_dirs=(lib)
pkg_include_dirs=(include)
pkg_bin_dirs=(bin)
pkg_exports=(
[secrets]=secrets
)
pkg_binds_optional=(
[chef-server-nginx]="port ssl-port"
)
# pkg_exposes=(port ssl-port)
# pkg_binds=(
# [database]="port host"
# )
pkg_interpreters=(bin/bash)
pkg_svc_user="hab"
pkg_svc_group="$pkg_svc_user"
Expand All @@ -53,25 +43,13 @@ do_before() {
update_pkg_version
}

do_download() {
return 0
}

do_verify() {
return 0
}

do_unpack() {
# Copy everything over to the cache path so we don't write out our compiled
# deps into the working directory, but into the cache directory.
mkdir -p "$HAB_CACHE_SRC_PATH/$pkg_dirname"
cp -R "$PLAN_CONTEXT/../"* "$HAB_CACHE_SRC_PATH/$pkg_dirname"
}

do_prepare() {
return 0
}

do_build() {
return 0
}
Expand Down
20 changes: 5 additions & 15 deletions src/dbdpg/habitat/plan.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
pkg_name=dbdpg
pkg_origin=chef-server
pkg_version="3.5.3"
pkg_origin=chef
pkg_version="3.7.4"
pkg_maintainer="The Chef Automate Maintainers <support@chef.io>"
pkg_license=('Artistic-1.0-Perl' 'GPL-2.0')
pkg_source=nosuchfile.tgz
pkg_shasum=7e98a9b975256a4733db1c0e974cad5ad5cb821489323e395ed97bd058e0a90e
pkg_deps=(
core/glibc
core/perl
Expand All @@ -17,20 +15,12 @@ pkg_build_deps=(
core/gcc
core/make
)
pkg_lib_dirs=(lib/perl5/x86_64-linux-thread-multi)
pkg_description="DBD::Pg is a Perl module that works with the DBI module to provide access to PostgreSQL databases."
pkg_upstream_url="http://search.cpan.org/dist/DBD-Pg/"

do_download() {
return 0
}

do_unpack() {
return 0
}

do_verify() {
return 0
do_setup_environment() {
push_buildtime_env PERL5LIB "${pkg_prefix}/lib/perl5/x86_64-linux-thread-multi"
push_runtime_env PERL5LIB "${pkg_prefix}/lib/perl5/x86_64-linux-thread-multi"
}

do_build() {
Expand Down
2 changes: 1 addition & 1 deletion src/nginx/habitat/config/chef_http_lb_common
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
set_by_lua $data_collector_token 'return os.getenv("DATA_COLLECTOR_TOKEN")';
{{~/if}}

access_log /dev/stdout opscode;
access_log {{../cfg.access_log}} opscode;
{{~#if is_ssl}}
ssl on;
ssl_certificate {{../pkg.svc_data_path}}/ca/{{../cfg.server_name}}.cert;
Expand Down
89 changes: 89 additions & 0 deletions src/nginx/habitat/config/mime.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@

types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;

text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;

image/png png;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/svg+xml svg svgz;
image/webp webp;

application/font-woff woff;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.wap.wmlc wmlc;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;

application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;

application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;

audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;

video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}
2 changes: 1 addition & 1 deletion src/nginx/habitat/config/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ http {
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json;

include {{pkgPathFor "chef-server/openresty-noroot"}}/nginx/conf/mime.types;
include {{pkg.svc_config_path}}/mime.types;

## TODO Maybe put this back into a subdir
lua_package_path "{{pkg.svc_config_path}}/?.lua;$prefix/?.lua;;";
Expand Down
9 changes: 5 additions & 4 deletions src/nginx/habitat/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ client_max_body_size = "250m"
# address at which people will be accessing the server.
server_name = "chef-server"

# # SSL protocols and ciphers
# Access log location. For non-dockerized environments, the default of
# "access.log" should be fine, but in dockerized environments this should
# be `/dev/tty` with tty enabled on the container
access_log = "access.log"

# These options provide the current best security with TSLv1
# ssl_protocols = "-ALL +TLSv1"
# ssl_ciphers = "RC4:!MD5"
# # SSL protocols and ciphers

# This might be necessary for auditors that want no MEDIUM security ciphers and
# don't understand BEAST attacks
Expand Down
Loading

0 comments on commit cb86882

Please sign in to comment.