diff --git a/.env.dist b/.env.dist index 32974b1..e1ad631 100644 --- a/.env.dist +++ b/.env.dist @@ -1,3 +1,2 @@ APP=myos DOCKER_SERVICE=cli -ENV=dist diff --git a/ansible/roles/aws-cli/.gitrepo b/ansible/roles/aws-cli/.gitrepo index 2488bff..7422af9 100644 --- a/ansible/roles/aws-cli/.gitrepo +++ b/ansible/roles/aws-cli/.gitrepo @@ -4,7 +4,7 @@ ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme ; [subrepo] - remote = ssh://git@github.com/1001Pharmacies/ansible-aws-cli + remote = ssh://git@github.com/aynicos/ansible-aws-cli branch = master commit = f10e38af3a9b36648576f9850e0d09fcc7a057df parent = 9ee8bfab9d2f5e5591c2e8a3d6f3a03b56b36196 diff --git a/ansible/roles/disks/.gitrepo b/ansible/roles/disks/.gitrepo index 299b0ca..f552e16 100644 --- a/ansible/roles/disks/.gitrepo +++ b/ansible/roles/disks/.gitrepo @@ -4,7 +4,7 @@ ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme ; [subrepo] - remote = ssh://git@github.com/1001Pharmacies/ansible-disks + remote = ssh://git@github.com/aynicos/ansible-disks branch = master commit = c0ac6978d715b461fbf20aca719cd5196bc60645 parent = d01cccd9bab3a63d60ba251e3719767635ccd5d2 diff --git a/ansible/roles/docker/.gitrepo b/ansible/roles/docker/.gitrepo index 3792cb5..4e8f2bc 100644 --- a/ansible/roles/docker/.gitrepo +++ b/ansible/roles/docker/.gitrepo @@ -4,7 +4,7 @@ ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme ; [subrepo] - remote = ssh://git@github.com/1001Pharmacies/ansible-docker + remote = ssh://git@github.com/aynicos/ansible-docker branch = master commit = 6217a899084cba00447195d1873b211462b60d52 parent = 4745dad8cb8a826ee3ac47accda79f96957b5e13 diff --git a/ansible/roles/hosts/.gitrepo b/ansible/roles/hosts/.gitrepo index 6019d10..e68c717 100644 --- a/ansible/roles/hosts/.gitrepo +++ b/ansible/roles/hosts/.gitrepo @@ -4,7 +4,7 @@ ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme ; [subrepo] - remote = ssh://git@github.com/1001Pharmacies/ansible-hosts + remote = ssh://git@github.com/aynicos/ansible-hosts branch = master commit = a495a6dbfae1f3c32f8e968c1ff2b3596ab42f27 parent = 85a259e1f4db43a63c58b4c8fe39b5d5e3b54053 diff --git a/ansible/roles/hosts/templates/Makefile.j2 b/ansible/roles/hosts/templates/Makefile.j2 index e0e159c..960472f 100644 --- a/ansible/roles/hosts/templates/Makefile.j2 +++ b/ansible/roles/hosts/templates/Makefile.j2 @@ -1,4 +1,4 @@ -USER := 1001pharmacies +USER := aynicos APP ?= $(shell hostname -s) CMDS := exec SERVICE ?= php diff --git a/aws/aws.mk b/aws/aws.mk index 0bd2114..82c1096 100644 --- a/aws/aws.mk +++ b/aws/aws.mk @@ -20,25 +20,25 @@ aws-docker-login: aws-ecr-get-login # target aws-ecr-get-login: Exec 'Call aws ecr get-login' .PHONY: aws-ecr-get-login aws-ecr-get-login: - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval docker_login := $(shell $(call aws,ecr get-login --no-include-email --region $(AWS_DEFAULT_REGION)))) - $(eval DRYRUN_IGNORE := FALSE) + $(eval IGNORE_DRYRUN := FALSE) $(RUN) $(docker_login) # target aws-iam-create-role-%: Call aws iam create-role with role-name % and role-policy file aws/policies/%-trust.json .PHONY: aws-iam-create-role-% aws-iam-create-role-%: base docker-build-aws - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval json := $(shell $(call exec,envsubst < aws/policies/$*-trust.json))) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) $(call aws,iam create-role --role-name $* --assume-role-policy-document '$(json)') # target aws-iam-put-role-policy-%: Call aws iam put-role-policy with policy-name % and policy-document file aws/policies/%.json .PHONY: aws-iam-put-role-policy-% aws-iam-put-role-policy-%: base docker-build-aws - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval json := $(shell $(call exec,envsubst < aws/policies/$*.json))) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) $(call aws,iam put-role-policy --role-name $* --policy-name $* --policy-document '$(json)') # target aws-role-create-import-image: Fire aws-iam-create-role-% aws-iam-put-role-policy-% for AWS_VM_IMPORT_ROLE_NAME @@ -49,9 +49,9 @@ aws-role-create-import-image: aws-iam-create-role-$(AWS_VM_IMPORT_ROLE_NAME) aw .PHONY: aws-s3-check-upload aws-s3-check-upload: docker-build-aws aws-s3api-get-head-object-etag $(eval upload := true) - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(if $(AWS_S3_KEY_ETAG),$(if $(filter $(AWS_S3_KEY_ETAG),"$(shell cat $(PACKER_ISO_INFO) |awk '$$1 == "etag:" {print $$2}' 2>/dev/null)"),$(eval upload := false))) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) # target aws-s3-cp: Fire aws-s3-check-upload, Call aws s3 cp PACKER_ISO_FILE s3://AWS_S3_BUCKET/AWS_S3_KEY, Call aws-s3-etag-save target .PHONY: aws-s3-cp @@ -66,25 +66,25 @@ aws-s3-etag-save: docker-build-aws aws-s3api-get-head-object-etag # target aws-s3api-get-head-object-etag: Eval AWS_S3_KEY_ETAG, Echo 'ETag: AWS_S3_KEY_ETAG' .PHONY: aws-s3api-get-head-object-etag aws-s3api-get-head-object-etag: docker-build-aws - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval AWS_S3_KEY_ETAG := $(shell $(call aws,s3api head-object --bucket $(AWS_S3_BUCKET) --key $(AWS_S3_KEY) --output text --query ETag) |grep -v 'operation: Not Found' 2>/dev/null)) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) echo ETag: $(AWS_S3_KEY_ETAG) # target aws-s3api-get-head-object-lastmodified: Eval AWS_S3_KEY_DATE, Echo 'LastModified: AWS_S3_KEY_DATE' .PHONY: aws-s3api-get-head-object-lastmodified aws-s3api-get-head-object-lastmodified: docker-build-aws - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval AWS_S3_KEY_DATE := $(shell $(call aws,s3api head-object --bucket $(AWS_S3_BUCKET) --key $(AWS_S3_KEY) --output text --query LastModified) |grep -v 'operation: Not Found' 2>/dev/null)) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) echo LastModified: $(AWS_S3_KEY_DATE) # target aws-ec2-import-snapshot: Call aws ec2 import-snapshot with S3Bucket AWS_S3_BUCKET and S3Key AWS_S3_KEY .PHONY: aws-ec2-import-snapshot aws-ec2-import-snapshot: base docker-build-aws aws-s3api-get-head-object-etag aws-s3api-get-head-object-lastmodified - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval json := $(shell $(call exec,envsubst < aws/import-snapshot.json))) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) $(eval AWS_TASK_ID := $(shell $(call aws,ec2 import-snapshot --description '$(AWS_SNAP_DESCRIPTION)' --output text --query ImportTaskId --disk-container '$(json)'))) echo ImportTaskId: $(AWS_TASK_ID) @@ -111,17 +111,17 @@ aws-ec2-describe-instances-PrivateIpAddress-%: docker-build-aws # target aws-ec2-get-instances-PrivateIpAddress: Eval AWS_INSTANCE_IP, Echo 'PrivateIpAddress: AWS_INSTANCE_IP' .PHONY: aws-ec2-get-instances-PrivateIpAddress aws-ec2-get-instances-PrivateIpAddress: docker-build-aws - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval AWS_INSTANCE_IP := $(shell $(call aws,ec2 describe-instances --no-paginate --query 'Reservations[*].Instances[*].PrivateIpAddress' --output text) 2>/dev/null)) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) echo PrivateIpAddress: $(AWS_INSTANCE_IP) # target aws-ec2-get-instances-PrivateIpAddress-%: Eval AWS_INSTANCE_IP with Name matching %, Echo 'PrivateIpAddress: AWS_INSTANCE_IP' .PHONY: aws-ec2-get-instances-PrivateIpAddress-% aws-ec2-get-instances-PrivateIpAddress-%: - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval AWS_INSTANCE_IP := $(shell $(call aws,ec2 describe-instances --no-paginate --filter 'Name=tag:Name$(comma)Values=$**' --query 'Reservations[*].Instances[*].PrivateIpAddress' --output text) 2>/dev/null)) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) echo PrivateIpAddress: $(AWS_INSTANCE_IP) # target aws-ec2-get-import-snapshot-tasks-id: Fire aws-ec2-get-import-snapshot-tasks-id-% for AWS_TASK_ID @@ -131,41 +131,41 @@ aws-ec2-get-import-snapshot-tasks-id: aws-ec2-get-import-snapshot-tasks-id-$(AWS # target aws-ec2-get-import-snapshot-tasks-id-%: Eval AWS_SNAP_IP with import-task-ids %, Echo 'SnapshotId: AWS_SNAP_IP' .PHONY: aws-ec2-get-import-snapshot-tasks-id-% aws-ec2-get-import-snapshot-tasks-id-%: docker-build-aws - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval AWS_SNAP_ID := $(shell $(call aws,ec2 describe-import-snapshot-tasks --import-task-ids $* --output text --query ImportSnapshotTasks[0].SnapshotTaskDetail.SnapshotId) 2>/dev/null)) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) echo SnapshotId: $(AWS_SNAP_ID) # target aws-ec2-get-import-snapshot-tasks-message-%: Eval AWS_SNAP_MESSAGE with import-task-ids %, Echo 'StatusMessage: AWS_SNAP_MESSAGE' .PHONY: aws-ec2-get-import-snapshot-tasks-message-% aws-ec2-get-import-snapshot-tasks-message-%: docker-build-aws - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval AWS_SNAP_MESSAGE := $(shell $(call aws,ec2 describe-import-snapshot-tasks --import-task-ids $* --output text --query ImportSnapshotTasks[0].SnapshotTaskDetail.StatusMessage) 2>/dev/null)) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) echo StatusMessage: $(AWS_SNAP_MESSAGE) # target aws-ec2-get-import-snapshot-tasks-progress-%: Eval AWS_SNAP_PROGRESS with import-task-ids %, Echo 'Progress: AWS_SNAP_PROGRESS' .PHONY: aws-ec2-get-import-snapshot-tasks-progress-% aws-ec2-get-import-snapshot-tasks-progress-%: docker-build-aws - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval AWS_SNAP_PROGRESS := $(shell $(call aws,ec2 describe-import-snapshot-tasks --import-task-ids $* --output text --query ImportSnapshotTasks[0].SnapshotTaskDetail.Progress) 2>/dev/null)) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) echo Progress: $(AWS_SNAP_PROGRESS) # target aws-ec2-get-import-snapshot-tasks-size-%: Eval AWS_SNAP_SIZE with import-task-ids %, Echo 'DiskImageSize: AWS_SNAP_SIZE' .PHONY: aws-ec2-get-import-snapshot-tasks-size-% aws-ec2-get-import-snapshot-tasks-size-%: docker-build-aws - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval AWS_SNAP_SIZE := $(shell $(call aws,ec2 describe-import-snapshot-tasks --import-task-ids $* --output text --query ImportSnapshotTasks[0].SnapshotTaskDetail.DiskImageSize) 2>/dev/null)) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) echo DiskImageSize: $(AWS_SNAP_SIZE) # target aws-ec2-get-import-snapshot-tasks-status-%: Eval AWS_SNAP_STATUS with import-task-ids %, Echo 'Status: AWS_SNAP_STATUS' .PHONY: aws-ec2-get-import-snapshot-tasks-status-% aws-ec2-get-import-snapshot-tasks-status-%: docker-build-aws - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval AWS_SNAP_STATUS := $(shell $(call aws,ec2 describe-import-snapshot-tasks --import-task-ids $* --output text --query ImportSnapshotTasks[0].SnapshotTaskDetail.Status) 2>/dev/null)) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) echo Status: $(AWS_SNAP_STATUS) # target aws-ec2-wait-import-snapshot-tasks-status-completed: Fire aws-ec2-wait-import-snapshot-tasks-status-completed-% for AWS_TASK_ID @@ -190,9 +190,9 @@ aws-ec2-wait-snapshot-completed-%: docker-build-aws # target aws-ec2-register-image: Fire aws-ec2-get-import-snapshot-tasks-id, Eval AWS_AMI_ID with Name AWS_AMI_NAME, Echo 'ImageId: AWS_AMI_ID' .PHONY: aws-ec2-register-image aws-ec2-register-image: base docker-build-aws aws-ec2-get-import-snapshot-tasks-id - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval json := $(shell $(call exec,envsubst < aws/register-image-device-mappings.json))) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) $(eval AWS_AMI_ID := $(shell $(call aws,ec2 register-image --name '$(AWS_AMI_NAME)' --description '$(AWS_AMI_DESCRIPTION)' --architecture x86_64 --root-device-name /dev/sda1 --virtualization-type hvm --block-device-mappings '$(json)') 2>/dev/null)) echo ImageId: $(AWS_AMI_ID) diff --git a/docker/alertmanager/Dockerfile b/docker/alertmanager/Dockerfile index 413b189..66f08b5 100644 --- a/docker/alertmanager/Dockerfile +++ b/docker/alertmanager/Dockerfile @@ -1,23 +1,9 @@ FROM quay.io/prometheus/alertmanager:latest as dist -LABEL maintainer "jc.iacono.gm@gmail.com" ARG DOCKER_BUILD_DIR - ARG SLACK_WEBHOOK_ID COPY ${DOCKER_BUILD_DIR}/config.tmpl /etc/alertmanager/config.tmpl RUN sed 's@SLACK_WEBHOOK_ID@'"${SLACK_WEBHOOK_ID:-UNDEFINED}"'@g' /etc/alertmanager/config.tmpl > /etc/alertmanager/alertmanager.yml -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/alertmanager/config.tmpl b/docker/alertmanager/config.tmpl index c43f319..e9f9655 100644 --- a/docker/alertmanager/config.tmpl +++ b/docker/alertmanager/config.tmpl @@ -5,14 +5,14 @@ global: slack_api_url: SLACK_WEBHOOK_ID # The smarthost and SMTP sender used for mail notifications. # smtp_smarthost: 'localhost:25' - # smtp_from: 'alertmanager@1001pharmacies.com' + # smtp_from: 'alertmanager@domain.com' # The root route on which each incoming alert enters. route: # The root route must not have any matchers as it is the entry point for # all alerts. It needs to have a receiver configured so alerts that do not # match any of the sub-routes are sent to someone. - receiver: '1001-slack-default' + receiver: 'slack-default' # The labels by which incoming alerts are grouped together. For example, # multiple alerts coming in for cluster=A and alertname=LatencyHigh would @@ -52,43 +52,43 @@ route: severity: "low" instance: "Hourly GMV" type: "lower than static threshold" - receiver: 1001-slack-gmv-static-low + receiver: slack-gmv-static-low - match: severity: "high" instance: "Hourly GMV" type: "lower than static threshold" - receiver: 1001-slack-gmv-static-high + receiver: slack-gmv-static-high - match: severity: "low" instance: "Hourly GMV" - receiver: 1001-slack-gmv-low + receiver: slack-gmv-low - match: severity: "high" instance: "Hourly GMV" - receiver: 1001-slack-gmv-high + receiver: slack-gmv-high - match: instance: "Hourly GMV test" - receiver: 1001-slack-gmv-low + receiver: slack-gmv-low - match: severity: "low" - receiver: 1001-slack-generic-low + receiver: slack-generic-low - match: severity: "medium" - receiver: 1001-slack-generic-medium + receiver: slack-generic-medium - match: severity: "high" - receiver: 1001-slack-generic-high + receiver: slack-generic-high - match: severity: "critical" - receiver: 1001-slack-generic-critical + receiver: slack-generic-critical # The service has a sub-route for critical alerts, any alerts @@ -140,7 +140,7 @@ inhibit_rules: receivers: -- name: '1001-slack-gmv-static-low' +- name: 'slack-gmv-static-low' slack_configs: - api_url: SLACK_WEBHOOK_ID send_resolved: true @@ -149,7 +149,7 @@ receivers: title: ':mostly_sunny: {{ .Status|toUpper }} issue on [ {{ .CommonLabels.instance }} ]' text: "{{ .CommonAnnotations.description }}" -- name: '1001-slack-gmv-static-high' +- name: 'slack-gmv-static-high' slack_configs: - api_url: SLACK_WEBHOOK_ID send_resolved: true @@ -158,7 +158,7 @@ receivers: title: ':tornado: {{ .Status|toUpper }} issue on [ {{ .CommonLabels.instance }} ]' text: "{{ .CommonAnnotations.description }}" -- name: '1001-slack-gmv-low' +- name: 'slack-gmv-low' slack_configs: - api_url: SLACK_WEBHOOK_ID send_resolved: true @@ -169,7 +169,7 @@ receivers: \n \n{{ .CommonAnnotations.query }}" -- name: '1001-slack-gmv-high' +- name: 'slack-gmv-high' slack_configs: - api_url: SLACK_WEBHOOK_ID send_resolved: true @@ -180,7 +180,7 @@ receivers: \n \n{{ .CommonAnnotations.query }}" -- name: '1001-slack-generic-low' +- name: 'slack-generic-low' slack_configs: - api_url: SLACK_WEBHOOK_ID send_resolved: true @@ -189,7 +189,7 @@ receivers: title: ':mostly_sunny: {{ .Status|toUpper }} issue on [ {{ .CommonLabels.instance }} ]' text: "*{{ .CommonLabels.instance }}* had a *{{ .CommonLabels.type }}* issue for a few seconds." -- name: '1001-slack-generic-medium' +- name: 'slack-generic-medium' slack_configs: - api_url: SLACK_WEBHOOK_ID send_resolved: true @@ -198,7 +198,7 @@ receivers: title: ':sun_behind_rain_cloud: {{ .Status|toUpper }} issue on [ {{ .CommonLabels.instance }} ]' text: "*{{ .CommonLabels.instance }}* had a *{{ .CommonLabels.type }}* issue for more than 5 minutes." -- name: '1001-slack-generic-high' +- name: 'slack-generic-high' slack_configs: - api_url: SLACK_WEBHOOK_ID send_resolved: true @@ -207,7 +207,7 @@ receivers: title: ':tornado: {{ .Status|toUpper }} issue on {{ .CommonLabels.instance }}' text: "*{{ .CommonLabels.instance }}* had a *{{ .CommonLabels.type }}* issue for an hour" -- name: '1001-slack-generic-critical' +- name: 'slack-generic-critical' slack_configs: - api_url: SLACK_WEBHOOK_ID send_resolved: true @@ -216,10 +216,9 @@ receivers: title: ':boom: {{ .Status|toUpper }} issue on {{ .CommonLabels.instance }}' text: "*{{ .CommonLabels.instance }}* had a *{{ .CommonLabels.type }}* issue for more than 12 hours" -- name: '1001-slack-default' +- name: 'slack-default' slack_configs: - api_url: SLACK_WEBHOOK_ID send_resolved: true username: 'Chouette Vigilante [default]' icon_emoji: ':owl:' - diff --git a/docker/ansible/Dockerfile b/docker/ansible/Dockerfile index c021aaf..7da6273 100644 --- a/docker/ansible/Dockerfile +++ b/docker/ansible/Dockerfile @@ -1,6 +1,8 @@ FROM alpine:latest as dist ARG DOCKER_BUILD_DIR +LABEL maintainer aynic.os + RUN apk --no-cache add \ ansible \ py3-pip @@ -10,15 +12,13 @@ RUN pip3 install boto ENTRYPOINT ["/usr/bin/ansible"] CMD ["--help"] -FROM dist as local +FROM dist as master ARG DOCKER_BUILD_DIR ARG UID ARG USER ENV UID=${UID} ENV GID=${UID} ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} # If we provide a numeric UID RUN [ "$UID" -eq "$UID" ] 2>/dev/null \ @@ -41,15 +41,3 @@ RUN [ "$UID" -eq "$UID" ] 2>/dev/null \ || true USER $USER - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR diff --git a/docker/apm-server-oss/Dockerfile b/docker/apm-server-oss/Dockerfile index 37ab569..63bf9a3 100644 --- a/docker/apm-server-oss/Dockerfile +++ b/docker/apm-server-oss/Dockerfile @@ -1,10 +1,8 @@ FROM docker.elastic.co/apm/apm-server-oss:7.4.2 as dist ARG DOCKER_BUILD_DIR -LABEL maintainer 1001Pharmacies - # config COPY ${DOCKER_BUILD_DIR}/apm-server.yml /usr/share/apm-server/ -FROM dist as local +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/aws/Dockerfile b/docker/aws/Dockerfile index 1244099..cf6feb2 100644 --- a/docker/aws/Dockerfile +++ b/docker/aws/Dockerfile @@ -1,6 +1,8 @@ FROM alpine:latest as dist ARG DOCKER_BUILD_DIR +LABEL maintainer aynic.os + RUN apk --no-cache add \ groff \ less \ @@ -12,15 +14,13 @@ RUN apk --no-cache upgrade ENTRYPOINT ["/usr/bin/aws"] CMD ["help"] -FROM dist as local +FROM dist as master ARG DOCKER_BUILD_DIR ARG UID ARG USER ENV UID=${UID} ENV GID=${UID} ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} # If we provide a numeric UID RUN [ "$UID" -eq "$UID" ] 2>/dev/null \ @@ -43,15 +43,3 @@ RUN [ "$UID" -eq "$UID" ] 2>/dev/null \ || true USER $USER - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR diff --git a/docker/blackbox/Dockerfile b/docker/blackbox/Dockerfile index 9f94b44..488fadb 100644 --- a/docker/blackbox/Dockerfile +++ b/docker/blackbox/Dockerfile @@ -3,17 +3,5 @@ ARG DOCKER_BUILD_DIR COPY ${DOCKER_BUILD_DIR}/config.yml /etc/blackbox_exporter/config.yml -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/cli/Dockerfile b/docker/cli/Dockerfile index d258d56..887ea11 100644 --- a/docker/cli/Dockerfile +++ b/docker/cli/Dockerfile @@ -1,15 +1,14 @@ FROM alpine:latest as dist ARG DOCKER_BUILD_DIR +ARG GIT_AUTHOR_NAME +ARG GIT_AUTHOR_EMAIL -LABEL maintainer 1001Pharmacies +LABEL maintainer aynic.os -arg GIT_AUTHOR_NAME -arg GIT_AUTHOR_EMAIL - -env GIT_AUTHOR_NAME=${GIT_AUTHOR_NAME:-1001Pharmacies} -env GIT_AUTHOR_EMAIL=${GIT_AUTHOR_EMAIL:-technique+docker@1001pharmacies.com} -env GIT_COMMITTER_NAME=${GIT_AUTHOR_NAME} -env GIT_COMMITTER_EMAIL=${GIT_AUTHOR_EMAIL} +ENV GIT_AUTHOR_NAME=${GIT_AUTHOR_NAME} +ENV GIT_AUTHOR_EMAIL=${GIT_AUTHOR_EMAIL} +ENV GIT_COMMITTER_NAME=${GIT_AUTHOR_NAME} +ENV GIT_COMMITTER_EMAIL=${GIT_AUTHOR_EMAIL} RUN apk upgrade --no-cache \ && apk add --no-cache \ @@ -37,7 +36,7 @@ RUN git clone https://github.com/ingydotnet/git-subrepo \ CMD ["bash"] -FROM dist as local +FROM dist as master ARG DOCKER_BUILD_DIR ARG DOCKER_GID ARG SHELL=/bin/bash @@ -50,8 +49,6 @@ ARG USER ENV UID=${UID} ENV GID=${UID} ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} # If we provide a numeric UID RUN [ "$UID" -eq "$UID" ] 2>/dev/null \ @@ -124,15 +121,3 @@ RUN mkdir -p ~/.ssh ~/.config/git \ *.swp\n\ Thumbs.db\n\ " > ~/.config/git/ignore - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR diff --git a/docker/consul/Dockerfile b/docker/consul/Dockerfile index 4159ef1..5c5483b 100644 --- a/docker/consul/Dockerfile +++ b/docker/consul/Dockerfile @@ -1,7 +1,7 @@ FROM consul:1.6.1 as dist ARG DOCKER_BUILD_DIR -LABEL maintainer 1001Pharmacies +LABEL maintainer aynic.os # install docker RUN apk add --no-cache bash docker gawk sudo \ @@ -17,17 +17,5 @@ RUN chmod +rx /usr/local/bin/container-check-status /usr/local/bin/container-lis HEALTHCHECK CMD goss -g /tests/goss.yml validate --format tap -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/elastic/apm-server-oss/Dockerfile b/docker/elastic/apm-server-oss/Dockerfile index 419462a..63bf9a3 100644 --- a/docker/elastic/apm-server-oss/Dockerfile +++ b/docker/elastic/apm-server-oss/Dockerfile @@ -1,22 +1,8 @@ FROM docker.elastic.co/apm/apm-server-oss:7.4.2 as dist ARG DOCKER_BUILD_DIR -LABEL maintainer 1001Pharmacies - # config COPY ${DOCKER_BUILD_DIR}/apm-server.yml /usr/share/apm-server/ -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/elastic/apm-server/Dockerfile b/docker/elastic/apm-server/Dockerfile index 3b37d43..f6278ca 100644 --- a/docker/elastic/apm-server/Dockerfile +++ b/docker/elastic/apm-server/Dockerfile @@ -1,22 +1,8 @@ FROM docker.elastic.co/apm/apm-server-oss:7.4.2 as dist ARG DOCKER_BUILD_DIR -LABEL maintainer 1001Pharmacies - # config # COPY ${DOCKER_BUILD_DIR}/apm-server.yml /usr/share/apm-server/ -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/elastic/curator/Dockerfile b/docker/elastic/curator/Dockerfile index eb68cd6..65bfaf7 100644 --- a/docker/elastic/curator/Dockerfile +++ b/docker/elastic/curator/Dockerfile @@ -1,9 +1,9 @@ FROM alpine:latest as dist -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR - ARG CURATOR_VERSION=5.8.3 +LABEL maintainer aynic.os + RUN apk --no-cache add \ bash \ py-pip \ @@ -15,7 +15,7 @@ COPY ${DOCKER_BUILD_DIR}/action.yml /etc/curator/ ENTRYPOINT ["/docker-entrypoint.sh"] -FROM dist as local +FROM dist as master ARG DOCKER_BUILD_DIR # install cronlock @@ -25,18 +25,3 @@ RUN chmod +rx /usr/bin/cronlock # install ssmtp RUN apk --no-cache add ssmtp && \ echo "FromLineOverride=YES" >> /etc/ssmtp/ssmtp.conf - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -COPY build/curator/cronlock.conf /etc/cronlock.conf -COPY build/curator/ssmtp.conf /etc/ssmtp/ssmtp.conf - -FROM preprod as prod -ARG DOCKER_BUILD_DIR diff --git a/docker/es-exporter/Dockerfile b/docker/es-exporter/Dockerfile index 1f68859..c7a5c10 100644 --- a/docker/es-exporter/Dockerfile +++ b/docker/es-exporter/Dockerfile @@ -3,17 +3,5 @@ ARG DOCKER_BUILD_DIR COPY ${DOCKER_BUILD_DIR}/exporter.cfg /usr/src/app -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/goofys/Dockerfile b/docker/goofys/Dockerfile index 2934382..68b20b5 100644 --- a/docker/goofys/Dockerfile +++ b/docker/goofys/Dockerfile @@ -1,9 +1,9 @@ FROM golang:1.12-alpine AS builder -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR - ARG GOOFYS_VERSION=v0.20.0 +LABEL maintainer aynic.os + WORKDIR /go/src/github.com/kahing/goofys/ RUN apk --no-cache upgrade \ @@ -15,6 +15,7 @@ RUN apk --no-cache upgrade \ FROM alpine:latest as dist ARG DOCKER_BUILD_DIR + RUN apk add --no-cache ca-certificates COPY --from=builder /go/bin/goofys /bin/goofys @@ -22,17 +23,5 @@ ENTRYPOINT ["/bin/goofys"] # goofys -f --region $REGION --stat-cache-ttl $STAT_CACHE_TTL --type-cache-ttl $TYPE_CACHE_TTL --dir-mode $DIR_MODE --file-mode $FILE_MODE -o nonempty $BUCKET $MOUNT_DIR -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/grafana/Dockerfile b/docker/grafana/Dockerfile index 608cb5e..94dcd1f 100644 --- a/docker/grafana/Dockerfile +++ b/docker/grafana/Dockerfile @@ -1,13 +1,13 @@ FROM grafana/grafana:latest as dist -LABEL maintainer "jc.iacono.gm@gmail.com" ARG DOCKER_BUILD_DIR - ARG AWS_ACCESS_KEY ARG AWS_SECRET_KEY ARG MYSQL_GRAFANA_USER ARG MYSQL_GRAFANA_PASSWORD ARG MYSQL_GRAFANA_DB +LABEL maintainer aynic.os + COPY ${DOCKER_BUILD_DIR}/config.ini /etc/grafana/config.ini COPY ${DOCKER_BUILD_DIR}/dashboards /etc/grafana/dashboards COPY ${DOCKER_BUILD_DIR}/provisioning /etc/grafana/provisioning @@ -23,17 +23,5 @@ USER grafana ENTRYPOINT ["/docker-entrypoint.sh"] -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/http/alpine/Dockerfile b/docker/http/alpine/Dockerfile index 5c5fc21..1153c26 100644 --- a/docker/http/alpine/Dockerfile +++ b/docker/http/alpine/Dockerfile @@ -1,10 +1,10 @@ FROM httpd:alpine as dist -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR - ARG HTTPD_LOAD_MODULE="env expires headers lbmethod_bybusyness lbmethod_byrequests proxy proxy_balancer proxy_fcgi proxy_http setenvif slotmem_shm reqtimeout rewrite" ARG HTTPD_CONF_EXTRA="default info mpm vhosts" +LABEL maintainer aynic.os + RUN sed -E -i \ -e 's!^#?\s*(LoadModule ('${HTTPD_LOAD_MODULE// /|}')_module modules/mod_('${HTTPD_LOAD_MODULE// /|}').so)\s*!\1!g' \ -e 's!^#?\s*(Include conf/extra/httpd-('${HTTPD_CONF_EXTRA// /|}').conf)\s*!\1!g' \ @@ -21,23 +21,5 @@ CMD /usr/local/bin/consul-template -log-level info -consul-addr consul:8500 -tem EXPOSE 80/tcp -FROM dist as local -ARG UID -ARG USER -ENV UID=${UID} -ENV GID=${UID} -ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/http/alpine/httpd-vhosts.ctmpl b/docker/http/alpine/httpd-vhosts.ctmpl index 4107625..8992c30 100644 --- a/docker/http/alpine/httpd-vhosts.ctmpl +++ b/docker/http/alpine/httpd-vhosts.ctmpl @@ -1,7 +1,7 @@ {{ $serverName := printf "%s.%s.%s" (env "APP") (env "ENV") (env "USER") }} {{ $serviceName := printf "%s-%s-%s-php-9000" (env "USER") (env "ENV") (env "APP") }} - ServerAdmin technique@1001pharmacies.com + ServerAdmin support+apache@asycn.io DocumentRoot "/var/www/web" ServerName {{ $serverName }} ServerAlias * diff --git a/docker/mysql/5.6/Dockerfile b/docker/mysql/5.6/Dockerfile index a4c165c..285145c 100644 --- a/docker/mysql/5.6/Dockerfile +++ b/docker/mysql/5.6/Dockerfile @@ -1,7 +1,7 @@ FROM mysql:5.6.44 as dist ARG DOCKER_BUILD_DIR -LABEL maintainer 1001Pharmacies +LABEL maintainer aynic.os # config COPY ${DOCKER_BUILD_DIR}/conf.d/all.cnf /etc/mysql/conf.d/ @@ -13,20 +13,8 @@ COPY ${DOCKER_BUILD_DIR}/goss.yml /tests/goss.yml HEALTHCHECK CMD goss -g /tests/goss.yml validate --format tap -FROM dist as local +FROM dist as master ARG DOCKER_BUILD_DIR # config -COPY ${DOCKER_BUILD_DIR}/conf.d/local.cnf /etc/mysql/conf.d/ - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR +COPY ${DOCKER_BUILD_DIR}/conf.d/master.cnf /etc/mysql/conf.d/ diff --git a/docker/mysql/5.6/conf.d/local.cnf b/docker/mysql/5.6/conf.d/master.cnf similarity index 100% rename from docker/mysql/5.6/conf.d/local.cnf rename to docker/mysql/5.6/conf.d/master.cnf diff --git a/docker/openstack/Dockerfile b/docker/openstack/Dockerfile index 498dae6..a950fa6 100644 --- a/docker/openstack/Dockerfile +++ b/docker/openstack/Dockerfile @@ -1,6 +1,8 @@ FROM alpine:latest as dist ARG DOCKER_BUILD_DIR +LABEL maintainer aynic.os + RUN apk --no-cache add libffi openssl python3 py3-pip py3-netifaces RUN apk --no-cache add --virtual .build-deps \ @@ -17,15 +19,13 @@ RUN apk --no-cache upgrade ENTRYPOINT ["/usr/bin/openstack"] CMD ["help"] -FROM dist as local +FROM dist as master ARG DOCKER_BUILD_DIR ARG UID ARG USER ENV UID=${UID} ENV GID=${UID} ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} # If we provide a numeric UID RUN [ "$UID" -eq "$UID" ] 2>/dev/null \ @@ -48,15 +48,3 @@ RUN [ "$UID" -eq "$UID" ] 2>/dev/null \ || true USER $USER - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR diff --git a/docker/packer/Dockerfile b/docker/packer/Dockerfile index 36170b1..145b681 100644 --- a/docker/packer/Dockerfile +++ b/docker/packer/Dockerfile @@ -1,7 +1,8 @@ FROM alpine:latest as dist -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR +LABEL maintainer aynic.os + ENV PACKER_VERSION=1.6.6 RUN apk --no-cache add \ @@ -25,15 +26,13 @@ RUN rm -f packer_${PACKER_VERSION}_linux_amd64.zip ENTRYPOINT ["/bin/packer"] -FROM dist as local +FROM dist as master ARG DOCKER_BUILD_DIR ARG UID ARG USER ENV UID=${UID} ENV GID=${UID} ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} # If we provide a specific UID RUN let $UID >/dev/null 2>&1 \ @@ -56,15 +55,3 @@ RUN let $UID >/dev/null 2>&1 \ || true USER $USER - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR diff --git a/docker/pdns-server/.gitrepo b/docker/pdns-server/.gitrepo index a35cfc7..6e2f8e9 100644 --- a/docker/pdns-server/.gitrepo +++ b/docker/pdns-server/.gitrepo @@ -4,7 +4,7 @@ ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme ; [subrepo] - remote = ssh://git@github.com/1001Pharmacies/docker-pdns-server + remote = ssh://git@github.com/aynicos/docker-pdns-server branch = master commit = 6d3c4ce70cbb38d237be757206bfbf082ce2ba3e parent = 9de6b77b0d944fe6efa7b020ba7c2dbbba5df4f8 diff --git a/docker/pdns-server/Dockerfile b/docker/pdns-server/Dockerfile index 264400c..506e938 100644 --- a/docker/pdns-server/Dockerfile +++ b/docker/pdns-server/Dockerfile @@ -1,10 +1,11 @@ FROM alpine:3.11 as dist -LABEL maintainer "yann.autissier@gmail.com" ARG DOCKER_BUILD_DIR ARG VERSION_PDNS_REC=4.2.1 ARG VERSION_PDNS_AUTH=4.2.1 ARG VERSION_PDNS_DNSDIST=1.4.0 +LABEL maintainer aynic.os + RUN apk upgrade --no-cache \ && apk add --no-cache --virtual .build-deps \ autoconf \ @@ -63,17 +64,5 @@ ENTRYPOINT ["/docker-entrypoint.sh"] EXPOSE 53/udp 53/tcp -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/phabricator-daemon/Dockerfile b/docker/phabricator-daemon/Dockerfile index 62f7187..2060d22 100644 --- a/docker/phabricator-daemon/Dockerfile +++ b/docker/phabricator-daemon/Dockerfile @@ -1,5 +1,4 @@ FROM phabricator/daemon:latest as dist -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR RUN apt-get update \ @@ -7,17 +6,5 @@ RUN apt-get update \ openssh-client \ && rm -rf /var/lib/apt/lists/* -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/phabricator/Dockerfile b/docker/phabricator/Dockerfile index f63e9d0..f4a92f0 100644 --- a/docker/phabricator/Dockerfile +++ b/docker/phabricator/Dockerfile @@ -1,22 +1,9 @@ FROM phabricator/phabricator:latest as dist -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR RUN { \ echo 'mysqli.allow_local_infile = 0'; \ } > /usr/local/etc/php/conf.d/mysql.ini -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/php/5.6-fpm-alpine/Dockerfile b/docker/php/5.6-fpm-alpine/Dockerfile index b0c4be0..bd40d02 100644 --- a/docker/php/5.6-fpm-alpine/Dockerfile +++ b/docker/php/5.6-fpm-alpine/Dockerfile @@ -1,7 +1,5 @@ FROM php:5.6-fpm-alpine as dist -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR - ARG AMQP_VERSION=stable ARG APCU_VERSION=4.0.11 ARG BLACKFIRE_VERSION=1.31.0 @@ -20,6 +18,8 @@ ARG TWIG_VERSION=1.35.3 ARG XCACHE_VERSION=3.2.0 ARG XDEBUG_VERSION=2.5.5 +LABEL maintainer aynic.os + RUN apk --no-cache upgrade \ && apk add --no-cache --virtual .build-deps \ $PHPIZE_DEPS \ @@ -203,14 +203,12 @@ WORKDIR /var/www # redirect LOG_STREAM to stdout and start php-fpm with environment variables from .env CMD [ "sh", "-c", "(exec 3<>$LOG_STREAM; cat <&3 >&1 & IFS=$'\n'; exec env $(cat .env 2>/dev/null) php-fpm)" ] -FROM dist as local +FROM dist as master ARG UID ARG USER ENV UID=${UID} ENV GID=${UID} ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} # If we provide a specific UID RUN let $UID >/dev/null 2>&1 \ @@ -236,17 +234,7 @@ RUN chown -R $USER /usr/local/etc/php/conf.d/ USER $USER +ARG SSH_REMOTE_HOSTS + RUN mkdir -p ~/.ssh \ - && ssh-keyscan -t rsa -H github.com >> ~/.ssh/known_hosts - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR + && ssh-keyscan -t rsa -H $SSH_REMOTE_HOSTS >> ~/.ssh/known_hosts diff --git a/docker/php/7.0-fpm-alpine/Dockerfile b/docker/php/7.0-fpm-alpine/Dockerfile index 6187a02..c8313b6 100644 --- a/docker/php/7.0-fpm-alpine/Dockerfile +++ b/docker/php/7.0-fpm-alpine/Dockerfile @@ -1,7 +1,5 @@ FROM php:7.0-fpm-alpine as dist -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR - ARG AMQP_VERSION=stable ARG AST_VERSION=stable ARG APCU_VERSION=stable @@ -27,6 +25,8 @@ ARG XDEBUG_VERSION=2.7.2 ARG XHPROF_VERSION=2.2.0 ARG YAML_VERSION=stable +LABEL maintainer aynic.os + RUN apk --no-cache upgrade \ && apk add --no-cache --virtual .build-deps \ $PHPIZE_DEPS \ @@ -234,14 +234,12 @@ WORKDIR /var/www # redirect LOG_STREAM to stdout and start php-fpm with environment variables from .env CMD [ "sh", "-c", "(exec 3<>$LOG_STREAM; cat <&3 >&1 & IFS=$'\n'; exec env $(cat .env 2>/dev/null) php-fpm)" ] -FROM dist as local +FROM dist as master ARG UID ARG USER ENV UID=${UID} ENV GID=${UID} ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} # If we provide a specific UID RUN let $UID >/dev/null 2>&1 \ @@ -267,17 +265,7 @@ RUN chown -R $USER /usr/local/etc/php/conf.d/ USER $USER +ARG SSH_REMOTE_HOSTS + RUN mkdir -p ~/.ssh \ - && ssh-keyscan -t rsa -H github.com >> ~/.ssh/known_hosts - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR + && ssh-keyscan -t rsa -H $SSH_REMOTE_HOSTS >> ~/.ssh/known_hosts diff --git a/docker/php/7.1-fpm-alpine/Dockerfile b/docker/php/7.1-fpm-alpine/Dockerfile index 87fd667..d8ab522 100644 --- a/docker/php/7.1-fpm-alpine/Dockerfile +++ b/docker/php/7.1-fpm-alpine/Dockerfile @@ -1,7 +1,5 @@ FROM php:7.1-fpm-alpine as dist -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR - ARG AMQP_VERSION=stable ARG AST_VERSION=stable ARG APCU_VERSION=stable @@ -27,6 +25,8 @@ ARG XDEBUG_VERSION=stable ARG XHPROF_VERSION=2.2.0 ARG YAML_VERSION=stable +LABEL maintainer aynic.os + RUN apk --no-cache upgrade \ && apk add --no-cache --virtual .build-deps \ $PHPIZE_DEPS \ @@ -226,14 +226,12 @@ WORKDIR /var/www # redirect LOG_STREAM to stdout and start php-fpm with environment variables from .env CMD [ "sh", "-c", "(exec 3<>$LOG_STREAM; cat <&3 >&1 & IFS=$'\n'; exec env $(cat .env 2>/dev/null) php-fpm)" ] -FROM dist as local +FROM dist as master ARG UID ARG USER ENV UID=${UID} ENV GID=${UID} ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} # If we provide a specific UID RUN let $UID >/dev/null 2>&1 \ @@ -259,17 +257,7 @@ RUN chown -R $USER /usr/local/etc/php/conf.d/ USER $USER +ARG SSH_REMOTE_HOSTS + RUN mkdir -p ~/.ssh \ - && ssh-keyscan -t rsa -H github.com >> ~/.ssh/known_hosts - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR + && ssh-keyscan -t rsa -H $SSH_REMOTE_HOSTS >> ~/.ssh/known_hosts diff --git a/docker/php/7.2-fpm-alpine/Dockerfile b/docker/php/7.2-fpm-alpine/Dockerfile index a8ba89e..dae4a67 100644 --- a/docker/php/7.2-fpm-alpine/Dockerfile +++ b/docker/php/7.2-fpm-alpine/Dockerfile @@ -1,7 +1,5 @@ FROM php:7.2-fpm-alpine as dist -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR - ARG AMQP_VERSION=stable ARG AST_VERSION=stable ARG APCU_VERSION=stable @@ -27,6 +25,8 @@ ARG XDEBUG_VERSION=stable ARG XHPROF_VERSION=2.2.0 ARG YAML_VERSION=stable +LABEL maintainer aynic.os + RUN apk --no-cache upgrade \ && apk add --no-cache --virtual .build-deps \ $PHPIZE_DEPS \ @@ -231,14 +231,12 @@ WORKDIR /var/www # redirect LOG_STREAM to stdout and start php-fpm with environment variables from .env CMD [ "sh", "-c", "(exec 3<>$LOG_STREAM; cat <&3 >&1 & IFS=$'\n'; exec env $(cat .env 2>/dev/null) php-fpm)" ] -FROM dist as local +FROM dist as master ARG UID ARG USER ENV UID=${UID} ENV GID=${UID} ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} # If we provide a specific UID RUN let $UID >/dev/null 2>&1 \ @@ -264,17 +262,7 @@ RUN chown -R $USER /usr/local/etc/php/conf.d/ USER $USER +ARG SSH_REMOTE_HOSTS + RUN mkdir -p ~/.ssh \ - && ssh-keyscan -t rsa -H github.com >> ~/.ssh/known_hosts - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR + && ssh-keyscan -t rsa -H $SSH_REMOTE_HOSTS >> ~/.ssh/known_hosts diff --git a/docker/php/7.3-fpm-alpine/Dockerfile b/docker/php/7.3-fpm-alpine/Dockerfile index 2100cbb..0d09873 100644 --- a/docker/php/7.3-fpm-alpine/Dockerfile +++ b/docker/php/7.3-fpm-alpine/Dockerfile @@ -1,7 +1,5 @@ FROM php:7.3-fpm-alpine as dist -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR - ARG AMQP_VERSION=stable ARG AST_VERSION=stable ARG APCU_VERSION=stable @@ -26,6 +24,8 @@ ARG XDEBUG_VERSION=stable ARG XHPROF_VERSION=2.2.0 ARG YAML_VERSION=stable +LABEL maintainer aynic.os + RUN apk --no-cache upgrade \ && apk add --no-cache --virtual .build-deps \ $PHPIZE_DEPS \ @@ -228,14 +228,12 @@ RUN ln -s /shared /var/www/shared WORKDIR /var/www CMD [ "sh", "-c", "(IFS=$'\n'; exec env $(cat .env 2>/dev/null) php-fpm)" ] -FROM dist as local +FROM dist as master ARG UID ARG USER ENV UID=${UID} ENV GID=${UID} ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} # If we provide a specific UID RUN let $UID >/dev/null 2>&1 \ @@ -261,17 +259,7 @@ RUN chown -R $USER /usr/local/etc/php/conf.d/ USER $USER +ARG SSH_REMOTE_HOSTS + RUN mkdir -p ~/.ssh \ - && ssh-keyscan -t rsa -H github.com >> ~/.ssh/known_hosts - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR + && ssh-keyscan -t rsa -H $SSH_REMOTE_HOSTS >> ~/.ssh/known_hosts diff --git a/docker/prometheus/Dockerfile b/docker/prometheus/Dockerfile index 1ff3641..e555e64 100644 --- a/docker/prometheus/Dockerfile +++ b/docker/prometheus/Dockerfile @@ -1,10 +1,10 @@ FROM quay.io/prometheus/prometheus:latest as dist -LABEL maintainer "jc.iacono.gm@gmail.com" ARG DOCKER_BUILD_DIR - ARG MONITORING_PRIMARY_TARGETS_BLACKBOX ARG MONITORING_SECONDARY_TARGETS_BLACKBOX +LABEL maintainer aynic.os + COPY ${DOCKER_BUILD_DIR}/prometheus.tmpl /etc/prometheus/prometheus.tmpl COPY ${DOCKER_BUILD_DIR}/alert-rules.yml /etc/prometheus/alert-rules.yml @@ -18,17 +18,5 @@ COPY ${DOCKER_BUILD_DIR}/docker-entrypoint.sh / ENTRYPOINT ["/docker-entrypoint.sh"] CMD [] -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/registrator/Dockerfile b/docker/registrator/Dockerfile index 477a00e..3b5d6ed 100644 --- a/docker/registrator/Dockerfile +++ b/docker/registrator/Dockerfile @@ -1,14 +1,14 @@ FROM golang:1.9.4-alpine3.7 AS builder -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR +ARG GIT_AUTHOR_NAME +ARG GIT_AUTHOR_EMAIL -arg GIT_AUTHOR_NAME -arg GIT_AUTHOR_EMAIL +LABEL maintainer aynic.os -env GIT_AUTHOR_NAME=${GIT_AUTHOR_NAME:-1001Pharmacies} -env GIT_AUTHOR_EMAIL=${GIT_AUTHOR_EMAIL:-technique+docker@1001pharmacies.com} -env GIT_COMMITTER_NAME=${GIT_AUTHOR_NAME} -env GIT_COMMITTER_EMAIL=${GIT_AUTHOR_EMAIL} +ENV GIT_AUTHOR_NAME=${GIT_AUTHOR_NAME} +ENV GIT_AUTHOR_EMAIL=${GIT_AUTHOR_EMAIL} +ENV GIT_COMMITTER_NAME=${GIT_AUTHOR_NAME} +ENV GIT_COMMITTER_EMAIL=${GIT_AUTHOR_EMAIL} WORKDIR /go/src/github.com/gliderlabs/registrator/ RUN \ @@ -39,17 +39,5 @@ COPY --from=builder /go/src/github.com/gliderlabs/registrator/bin/registrator /b ENTRYPOINT ["/bin/registrator"] -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/riofs/Dockerfile b/docker/riofs/Dockerfile index 17f6212..079df8a 100644 --- a/docker/riofs/Dockerfile +++ b/docker/riofs/Dockerfile @@ -1,7 +1,8 @@ FROM alpine:latest as dist -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR +LABEL maintainer aynic.os + WORKDIR /usr/src # Install riofs @@ -40,17 +41,5 @@ RUN apk upgrade --no-cache \ ENTRYPOINT /usr/local/bin/riofs -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/s3fs/Dockerfile b/docker/s3fs/Dockerfile index 4a2f5f2..0026530 100644 --- a/docker/s3fs/Dockerfile +++ b/docker/s3fs/Dockerfile @@ -1,9 +1,9 @@ FROM alpine:latest as dist -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR - ARG S3FS_VERSION=v1.85 +LABEL maintainer aynic.os + # Install s3fs-fuse RUN apk --no-cache upgrade \ && apk --no-cache add --virtual .build-deps \ @@ -40,15 +40,13 @@ VOLUME ${S3FS_DIR} COPY ${DOCKER_BUILD_DIR}/docker-entrypoint.sh / ENTRYPOINT /docker-entrypoint.sh -FROM dist as local +FROM dist as master ARG DOCKER_BUILD_DIR ARG UID=0 ARG USER=root ENV UID=${UID} ENV GID=${UID} ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} # If we provide a specific UID RUN let $UID >/dev/null 2>&1 \ @@ -69,15 +67,3 @@ RUN let $UID >/dev/null 2>&1 \ && mkdir -p /home/$USER \ && chown $UID:$GID /home/$USER \ || true - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR diff --git a/docker/sematext/logagent/Dockerfile b/docker/sematext/logagent/Dockerfile index 7f83682..cdb9e8c 100644 --- a/docker/sematext/logagent/Dockerfile +++ b/docker/sematext/logagent/Dockerfile @@ -1,15 +1,14 @@ FROM sematext/logagent:latest as dist ARG DOCKER_BUILD_DIR +ARG GIT_AUTHOR_NAME +ARG GIT_AUTHOR_EMAIL -LABEL maintainer 1001Pharmacies +LABEL maintainer aynic.os -arg GIT_AUTHOR_NAME -arg GIT_AUTHOR_EMAIL - -env GIT_AUTHOR_NAME=${GIT_AUTHOR_NAME:-1001Pharmacies} -env GIT_AUTHOR_EMAIL=${GIT_AUTHOR_EMAIL:-technique+docker@1001pharmacies.com} -env GIT_COMMITTER_NAME=${GIT_AUTHOR_NAME} -env GIT_COMMITTER_EMAIL=${GIT_AUTHOR_EMAIL} +ENV GIT_AUTHOR_NAME=${GIT_AUTHOR_NAME} +ENV GIT_AUTHOR_EMAIL=${GIT_AUTHOR_EMAIL} +ENV GIT_COMMITTER_NAME=${GIT_AUTHOR_NAME} +ENV GIT_COMMITTER_EMAIL=${GIT_AUTHOR_EMAIL} RUN apk add --no-cache \ git @@ -21,17 +20,5 @@ RUN cd / \ && git rebase d168bd0e8745a077e962248741f6be9fbeb7a8b5 \ && git stash pop -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/ssh/Dockerfile b/docker/ssh/Dockerfile index d7df676..d09e576 100644 --- a/docker/ssh/Dockerfile +++ b/docker/ssh/Dockerfile @@ -1,7 +1,7 @@ FROM alpine:latest as dist ARG DOCKER_BUILD_DIR -LABEL maintainer 1001Pharmacies +LABEL maintainer aynic.os # Install dependencies RUN apk add --no-cache \ @@ -22,7 +22,7 @@ ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["ssh-agent"] -FROM dist as local +FROM dist as master ARG DOCKER_BUILD_DIR ARG UID ARG GID @@ -30,8 +30,6 @@ ARG USER ENV UID=${UID} ENV GID=${UID} ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} # If we provide a specific UID RUN let $UID >/dev/null 2>&1 \ @@ -54,15 +52,3 @@ RUN let $UID >/dev/null 2>&1 \ || true USER $USER - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR diff --git a/docker/terraform/Dockerfile b/docker/terraform/Dockerfile index a03b61a..db18985 100644 --- a/docker/terraform/Dockerfile +++ b/docker/terraform/Dockerfile @@ -1,17 +1,17 @@ FROM hashicorp/terraform:light as dist ARG DOCKER_BUILD_DIR +LABEL maintainer aynic.os + RUN apk --no-cache upgrade -FROM dist as local +FROM dist as master ARG DOCKER_BUILD_DIR ARG UID ARG USER ENV UID=${UID} ENV GID=${UID} ENV USER=${USER} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.user=${USER} # If we provide a numeric UID RUN [ "$UID" -eq "$UID" ] 2>/dev/null \ @@ -34,15 +34,3 @@ RUN [ "$UID" -eq "$UID" ] 2>/dev/null \ || true USER $USER - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR diff --git a/docker/theia/.tmux/sessions/aws-preprod b/docker/theia/.tmux/sessions/aws-preprod index 1d57b12..dced4b0 100644 --- a/docker/theia/.tmux/sessions/aws-preprod +++ b/docker/theia/.tmux/sessions/aws-preprod @@ -1,3 +1,2 @@ new-session -A -s aws-preprod -run-shell "ssh sshuser@ssh-bastion make list-nodes |sed '1d' |awk '$1 ~ /^enovasante.aws-eu-west-1.web.(preprod.[a-z]+-[0-9a-z]+|[a-z]+pp-[0-9a-z]+)$/' |while read host ip; do type=\${host#*web.}; type=\${type#*preprod.}; type=\${type#*preprod-}; num=\$(printf '%0d' \${ip}); num=\$(echo \${ip} | tr . '\n' | awk '{n = n*256 + $1} END{print n}'); tmux neww -t aws-preprod:\$num -n \$type '/bin/bash -cli \"force ssh -Aqt ssh-bastion ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no 'enovadmin@\$ip'\"'; done" -run-shell "ssh sshuser@ssh-bastion make list-nodes |sed '1d' |awk '$1 ~ /^1001pharmacies\.preprod\.[0-9a-z]+$/' |while read host ip; do type=\${host#*preprod.}; num=\$(printf '%0d' \${ip}); num=\$(echo \${ip} | tr . '\n' | awk '{n = n*256 + $1} END{print n}'); tmux neww -t aws-preprod:\$num -n \$type '/bin/bash -cli \"force ssh -Aqt ssh-bastion ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no 'root@\$ip'\"'; done" +run-shell "ssh sshuser@ssh-bastion make list-nodes |sed '1d' |awk '$1 ~ /^aws\.preprod\.[0-9a-z]+$/' |while read host ip; do type=\${host#*preprod.}; num=\$(printf '%0d' \${ip}); num=\$(echo \${ip} | tr . '\n' | awk '{n = n*256 + $1} END{print n}'); tmux neww -t aws-preprod:\$num -n \$type '/bin/bash -cli \"force ssh -Aqt ssh-bastion ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no 'root@\$ip'\"'; done" diff --git a/docker/theia/.tmux/sessions/aws-prod b/docker/theia/.tmux/sessions/aws-prod index 4c6c088..736976c 100644 --- a/docker/theia/.tmux/sessions/aws-prod +++ b/docker/theia/.tmux/sessions/aws-prod @@ -1,3 +1,2 @@ new-session -A -s aws-prod -run-shell "ssh sshuser@ssh-bastion make list-nodes |sed '1d' |awk '$1 ~ /^1001pharmacies\.prod\.[0-9a-z]+$/' |while read host ip; do type=\${host#*prod.}; num=\$(printf '%0d' \${ip}); num=\$(echo \${ip} | tr . '\n' | awk '{n = n*256 + $1} END{print n}'); tmux neww -t aws-prod:\$num -n \$type '/bin/bash -cli \"force ssh -Aqt ssh-bastion ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no 'root@\$ip'\"'; done" -run-shell "ssh sshuser@ssh-bastion make list-nodes |sed '1d' |awk '$1 ~ /enovasante.aws-eu-west-1.web.[a-z]+[^pp]-[0-9a-z]+$/' |while read host ip; do type=\${host#*web.}; num=\$(printf '%0d' \${ip}); num=\$(echo \${ip} | tr . '\n' | awk '{n = n*256 + $1} END{print n}'); tmux neww -t aws-prod:\$num -n \$type '/bin/bash -cli \"force ssh -Aqt ssh-bastion ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no 'enovadmin@\$ip'\"'; done" +run-shell "ssh sshuser@ssh-bastion make list-nodes |sed '1d' |awk '$1 ~ /^aws\.prod\.[0-9a-z]+$/' |while read host ip; do type=\${host#*prod.}; num=\$(printf '%0d' \${ip}); num=\$(echo \${ip} | tr . '\n' | awk '{n = n*256 + $1} END{print n}'); tmux neww -t aws-prod:\$num -n \$type '/bin/bash -cli \"force ssh -Aqt ssh-bastion ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no 'root@\$ip'\"'; done" diff --git a/docker/theia/Dockerfile b/docker/theia/Dockerfile index 74748d4..91be08a 100644 --- a/docker/theia/Dockerfile +++ b/docker/theia/Dockerfile @@ -1,8 +1,9 @@ FROM ubuntu:18.04 as dist -LABEL maintainer 1001Pharmacies ARG DOCKER_BUILD_DIR # https://github.com/theia-ide/theia-apps/blob/master/theia-full-docker/Dockerfile +LABEL maintainer aynic.os + ENV DEBIAN_FRONTEND noninteractive #Common deps @@ -157,7 +158,7 @@ RUN apt-get install -y \ ## Common tools RUN apt-get -y install nano screen tig tmux vim-nox zsh -FROM dist as local +FROM dist as master ARG DOCKER_BUILD_DIR ARG DOCKER_GID ARG SHELL=/bin/bash @@ -171,9 +172,6 @@ ARG USER ENV UID=${UID} ENV GID=${GID:-${UID}} ENV USER=${USER:-root} -LABEL com.1001pharmacies.uid=${UID} -LABEL com.1001pharmacies.gid=${GID} -LABEL com.1001pharmacies.user=${USER} # If we provide a numeric UID RUN [ "$UID" -eq "$UID" ] 2>/dev/null \ @@ -258,8 +256,8 @@ COPY ${DOCKER_BUILD_DIR}/.tmux /home/$USER/.tmux/ ARG GIT_AUTHOR_NAME ARG GIT_AUTHOR_EMAIL -ENV GIT_AUTHOR_NAME=${GIT_AUTHOR_NAME:-1001Pharmacies} -ENV GIT_AUTHOR_EMAIL=${GIT_AUTHOR_EMAIL:-technique+docker@1001pharmacies.com} +ENV GIT_AUTHOR_NAME=${GIT_AUTHOR_NAME} +ENV GIT_AUTHOR_EMAIL=${GIT_AUTHOR_EMAIL} ENV GIT_COMMITTER_NAME=${GIT_AUTHOR_NAME} ENV GIT_COMMITTER_EMAIL=${GIT_AUTHOR_EMAIL} @@ -268,15 +266,3 @@ ENV WORKSPACE_DIR=/Sources ENTRYPOINT yarn theia start $WORKSPACE_DIR --hostname=0.0.0.0 EXPOSE 3000 - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod -ARG DOCKER_BUILD_DIR diff --git a/docker/toggle/ui/config.js b/docker/toggle/ui/config.js index e054355..5f3dbef 100644 --- a/docker/toggle/ui/config.js +++ b/docker/toggle/ui/config.js @@ -1 +1 @@ -toggleApp.constant('TOGGLE_API_BASE_URL', 'http://toggle-api.local.1001pharmacies.com'); +toggleApp.constant('TOGGLE_API_BASE_URL', 'http://toggle-api.master.localhost'); diff --git a/docker/vsftpd-s3/.gitrepo b/docker/vsftpd-s3/.gitrepo index bea2645..3525777 100644 --- a/docker/vsftpd-s3/.gitrepo +++ b/docker/vsftpd-s3/.gitrepo @@ -4,7 +4,7 @@ ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme ; [subrepo] - remote = ssh://git@github.com/1001Pharmacies/docker-vsftpd-s3 + remote = ssh://git@github.com/aynicos/docker-vsftpd-s3 branch = master commit = 6d5b3310525d8cb1be32f0461a8633aba8641b24 parent = 162fd1a1c05971c62996f6be53522c74559f567b diff --git a/docker/vsftpd-s3/Dockerfile b/docker/vsftpd-s3/Dockerfile index 5ac0da7..b5f5f5f 100644 --- a/docker/vsftpd-s3/Dockerfile +++ b/docker/vsftpd-s3/Dockerfile @@ -1,9 +1,9 @@ FROM alpine:3.11 as dist -LABEL maintainer "yann.autissier@gmail.com" ARG DOCKER_BUILD_DIR - ARG S3FS_VERSION=v1.85 +LABEL maintainer aynic.os + # Install s3fs-fuse and sftpserver RUN apk --no-cache upgrade \ && apk --no-cache add --virtual .build-deps \ @@ -53,17 +53,5 @@ EXPOSE 1022/tcp EXPOSE 65000/tcp VOLUME ["/var/log"] -FROM dist as local -ARG DOCKER_BUILD_DIR - -FROM local as debug -ARG DOCKER_BUILD_DIR - -FROM local as tests -ARG DOCKER_BUILD_DIR - -FROM tests as preprod -ARG DOCKER_BUILD_DIR - -FROM preprod as prod +FROM dist as master ARG DOCKER_BUILD_DIR diff --git a/docker/vsftpd-s3/LICENSE b/docker/vsftpd-s3/LICENSE index 622cb91..b8f727e 100644 --- a/docker/vsftpd-s3/LICENSE +++ b/docker/vsftpd-s3/LICENSE @@ -1,7 +1,5 @@ MIT License -Copyright (c) 2017 1001Pharmacies - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to diff --git a/docker/vsftpd-s3/docker-entrypoint.sh b/docker/vsftpd-s3/docker-entrypoint.sh index 66a21a1..cd7164a 100755 --- a/docker/vsftpd-s3/docker-entrypoint.sh +++ b/docker/vsftpd-s3/docker-entrypoint.sh @@ -10,7 +10,7 @@ PASV_MIN_PORT=${PASV_MIN_PORT:-65000} PASV_MAX_PORT=${PASV_MAX_PORT:-65535} # VSFTPD Banner -FTPD_BANNER=${FTPD_BANNER:-1001Pharmacies FTP Server} +FTPD_BANNER=${FTPD_BANNER:-FTP Server} # FTP allowed commands # full command list : https://blog.vigilcode.com/2011/08/configure-secure-ftp-with-vsftpd/ @@ -39,11 +39,11 @@ pasv_max_port=$PASV_MAX_PORT" > /etc/vsftpd.conf # SSL certificate SSL_CERT_C=${SSL_CERT_C:-FR} -SSL_CERT_ST=${SSL_CERT_ST:-Herault} -SSL_CERT_L=${SSL_CERT_L:-Montpellier} -SSL_CERT_O=${SSL_CERT_O:-1001Pharmacies} +SSL_CERT_ST=${SSL_CERT_ST:-LaGaule} +SSL_CERT_L=${SSL_CERT_L:-Mars} +SSL_CERT_O=${SSL_CERT_O:-1nation} SSL_CERT_OU=${SSL_CERT_OU:-Hosting} -SSL_CERT_CN=${SSL_CERT_CN:-ftp.1001pharmacies.com} +SSL_CERT_CN=${SSL_CERT_CN:-ftp} # Create SSL certificate openssl req -x509 -nodes -days 365 -newkey rsa:2048 -addext extendedKeyUsage=serverAuth -addext subjectAltName=DNS:${SSL_CERT_CN} -subj "/C=${SSL_CERT_C}/ST=${SSL_CERT_ST}/L=${SSL_CERT_L}/O=${SSL_CERT_O}/OU=${SSL_CERT_OU}/CN=${SSL_CERT_CN}" -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem 2>/dev/null && echo " diff --git a/make/apps/build.mk b/make/apps/build.mk index 0692daf..bc6fefb 100644 --- a/make/apps/build.mk +++ b/make/apps/build.mk @@ -1,7 +1,7 @@ ## # BUILD -# target build-env: Build .env file in docker SERVICE to deploy +# target build-env: Build .env file in docker SERVICE # on local host .PHONY: build-env build-env: SERVICE ?= $(DOCKER_SERVICE) @@ -10,9 +10,6 @@ build-env: bootstrap rm -f .env \ && make .env ENV=$(ENV) \ && echo BUILD=true >> .env \ - && echo BUILD_DATE='"\'"'$(shell date "+%d/%m/%Y %H:%M:%S %z" 2>/dev/null)'"\'"' >> .env \ - && echo BUILD_STATUS='"\'"'$(shell git status -uno --porcelain 2>/dev/null)'"\'"' >> .env \ - && echo DOCKER=false >> .env \ && $(foreach var,$(BUILD_ENV_VARS), \ $(if $($(var)),sed -i '/^$(var)=/d' .env && echo $(var)='$($(var))' >> .env &&) \ ) true \ @@ -24,7 +21,7 @@ build-env: bootstrap build-init: $(RUN) rm -rf build && $(RUN) mkdir -p build -# target build-shared: Create SHARED folder in docker SERVICE to deploy +# target build-shared: Create SHARED folder in docker SERVICE # on local host .PHONY: build-shared build-shared: SERVICE ?= $(DOCKER_SERVICE) diff --git a/make/apps/common.mk b/make/apps/common.mk index 00cfabb..5114225 100644 --- a/make/apps/common.mk +++ b/make/apps/common.mk @@ -29,7 +29,7 @@ bootstrap-git-%: .PHONY: build build: docker-compose-build ## Build application docker images -# target build@%: Build application docker images to deploy of % ENV +# target build@%: Build application docker images of % ENV # on local host .PHONY: build@% app-build build@%: myos-base @@ -47,13 +47,12 @@ build@%: myos-base # target clean: Clean application and docker images # on local host .PHONY: clean app-clean -clean: app-clean docker-compose-down .env-clean ## Clean application and docker images +clean: app-clean docker-rm docker-image-rm docker-volume-rm .env-clean ## Clean application and docker stuffs # target clean@%: Clean deployed application and docker images of % ENV # on local host .PHONY: clean@% -clean@%: - $(call make,docker-compose-down DOCKER_COMPOSE_DOWN_OPTIONS='--rmi all -v') +clean@%: docker-rm docker-image-rm docker-volume-rm; # target config: View application docker compose file # on local host diff --git a/make/apps/def.build.mk b/make/apps/def.build.mk new file mode 100644 index 0000000..28e3b08 --- /dev/null +++ b/make/apps/def.build.mk @@ -0,0 +1,49 @@ +BUILD_AUTHOR ?= $(DOCKER_AUTHOR) +BUILD_DATE ?= $(shell TZ=UTC date "+%d/%m/%YT%H:%M:%SZ" 2>/dev/null) +BUILD_DESCRIPTION ?= Lot of Love +BUILD_DOCUMENTATION ?= $(if $(wildcard README.md),$(APP_REPOSITORY)/blob/$(COMMIT)/README.md) +BUILD_ENV_VARS ?= APP BRANCH BUILD_DATE BUILD_STATUS COMMIT DEPLOY_HOOK_URL ENV VERSION +BUILD_LABEL_VARS ?= org.label-schema.% org.opencontainers.% os.my.% +BUILD_LABEL_ARGS ?= $(foreach var,$(filter $(BUILD_LABEL_VARS),$(MAKE_FILE_VARS)),$(if $($(var)),$(var)='$($(var))')) +BUILD_LICENSE ?= GPL-3.0 +BUILD_NAME ?= $(COMPOSE_SERVICE_NAME)-$(BUILD_SERVICE) +BUILD_SERVICE ?= undef +BUILD_STATUS ?= $(shell git status -uno --porcelain 2>/dev/null) + +org.label-schema.build-date ?= $(BUILD_DATE) +org.label-schema.description ?= $(BUILD_DESCRIPTION) +org.label-schema.docker.cmd ?= docker run -d $(DOCKER_REGISTRY)/$(DOCKER_REPOSITORY)/$(BUILD_SERVICE):$(DOCKER_IMAGE_TAG) +org.label-schema.license ?= GPLv3 +org.label-schema.name ?= $(BUILD_NAME) +org.label-schema.schema-version ?= 1.0 +org.label-schema.url ?= $(APP_URL) +org.label-schema.usage ?= $(BUILD_DOCUMENTATION) +org.label-schema.vcs-ref ?= $(COMMIT) +org.label-schema.vcs-url ?= $(APP_REPOSITORY) +org.label-schema.vendor ?= $(BUILD_AUTHOR) +org.label-schema.version ?= $(VERSION) +org.opencontainers.image.created ?= $(BUILD_DATE) +org.opencontainers.image.revision ?= $(COMMIT) +org.opencontainers.image.source ?= $(APP_REPOSITORY) +org.opencontainers.image.url ?= $(APP_URL) +org.opencontainers.image.vendor ?= $(BUILD_AUTHOR) +org.opencontainers.image.version ?= $(VERSION) +org.opencontainers.image.url ?= $(APP_URL) +org.opencontainers.image.source ?= $(APP_REPOSITORY) +org.opencontainers.image.version ?= $(VERSION) +org.opencontainers.image.revision ?= $(COMMIT) +org.opencontainers.image.vendor ?= $(BUILD_AUTHOR) +org.opencontainers.image.title ?= $(BUILD_NAME) +org.opencontainers.image.description ?= $(BUILD_DESCRIPTION) +org.opencontainers.image.documentation ?= $(BUILD_DOCUMENTATION) +org.opencontainers.build_tool.revision ?= $(MYOS_COMMIT) +org.opencontainers.build_tool.source ?= $(MYOS_REPOSITORY) +org.opencontainers.image.authors ?= $(BUILD_AUTHOR) +org.opencontainers.image.licenses ?= $(BUILD_LICENSE) +os.my.author ?= $(BUILD_AUTHOR) +os.my.date ?= $(BUILD_DATE) +os.my.name ?= $(BUILD_NAME) +os.my.status ?= $(BUILD_STATUS) +os.my.user ?= $(USER) +os.my.uid ?= $(UID) +os.my.version ?= $(VERSION) diff --git a/make/apps/def.docker.mk b/make/apps/def.docker.mk index 100363b..c65893a 100644 --- a/make/apps/def.docker.mk +++ b/make/apps/def.docker.mk @@ -1,7 +1,7 @@ CMDS += docker-compose-exec docker-run docker-run-% COMPOSE_FILE ?= $(wildcard docker/docker-compose.yml $(foreach file,$(patsubst docker/docker-compose.%,%,$(basename $(wildcard docker/docker-compose.*.yml))),$(if $(filter true,$(COMPOSE_FILE_$(file)) $(COMPOSE_FILE_$(call UPPERCASE,$(file)))),docker/docker-compose.$(file).yml))) COMPOSE_FILE_$(ENV) ?= true -COMPOSE_FILE_DEBUG ?= $(DEBUG) +COMPOSE_FILE_DEBUG ?= $(if $(DEBUG),true) COMPOSE_FILE_NFS ?= $(MOUNT_NFS) COMPOSE_FILE_SSH ?= true ifneq ($(SUBREPO),) @@ -17,15 +17,19 @@ endif COMPOSE_IGNORE_ORPHANS ?= false COMPOSE_PROJECT_NAME ?= $(USER)_$(ENV)_$(APP) COMPOSE_SERVICE_NAME ?= $(subst _,-,$(COMPOSE_PROJECT_NAME)) -CONTEXT += COMPOSE_FILE DOCKER_IMAGE_TAG DOCKER_REPOSITORY -CONTEXT_DEBUG += DOCKER_REGISTRY -DOCKER_BUILD_ARGS ?= $(if $(filter $(DOCKER_BUILD_NO_CACHE),true),--pull --no-cache) $(foreach var,$(DOCKER_BUILD_VARS),$(if $($(var)),--build-arg $(var)='$($(var))')) +CONTEXT += COMPOSE_FILE DOCKER_REPOSITORY +CONTEXT_DEBUG += DOCKER_BUILD_TARGET DOCKER_IMAGE_TAG DOCKER_REGISTRY DOCKER_SERVICE DOCKER_SERVICES +DOCKER_AUTHOR ?= $(DOCKER_AUTHOR_NAME) <$(DOCKER_AUTHOR_EMAIL)> +DOCKER_AUTHOR_EMAIL ?= $(subst +git,+docker,$(GIT_AUTHOR_EMAIL)) +DOCKER_AUTHOR_NAME ?= $(GIT_AUTHOR_NAME) +DOCKER_BUILD_ARGS ?= $(if $(filter true,$(DOCKER_BUILD_NO_CACHE)),--pull --no-cache) $(foreach var,$(DOCKER_BUILD_VARS),$(if $($(var)),--build-arg $(var)='$($(var))')) DOCKER_BUILD_CACHE ?= true +DOCKER_BUILD_LABEL ?= $(foreach var,$(filter $(BUILD_LABEL_VARS),$(MAKE_FILE_VARS)),$(if $($(var)),--label $(var)='$($(var))')) DOCKER_BUILD_NO_CACHE ?= false DOCKER_BUILD_TARGET ?= $(if $(filter $(ENV),$(DOCKER_BUILD_TARGETS)),$(ENV),$(DOCKER_BUILD_TARGET_DEFAULT)) -DOCKER_BUILD_TARGET_DEFAULT ?= local -DOCKER_BUILD_TARGETS ?= local debug tests preprod prod -DOCKER_BUILD_VARS ?= APP BRANCH DOCKER_GID DOCKER_REPOSITORY GID GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME TARGET UID USER VERSION +DOCKER_BUILD_TARGET_DEFAULT ?= master +DOCKER_BUILD_TARGETS ?= $(ENV_DEPLOY) +DOCKER_BUILD_VARS ?= APP BRANCH DOCKER_GID DOCKER_REPOSITORY GID GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME SSH_REMOTE_HOSTS TARGET UID USER VERSION DOCKER_COMPOSE_DOWN_OPTIONS ?= DOCKER_COMPOSE_UP_OPTIONS ?= -d DOCKER_GID ?= $(call gid,docker) @@ -43,8 +47,8 @@ DOCKER_REGISTRY ?= registry DOCKER_REGISTRY_USERNAME ?= $(USER) DOCKER_REGISTRY_REPOSITORY ?= $(addsuffix /,$(DOCKER_REGISTRY))$(subst $(USER),$(DOCKER_REGISTRY_USERNAME),$(DOCKER_REPOSITORY)) DOCKER_REPOSITORY ?= $(subst _,/,$(COMPOSE_PROJECT_NAME)) -DOCKER_SERVICE ?= $(shell $(call docker-compose,--log-level critical config --services) |tail -1) -DOCKER_SERVICES ?= $(eval DRYRUN_IGNORE := true) $(shell $(call docker-compose,--log-level critical config --services)) $(eval DRYRUN_IGNORE := false) +DOCKER_SERVICE ?= $(lastword $(DOCKER_SERVICES)) +DOCKER_SERVICES ?= $(eval IGNORE_DRYRUN := true)$(eval IGNORE_VERBOSE := true)$(shell $(call docker-compose,--log-level critical config --services))$(eval IGNORE_DRYRUN := false)$(eval IGNORE_VERBOSE := false) DOCKER_SHELL ?= $(SHELL) ENV_VARS += COMPOSE_PROJECT_NAME COMPOSE_SERVICE_NAME DOCKER_BUILD_TARGET DOCKER_GID DOCKER_IMAGE_TAG DOCKER_REGISTRY DOCKER_REPOSITORY DOCKER_SHELL @@ -105,8 +109,8 @@ define docker-build $(eval tag := $(or $(2),$(DOCKER_REPOSITORY)/$(lastword $(subst /, ,$(path))):$(DOCKER_IMAGE_TAG))) $(eval target := $(subst ",,$(subst ',,$(or $(3),$(DOCKER_BUILD_TARGET))))) $(eval image_id := $(shell docker images -q $(tag) 2>/dev/null)) - $(eval build_image := $(or $(filter $(DOCKER_BUILD_CACHE),false),$(if $(image_id),,true))) - $(if $(build_image),$(RUN) docker build $(DOCKER_BUILD_ARGS) --build-arg DOCKER_BUILD_DIR="$(path)" --tag $(tag) $(if $(target),--target $(target)) -f $(path)/Dockerfile .,$(if $(VERBOSE),echo "docker image $(tag) has id $(image_id)",true)) + $(eval build_image := $(or $(filter false,$(DOCKER_BUILD_CACHE)),$(if $(image_id),,true))) + $(if $(build_image),$(RUN) docker build $(DOCKER_BUILD_ARGS) --build-arg DOCKER_BUILD_DIR="$(path)" $(DOCKER_BUILD_LABEL) --tag $(tag) $(if $(target),--target $(target)) -f $(path)/Dockerfile .,$(if $(VERBOSE),echo "docker image $(tag) has id $(image_id)",true)) endef # function docker-commit: Commit docker image define docker-commit @@ -153,6 +157,7 @@ define docker-stack-update $(eval version := $(or $(2),$(if $(findstring :,$(stack)),$(lastword $(subst :, ,$(stack))),latest))) $(eval path := $(patsubst %/,%,$(or $(3),$(if $(findstring /,$(1)),$(if $(wildcard stack/$(1) stack/$(1).yml),stack/$(if $(findstring .yml,$(1)),$(dir $(1)),$(if $(wildcard stack/$(1).yml),$(dir $(1)),$(1))),$(dir $(1)))),stack/$(name)))) $(eval COMPOSE_FILE += $(wildcard $(path)/$(name).yml $(path)/$(name).$(ENV).yml $(path)/$(name).$(ENV).$(version).yml $(path)/$(name).$(version).yml)) + $(eval COMPOSE_FILE := $(strip $(COMPOSE_FILE))) $(if $(wildcard $(path)/.env.dist),$(call .env,,$(path)/.env.dist,$(wildcard $(CONFIG)/$(ENV)/$(APP)/.env $(path)/.env.$(ENV) .env))) endef # function docker-tag: Tag docker image diff --git a/make/apps/def.mk b/make/apps/def.mk index 73fe242..90c610b 100644 --- a/make/apps/def.mk +++ b/make/apps/def.mk @@ -11,9 +11,8 @@ APP_SCHEME ?= https APP_UPSTREAM_REPOSITORY ?= $(or $(shell git config --get remote.upstream.url 2>/dev/null),$(GIT_UPSTREAM_REPOSITORY)) APP_URI ?= $(APP_HOST)$(APP_PATH) APP_URL ?= $(APP_SCHEME)://$(APP_URI) -BUILD_ENV_VARS ?= APP BRANCH COMMIT DEPLOY_HOOK_URL ENV VERSION -CONTEXT_DEBUG += APP_DIR APP_DOMAIN APP_HOST APP_PATH APP_URL APP_REPOSITORY APP_UPSTREAM_REPOSITORY -ENV_DEPLOY ?= $(shell ls .git/refs/heads/) +CONTEXT_DEBUG += APP_DIR APP_DOMAIN APP_HOST APP_PATH APP_URL APP_REPOSITORY APP_UPSTREAM_REPOSITORY ENV_DEPLOY +ENV_DEPLOY ?= $(shell ls .git/refs/remotes/origin/ 2>/dev/null) ENV_VARS += APP_DIR APP_DOMAIN APP_HOST APP_PATH APP_URL CONSUL_HTTP_TOKEN $(if $(filter true,$(MOUNT_NFS)),NFS_CONFIG) MOUNT_NFS ?= false NFS_CONFIG ?= addr=$(NFS_HOST),actimeo=3,intr,noacl,noatime,nocto,nodiratime,nolock,soft,rsize=32768,wsize=32768,tcp,rw,vers=3 diff --git a/make/apps/docker.mk b/make/apps/docker.mk index a0deee9..4ceb46e 100644 --- a/make/apps/docker.mk +++ b/make/apps/docker.mk @@ -120,7 +120,7 @@ docker-images-rm: # target docker-images-rm-%: Remove docker images matching % .PHONY: docker-images-rm-% docker-images-rm-%: - docker images |awk '$$1 ~ /^$(subst /,\/,$*)/ {print $$3}' |sort -u |while read image; do docker rmi -f $$image; done + docker images |awk '$$1 ~ /^$(subst /,\/,$*)/ {print $$3}' |sort -u |while read image; do $(RUN) docker rmi -f $$image; done # target docker-login: Exec 'docker login' .PHONY: docker-login @@ -188,7 +188,7 @@ docker-rm: docker-rm-$(COMPOSE_PROJECT_NAME) # target docker-rm-%: Remove dockers matching % .PHONY: docker-rm-% docker-rm-%: - docker ps -a |awk '$$NF ~ /^$*/ {print $$NF}' |while read docker; do docker rm -f $$docker; done + docker ps -a |awk '$$NF ~ /^$*/ {print $$NF}' |while read docker; do $(RUN) docker rm -f $$docker; done # target docker-run: Call docker-run-% target with ARGS for SERVICE .PHONY: docker-run @@ -230,4 +230,4 @@ docker-volume-rm: docker-volume-rm-$(COMPOSE_PROJECT_NAME) # target docker-volume-rm-%: Remove docker volumes matching % .PHONY: docker-volume-rm-% docker-volume-rm-%: - docker volume ls |awk '$$2 ~ /^$*/ {print $$2}' |sort -u |while read volume; do docker volume rm $$volume; done + docker volume ls |awk '$$2 ~ /^$*/ {print $$2}' |sort -u |while read volume; do $(RUN) docker volume rm $$volume; done diff --git a/make/apps/git.mk b/make/apps/git.mk index b44c228..402718f 100644 --- a/make/apps/git.mk +++ b/make/apps/git.mk @@ -37,9 +37,9 @@ git-stash: myos-base git-status # target git-status: Define STATUS with number of lines of git status .PHONY: git-status git-status: myos-base - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval STATUS := $(shell $(call exec,git status -uno --porcelain 2>/dev/null |wc -l))) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) # target git-tag-create-upstream-%: Create git TAG to reference upstream/% branch .PHONY: git-tag-create-upstream-% diff --git a/make/common.mk b/make/common.mk index 66d2cee..b3cf7a3 100644 --- a/make/common.mk +++ b/make/common.mk @@ -46,7 +46,7 @@ update-config: myos-base ## it reads .env files to extract applications hostnames and add it to /etc/hosts .PHONY: update-hosts update-hosts: -ifneq (,$(filter $(ENV),local)) +ifneq (,$(filter $(ENV),master)) cat */.env 2>/dev/null |grep -Eo 'urlprefix-[^/]+' |sed 's/urlprefix-//' |while read host; do grep $$host /etc/hosts >/dev/null 2>&1 || { echo "Adding $$host to /etc/hosts"; echo 127.0.0.1 $$host |$(RUN) sudo tee -a /etc/hosts >/dev/null; }; done endif diff --git a/make/debug.mk b/make/debug.mk index 6462379..46c858e 100644 --- a/make/debug.mk +++ b/make/debug.mk @@ -4,8 +4,13 @@ # target debug: Print more informations .PHONY: debug debug: - $(MAKE) doc help DEBUG=true + $(MAKE) doc help profile DEBUG=true # target debug-%: Print value of % .PHONY: debug-% debug-%: context-% ; + +# target profile: Print timing informations +.PHONY: profile +profile: context-ELAPSED_TIME + diff --git a/make/def.mk b/make/def.mk index 978a0d5..b3db42a 100644 --- a/make/def.mk +++ b/make/def.mk @@ -14,31 +14,33 @@ CMDS ?= exec exec:% exec@% install-app install-apps r COMMIT ?= $(or $(SUBREPO_COMMIT),$(GIT_COMMIT)) CONFIG ?= $(RELATIVE)config CONFIG_REPOSITORY ?= $(call pop,$(or $(APP_UPSTREAM_REPOSITORY),$(GIT_UPSTREAM_REPOSITORY)))/$(notdir $(CONFIG)) -CONTEXT ?= $(if $(APP),APP BRANCH VERSION) $(shell awk 'BEGIN {FS="="}; $$1 !~ /^(\#|$$)/ {print $$1}' .env.dist 2>/dev/null) +CONTEXT ?= $(if $(APP),APP BRANCH DOMAIN VERSION) $(shell awk 'BEGIN {FS="="}; $$1 !~ /^(\#|$$)/ {print $$1}' .env.dist 2>/dev/null) CONTEXT_DEBUG ?= MAKEFILE_LIST env env.docker APPS GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME LOG_LEVEL MAKE_DIR MAKE_SUBDIRS MAKE_CMD_ARGS MAKE_ENV_ARGS MONOREPO_DIR UID USER DEBUG ?= -DOCKER ?= true +DOCKER ?= $(if $(BUILD),false,true) DOMAIN ?= localhost DRONE ?= false DRYRUN ?= false -DRYRUN_IGNORE ?= false DRYRUN_RECURSIVE ?= false -ENV ?= dist +ELAPSED_TIME = $(shell $(call TIME)) +ENV ?= local ENV_FILE ?= $(wildcard $(CONFIG)/$(ENV)/$(APP)/.env .env) -ENV_LIST ?= debug local tests release master #TODO: staging develop +ENV_LIST ?= $(shell ls .git/refs/heads/ 2>/dev/null) ENV_RESET ?= false -ENV_VARS ?= APP BRANCH ENV HOSTNAME GID GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME MONOREPO MONOREPO_DIR TAG UID USER VERSION +ENV_VARS ?= APP BRANCH DOMAIN ENV HOSTNAME GID GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME MONOREPO MONOREPO_DIR TAG UID USER VERSION GID ?= $(shell id -g 2>/dev/null) -GIT_AUTHOR_EMAIL ?= $(shell git config user.email 2>/dev/null) -GIT_AUTHOR_NAME ?= $(shell git config user.name 2>/dev/null) +GIT_AUTHOR_EMAIL ?= $(or $(shell git config user.email 2>/dev/null),$(USER)@my.os) +GIT_AUTHOR_NAME ?= $(or $(shell git config user.name 2>/dev/null),$(USER)) GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) GIT_COMMIT ?= $(shell git rev-parse $(BRANCH) 2>/dev/null) GIT_REPOSITORY ?= $(if $(SUBREPO),$(shell awk -F ' = ' '$$1 ~ /^[[\s\t]]*remote$$/ {print $$2}' .gitrepo 2>/dev/null),$(shell git config --get remote.origin.url 2>/dev/null)) GIT_TAG ?= $(shell git tag -l --points-at $(BRANCH) 2>/dev/null) GIT_UPSTREAM_REPOSITORY ?= $(if $(findstring ://,$(GIT_REPOSITORY)),$(call pop,$(call pop,$(GIT_REPOSITORY)))/,$(call pop,$(GIT_REPOSITORY),:):)$(GIT_UPSTREAM_USER)/$(lastword $(subst /, ,$(GIT_REPOSITORY))) -GIT_UPSTREAM_USER ?= $(or $(MONOREPO),$(USER)) +GIT_UPSTREAM_USER ?= $(lastword $(subst /, ,$(call pop,$(MYOS_REPOSITORY)))) GIT_VERSION ?= $(shell git describe --tags $(BRANCH) 2>/dev/null || git rev-parse $(BRANCH) 2>/dev/null) HOSTNAME ?= $(shell hostname 2>/dev/null |sed 's/\..*//') +IGNORE_DRYRUN ?= false +IGNORE_VERBOSE ?= $(IGNORE_DRYRUN) LOG_LEVEL ?= $(if $(DEBUG),debug,$(if $(VERBOSE),info,error)) MAKE_ARGS ?= $(foreach var,$(MAKE_VARS),$(if $($(var)),$(var)='$($(var))')) MAKE_SUBDIRS ?= $(if $(filter myos,$(MYOS)),monorepo,$(if $(APP),apps $(foreach type,$(APP_TYPE),$(if $(wildcard $(MAKE_DIR)/apps/$(type)),apps/$(type))))) @@ -50,11 +52,14 @@ MAKE_FILE_ARGS ?= $(foreach var,$(filter $(ENV_VARS),$(MAKE_FIL MAKE_FILE_VARS ?= $(strip $(foreach var, $(filter-out .VARIABLES,$(.VARIABLES)), $(if $(filter file,$(origin $(var))),$(var)))) MAKE_OLDFILE ?= $@ MAKE_TARGETS ?= $(filter-out $(.VARIABLES),$(shell $(MAKE) -qp 2>/dev/null |awk -F':' '/^[a-zA-Z0-9][^$$\#\/\t=]*:([^=]|$$)/ {print $$1}' |sort -u)) -MAKE_UNIXTIME ?= $(shell date +%s 2>/dev/null) +MAKE_UNIXTIME_START := $(shell date -u +'%s' 2>/dev/null) +MAKE_UNIXTIME_CURRENT = $(shell date -u "+%s" 2>/dev/null) MAKE_VARS ?= ENV MONOREPO ?= $(if $(filter myos,$(MYOS)),$(notdir $(CURDIR)),$(if $(APP),$(notdir $(realpath $(CURDIR)/..)))) MONOREPO_DIR ?= $(if $(MONOREPO),$(if $(filter myos,$(MYOS)),$(realpath $(CURDIR)),$(if $(APP),$(realpath $(CURDIR)/..)))) MYOS ?= $(if $(filter $(MAKE_DIR),$(call pop,$(MAKE_DIR))),.,$(call pop,$(MAKE_DIR))) +MYOS_COMMIT ?= $(shell GIT_DIR=$(MYOS)/.git git rev-parse head 2>/dev/null) +MYOS_REPOSITORY ?= $(shell GIT_DIR=$(MYOS)/.git git config --get remote.origin.url 2>/dev/null) QUIET ?= $(if $(VERBOSE),,--quiet) RECURSIVE ?= true RELATIVE ?= $(if $(filter myos,$(MYOS)),./,../) @@ -80,7 +85,7 @@ else endif ifeq ($(DRYRUN),true) -RUN = $(if $(filter $(DRYRUN_IGNORE),true),,echo) +RUN = $(if $(filter-out true,$(IGNORE_DRYRUN)),echo) ifeq ($(RECURSIVE), true) DRYRUN_RECURSIVE := true endif @@ -147,8 +152,8 @@ force = $$(while true; do [ $$(ps x |awk 'BEGIN {nargs=split("'"$$*"'",args)} $$ # macro gid: Return GID of group 1 gid = $(shell grep '^$(1):' /etc/group 2>/dev/null |awk -F: '{print $$3}') -# function INFO: customized info -INFO = $(if $(VERBOSE),printf '${COLOR_BROWN}$(APP)${COLOR_RESET}[${COLOR_GREEN}$(MAKELEVEL)${COLOR_RESET}] ${COLOR_BLUE}$@${COLOR_RESET}:${COLOR_RESET} ${COLOR_GREEN}Called${COLOR_RESET} $(1)$(if $(2),$(lbracket)$(2)$(rbracket)) $(if $(3),${COLOR_BLUE}in folder${COLOR_RESET} $(3) )\n' >&2) +# macro INFO: customized info +INFO = $(if $(VERBOSE),$(if $(filter-out true,$(IGNORE_VERBOSE)),printf '${COLOR_BROWN}$(APP)${COLOR_RESET}[${COLOR_GREEN}$(MAKELEVEL)${COLOR_RESET}] ${COLOR_BLUE}$@${COLOR_RESET}:${COLOR_RESET} ${COLOR_GREEN}Calling${COLOR_RESET} $(1)$(if $(2),$(lbracket)$(2)$(rbracket)) $(if $(3),${COLOR_BLUE}in folder${COLOR_RESET} $(3) )\n' >&2)) # function install-app: Exec 'git clone url 1 dir 2' or Call update-app with url 1 dir 2 define install-app @@ -184,7 +189,7 @@ define make $(eval MAKE_OLDFILE += $(filter-out $(MAKE_OLDFILE), $^)) $(call INFO,make,$(MAKE_ARGS) $(cmd),$(dir)) $(RUN) $(MAKE) $(MAKE_DIR) $(patsubst %,-o %,$(MAKE_OLDFILE)) MAKE_OLDFILE="$(MAKE_OLDFILE)" $(MAKE_ARGS) $(cmd) - $(if $(filter $(DRYRUN_RECURSIVE),true),$(MAKE) $(MAKE_DIR) $(patsubst %,-o %,$(MAKE_OLDFILE)) MAKE_OLDFILE="$(MAKE_OLDFILE)" DRYRUN=$(DRYRUN) RECURSIVE=$(RECURSIVE) $(MAKE_ARGS) $(cmd)) + $(if $(filter true,$(DRYRUN_RECURSIVE)),$(MAKE) $(MAKE_DIR) $(patsubst %,-o %,$(MAKE_OLDFILE)) MAKE_OLDFILE="$(MAKE_OLDFILE)" DRYRUN=$(DRYRUN) RECURSIVE=$(RECURSIVE) $(MAKE_ARGS) $(cmd)) endef # macro pop: Return last word of string 1 according to separator 2 @@ -193,6 +198,10 @@ pop = $(patsubst %$(or $(2),/)$(lastword $(subst $(or $(2),/), ,$(1))),%,$(1)) # macro sed: Exec sed script 1 on file 2 sed = $(call exec,sed -i $(SED_SUFFIX) '\''$(1)'\'' $(2)) +# macro TIME: Print time elapsed since unixtime 1 +TIME = awk '{printf "%02d:%02d:%02d\n",int($$1/3600),int(($$1%3600)/60),int($$1%60)}' \ + <<< $(shell bc <<< "$(or $(2),$(MAKE_UNIXTIME_CURRENT))-$(or $(1),$(MAKE_UNIXTIME_START))" 2>/dev/null) + # function update-app: Exec 'cd dir 1 && git pull' or Call install-app define update-app $(call INFO,update-app,$(1)$(comma) $(2)) diff --git a/make/help.mk b/make/help.mk index 100c935..33cd5c7 100644 --- a/make/help.mk +++ b/make/help.mk @@ -21,7 +21,7 @@ context: # target context: Fire context-% target for each CONTEXT .PHONY: contexts -contexts: $(foreach var,$(CONTEXT),$(if $($(var)),context-$(var))) +contexts: $(foreach var,$(CONTEXT),context-$(var)) # target context-%: Print % value .PHONY: context-% diff --git a/make/monorepo/subrepo.mk b/make/monorepo/subrepo.mk index f9746fa..bedb6f1 100644 --- a/make/monorepo/subrepo.mk +++ b/make/monorepo/subrepo.mk @@ -26,9 +26,9 @@ endif ## it compares child commit with our tree : git diff --quiet child -- subrepo .PHONY: subrepo-git-diff subrepo-git-diff: myos-base subrepo-check - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval DIFF = $(shell $(call exec,git diff --quiet $(shell $(call exec,git rev-list --ancestry-path $(shell awk '$$1 == "parent" {print $$3}' $(SUBREPO)/.gitrepo)..HEAD |tail -n 1)) -- $(SUBREPO); echo $$?)) ) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) # target subrepo-git-fetch: Fetch git remote .PHONY: subrepo-git-fetch @@ -52,9 +52,9 @@ ifeq ($(BRANCH),master) endif # if release|story|hotfix branch, delete remote branch before push and recreate it from master ifneq ($(findstring $(firstword $(subst /, ,$(BRANCH))),release story hotfix),) - $(eval DRYRUN_IGNORE := true) + $(eval IGNORE_DRYRUN := true) $(eval DELETE = $(shell $(call exec,git ls-remote --heads $(REMOTE) $(BRANCH) |wc -l)) ) - $(eval DRYRUN_IGNORE := false) + $(eval IGNORE_DRYRUN := false) else $(eval DELETE = 0) endif diff --git a/stack/base.mk b/stack/base.mk index f270704..affe27b 100644 --- a/stack/base.mk +++ b/stack/base.mk @@ -10,7 +10,9 @@ ssh-add: base-ssh-add .PHONY: base-ssh-add base-ssh-add: base-ssh-key $(eval SSH_PRIVATE_KEYS := $(foreach file,$(SSH_DIR)/id_rsa $(filter-out $(wildcard $(SSH_DIR)/id_rsa),$(wildcard $(SSH_DIR)/*)),$(if $(shell grep "PRIVATE KEY" $(file) 2>/dev/null),$(notdir $(file))))) + $(eval IGNORE_VERBOSE := true) $(call docker-run,$(DOCKER_IMAGE_CLI),sh -c "$(foreach file,$(patsubst %,$(SSH_DIR)/%,$(SSH_PRIVATE_KEYS)),ssh-add -l |grep -qw $$(ssh-keygen -lf $(file) 2>/dev/null |awk '{print $$2}') 2>/dev/null || ssh-add $(file) ||: &&) true") + $(eval IGNORE_VERBOSE := false) # target base-ssh-key: Setup ssh private key SSH_KEY in SSH_DIR .PHONY: base-ssh-key