Skip to content

Commit

Permalink
Images for testing - still some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Frédéric Mohier authored and mohierf committed Feb 10, 2020
1 parent 23de282 commit 4bd764c
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 28 deletions.
9 changes: 7 additions & 2 deletions docker/README
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# Docker Alignak

To be completed...
## Host / containers shared volume

The *data/alignak* directory is shared between the host system and the running containers.


## Using the makefile

A GNU makefile exists to help for the most common operations with Alignak Docker images.

The Makefile includes the *.env* file existing in the current directory.

Note: If the *.env* file does not exist, running make will copy the default *.env.dist* file to a new *.env* file.

## Using the makefile

```bash

Expand Down
14 changes: 14 additions & 0 deletions docker/data/alignak/etc/alignak.d/extra-alignak.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ _dist_VAR=%(_dist)s/plugins
_dist_RUN=%(_dist)s/run
_dist_LOG=%(_dist)s/log

; Daemons path configuration
; ----------
workdir=%(_dist_RUN)s
logdir=%(_dist_LOG)s
etcdir=%(_dist_ETC)s
bindir=%(_dist_BIN)s
vardir=%(_dist_VAR)s

; Set to try creating the directory if it does not exist
; It will also try to set ownership and permissions for the user account the daemon runs with
; Default is unset
;create_directories=0
create_directories=1

# Allow hosts and hostgroups not in the same realm
forced_realms_hostgroups=False

Expand Down
2 changes: 1 addition & 1 deletion docker/data/alignak/etc/base/objects/contacts/admin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define contact{
# email alignak@localhost
# pager 0600000000

# Minium business impact - All elements
# Minimum business impact - All elements
min_business_impact 0

# Only useful for the UI...
Expand Down
2 changes: 1 addition & 1 deletion docker/data/alignak/etc/base/objects/contacts/guest.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ define contact{

email guest@localhost

# Minium business impact - Only important elements
# Minimum business impact - Only important elements
min_business_impact 3

# Only useful for the UI...
Expand Down
4 changes: 2 additions & 2 deletions docker/data/alignak/etc/base/objects/contacts/notified.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ define contact{
contact_name notified
alias Notified contact

# No notifications for hosts/services
# No notifications for hosts/services
host_notifications_enabled 1
service_notifications_enabled 1
notificationways email
notificationways email
email alignak@localhost

# Minium business impact - All elements
Expand Down
34 changes: 18 additions & 16 deletions docker/data/alignak/etc/base/templates/generic-contact.cfg
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
# Default contact definition
define contact{
name generic-contact
name generic-contact

# No notifications for hosts/services
host_notifications_enabled 0
service_notifications_enabled 0
notificationways log
# No notifications for hosts/services
host_notifications_enabled 0
service_notifications_enabled 0

# Because min_business_impact is set, we must define service_notification_period,...
# else the default created notification ways raise a configuration error!
service_notification_period 24x7
host_notification_period 24x7
host_notification_commands notify-host-by-log
service_notification_commands notify-service-by-log
notificationways log

# Only useful for the UI...
password NOTSET
is_admin 0
can_submit_commands 0
# Because min_business_impact is set, we must define service_notification_period,...
# else the default created notification ways raise a configuration error!
service_notification_period 24x7
host_notification_period 24x7
host_notification_commands notify-host-by-log
service_notification_commands notify-service-by-log

# Only useful for the UI...
# Change this default password!!!
password NOTSET
is_admin 0
can_submit_commands 0

# This to say that it's a template
register 0
register 0
}
10 changes: 10 additions & 0 deletions docker/image-alignak-ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ LABEL maintainer="Frédéric Mohier ([email protected])" \

ENV DEBIAN_FRONTEND noninteractive

# Run as the root user
USER root

RUN apt-get install -y --no-install-recommends \
nginx \
python3-pip \
Expand Down Expand Up @@ -43,6 +46,13 @@ RUN cd /repos && \
pip3 install -r requirements.txt && \
pip3 install .

# Define some environment variables
ENV ALIGNAK_GROUP "alignak"
ENV ALIGNAK_USER "alignak"

# Run as the newly created user
USER $ALIGNAK_USER

# Copy the Nginx global conf
COPY nginx.conf /etc/nginx/
# Copy the Flask Nginx site conf
Expand Down
15 changes: 9 additions & 6 deletions docker/image-alignak/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ ENV ALIGNAK_GROUP "alignak"
ENV ALIGNAK_USER "alignak"

# Create alignak system user/group for Alignak application
# Note that the group is set a gid (1024), this to allow easy sharing with the doker host
# Note that the group is set a gid (1024), this to allow easy sharing with the Docker host
ARG ALIGNAK_SHARE_ID=1024
RUN groupadd --system --gid $ALIGNAK_SHARE_ID $ALIGNAK_GROUP
RUN useradd --system $ALIGNAK_USER --uid $ALIGNAK_SHARE_ID --gid $ALIGNAK_SHARE_ID

ENV ALIGNAK_SHARE_DIR=$ALIGNAK_SHARE_DIR
COPY ./entrypoint.sh /entrypoint.sh
RUN chown $ALIGNAK_USER:$ALIGNAK_GROUP /entrypoint.sh
RUN chmod 500 /entrypoint.sh
# Create the shared directory if it does not exist and set proper credentials
ARG ALIGNAK_SHARE_DIR=/alignak
RUN mkdir -p $ALIGNAK_SHARE_DIR
RUN chown $ALIGNAK_USER:$ALIGNAK_GROUP $ALIGNAK_SHARE_DIR
RUN chmod -R 775 $ALIGNAK_SHARE_DIR

# Run as the newly created user
USER $ALIGNAK_USER

ENTRYPOINT ["/entrypoint.sh"]
# Run the arbiter in check mode for the configuration in the Alignak directory
CMD ["alignak-arbiter", "-V", "-e", "/alignak/etc/alignak.ini" ]

0 comments on commit 4bd764c

Please sign in to comment.