Skip to content

Commit 2012fbe

Browse files
committed
Merge branch 'hotfix/samson-deployment-hotfix'
2 parents 4f084dd + 92da735 commit 2012fbe

File tree

10 files changed

+121
-17
lines changed

10 files changed

+121
-17
lines changed

bin/provision.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ function header() {
346346

347347
# Base
348348
deployConfiguration base/general samson-deployment 'latest'
349+
deployConfiguration base-app/general samson-deployment 'latest'
349350

350351
# Samson deployment
351352
deployConfiguration samson-deployment/general samson-deployment 'latest'

docker/samson-deployment/latest/Dockerfile

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ENV LC_ALL en_US.UTF-8
1414

1515
# Add common scripts (from _localscripts)
1616
ADD scripts.tar /
17+
COPY conf/ /opt/docker/
1718

1819
# Init bootstrap (and install ansible)
1920
RUN export DEBIAN_FRONTEND=noninteractive \
@@ -36,28 +37,40 @@ RUN export DEBIAN_FRONTEND=noninteractive \
3637
# Base
3738
###############################################################################
3839

40+
ENV DOCKER_CONF_HOME /opt/docker/
41+
42+
# Install packages
43+
RUN /usr/local/bin/apt-install \
44+
supervisor \
45+
syslog-ng \
46+
syslog-ng-core \
47+
logrotate \
48+
cron \
49+
wget \
50+
curl \
51+
net-tools \
52+
&& bash /opt/docker/bin/control.sh provision.role.bootstrap webdevops-base \
53+
&& bash /opt/docker/bin/control.sh provision.role.finish.build webdevops-cleanup \
54+
&& bash /opt/docker/bin/bootstrap.sh
55+
56+
###############################################################################
57+
# Base-app
58+
###############################################################################
3959
ENV APPLICATION_USER application
4060
ENV APPLICATION_GROUP application
61+
ENV APPLICATION_PATH /app
4162
ENV APPLICATION_UID 1000
4263
ENV APPLICATION_GID 1000
43-
ENV DOCKER_CONF_HOME /opt/docker/
4464

45-
# Install services
4665
RUN sed -ri 's/(deb.*\/debian jessie main)/\1 contrib non-free /' -- /etc/apt/sources.list \
4766
&& /usr/local/bin/apt-install \
48-
supervisor \
49-
syslog-ng \
50-
syslog-ng-core \
51-
logrotate \
67+
# Install services
5268
openssh-server \
5369
mysql-client \
5470
sqlite \
55-
cron \
5671
dnsmasq \
57-
postfix
58-
59-
# Install common tools
60-
RUN /usr/local/bin/apt-install \
72+
postfix \
73+
# Install common tools
6174
sudo \
6275
zip \
6376
unzip \
@@ -71,12 +84,9 @@ RUN /usr/local/bin/apt-install \
7184
rsync \
7285
git \
7386
nano \
74-
vim
75-
76-
# Deploy scripts/configurations
77-
COPY conf/ /opt/docker/
78-
RUN bash /opt/docker/bin/control.sh provision.role.bootstrap webdevops-base \
79-
&& bash /opt/docker/bin/control.sh provision.role.finish.build webdevops-cleanup \
87+
vim \
88+
&& /usr/local/bin/generate-locales \
89+
&& bash /opt/docker/bin/control.sh provision.role.bootstrap webdevops-base-app \
8090
&& bash /opt/docker/bin/bootstrap.sh
8191

8292
###############################################################################
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
3+
APPLICATION_USER: "{{ lookup('env','APPLICATION_USER') }}"
4+
APPLICATION_GROUP: "{{ lookup('env','APPLICATION_GROUP') }}"
5+
APPLICATION_PATH: "{{ lookup('env','APPLICATION_PATH') }}"
6+
APPLICATION_UID: "{{ lookup('env','APPLICATION_UID') }}"
7+
APPLICATION_GID: "{{ lookup('env','APPLICATION_GID') }}"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
3+
- include: bootstrap/user.yml
4+
- include: bootstrap/application.yml
5+
- include: bootstrap/dnsmasq.yml
6+
- include: bootstrap/postfix.yml
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
3+
- name: Init application directory
4+
file:
5+
path: "/{{ APPLICATION_PATH }}"
6+
state: directory
7+
mode: 0755
8+
owner: "{{ APPLICATION_USER }}"
9+
group: "{{ APPLICATION_GROUP }}"
10+
recurse: yes
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
3+
- name: Configure dnsmasq
4+
lineinfile:
5+
dest: /etc/dnsmasq.conf
6+
regexp: '^[\s]*{{ item.key }}[\s]*='
7+
line: '{{ item.key }}={{ item.value }}'
8+
with_items:
9+
- { key: 'user', value: 'root' }
10+
- { key: 'conf-dir', value: '/etc/dnsmasq.d' }
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
3+
- name: Configure postfix
4+
lineinfile:
5+
dest: /etc/postfix/main.cf
6+
regexp: '^[\s]*{{ item.key }}[\s]*='
7+
line: '{{ item.key }}={{ item.value }}'
8+
with_items:
9+
- { key: 'mydestination', value: '' }
10+
- { key: 'message_size_limit', value: '15240000' }
11+
# Hardening
12+
- { key: 'smtp_use_tls', value: 'yes' }
13+
- { key: 'smtp_tls_security_level', value: 'may' }
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
3+
- name: Move dnsmasq group (Alpine family)
4+
group:
5+
name: dnsmasq
6+
gid: 153
7+
when: ansible_distribution == 'Alpine'
8+
9+
- name: Create application group
10+
group:
11+
name: "{{ APPLICATION_GROUP }}"
12+
gid: "{{ APPLICATION_GID }}"
13+
14+
- name: Create application user
15+
user:
16+
name: "{{ APPLICATION_USER }}"
17+
uid: "{{ APPLICATION_UID }}"
18+
group: "{{ APPLICATION_GROUP }}"
19+
shell: "/bin/bash"
20+
home: "/home/{{ APPLICATION_USER }}"
21+
22+
- name: Init home directory
23+
file:
24+
path: "/home/{{ APPLICATION_USER }}"
25+
state: directory
26+
mode: 0755
27+
owner: "{{ APPLICATION_USER }}"
28+
group: "{{ APPLICATION_GROUP }}"
29+
recurse: yes
30+
31+
- name: Init bashrc
32+
lineinfile:
33+
dest: "/home/{{ APPLICATION_USER }}/.bashrc"
34+
mode: 0770
35+
owner: "{{ APPLICATION_USER }}"
36+
group: "{{ APPLICATION_GROUP }}"
37+
create: yes
38+
regexp: "export TERM=xterm"
39+
line: "export TERM=xterm"
40+
41+
- action: setup
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
3+
- include: bootstrap.yml
4+
tags:
5+
- bootstrap

provisioning/base-app/general/bin/service.d/dnsmasq.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env bash
12

23
## clear dns file
34
echo > /etc/dnsmasq.d/development

0 commit comments

Comments
 (0)