Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
refactor(chef): Removed deployer cookbook
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgon committed May 22, 2018
1 parent 6583433 commit 6f9002c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
11 changes: 5 additions & 6 deletions Dockerfile
@@ -1,15 +1,14 @@
FROM ruby:2.4.1
FROM ruby:2.5

RUN printf "deb http://deb.debian.org/debian testing main\ndeb http://deb.debian.org/debian testing-updates main\ndeb http://security.debian.org testing/updates main" >> /etc/apt/sources.list
RUN apt-get update && \
apt-get install --yes --no-install-recommends apt-transport-https=1.0.* && \
apt-get install --yes --no-install-recommends apt-transport-https && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN echo 'deb https://deb.nodesource.com/node_6.x jessie main' > /etc/apt/sources.list.d/nodesource.list && \
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
apt-get update && \
apt-get install --yes --target-release=jessie --no-install-recommends python-pip python-yaml locales nodejs=6.* build-essential && \
apt-get install --yes --target-release=testing --no-install-recommends git python-sphinx && \
apt-get install --yes --target-release=jessie --no-install-recommends build-essential git locales nodejs python-pip python-setuptools python-sphinx python-yaml && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN gem update --no-document --system
Expand All @@ -19,15 +18,15 @@ RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
RUN locale-gen
ENV LC_ALL en_US.UTF-8

RUN curl -o /tmp/chefdk.deb https://packages.chef.io/files/stable/chefdk/1.3.43/debian/8/chefdk_1.3.43-1_amd64.deb && \
RUN curl -o /tmp/chefdk.deb https://packages.chef.io/files/stable/chefdk/1.6.11/debian/8/chefdk_1.6.11-1_amd64.deb && \
dpkg -i /tmp/chefdk.deb && \
rm -rf /tmp/chefdk.deb

ENV APP_HOME /cookbooks/opsworks_ruby
RUN mkdir -p "$APP_HOME"

RUN gem install bundler
RUN pip install yamllint>=1
RUN pip install yamllint

WORKDIR $APP_HOME

Expand Down
6 changes: 5 additions & 1 deletion attributes/default.rb
@@ -1,7 +1,11 @@
# frozen_string_literal: true

# ruby
# deployer
default['deployer']['user'] = 'deploy'
default['deployer']['group'] = 'deploy'
default['deployer']['home'] = "/home/#{default['deployer']['user']}"

# ruby
default['build-essential']['compile_time'] = true
default['ruby-ng']['ruby_version'] = node['ruby'].try(:[], 'version') || '2.5'
default['nginx']['source']['modules'] = %w[
Expand Down
1 change: 0 additions & 1 deletion metadata.rb
Expand Up @@ -9,7 +9,6 @@
version '1.9.0'
chef_version '~> 12.0' if respond_to?(:chef_version)

depends 'deployer'
depends 'nginx'
depends 'logrotate'
depends 'ruby-ng'
Expand Down
22 changes: 22 additions & 0 deletions recipes/setup.rb
Expand Up @@ -7,6 +7,28 @@

prepare_recipe

# Create deployer user
group node['deployer']['group'] do
gid 5000
end

user node['deployer']['user'] do
comment 'The deployment user'
uid 5000
gid 5000
shell '/bin/bash'
home node['deployer']['home']
supports manage_home: true
end

sudo node['deployer']['user'] do
user node['deployer']['user']
group node['deployer']['group']
commands ['ALL']
host 'ALL'
nopasswd true
end

# Monit and cleanup
if node['platform_family'] == 'debian'
execute 'mkdir -p /etc/monit/conf.d'
Expand Down

0 comments on commit 6f9002c

Please sign in to comment.