Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions jenkins/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM alpine:3.4

RUN apk --update add nginx php5-fpm && \
mkdir -p /var/log/nginx && \
touch /var/log/nginx/access.log && \
mkdir -p /run/nginx

ADD www /www
ADD nginx.conf /etc/nginx/
ADD php-fpm.conf /etc/php5/php-fpm.conf

EXPOSE 80
CMD php-fpm -d variables_order="EGPCS" && (tail -F /var/log/nginx/access.log &) && exec nginx -g "daemon off;"
19 changes: 19 additions & 0 deletions jenkins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

## Continuous Delivery Pipeline for Amazon ECS Using Jenkins, GitHub, and Amazon ECR

Demo Project is intended to help to set up and configure a continuous delivery pipeline for Amazon Elastic Container Service (Amazon ECS) using Jenkins, GitHub, and the Amazon Elastic Container Registry (Amazon ECR). The pipeline builds Docker images from a GitHub repository, pushes those images to an ECR registry, creates an ECS task definition, and then uses that task definition to create a service on the ECS cluster. We use Jenkins to orchestrate the different steps in the workflow.

## Official documentation
https://docs.aws.amazon.com/AWSGettingStartedContinuousDeliveryPipeline/latest/GettingStarted/CICD_Jenkins_Pipeline.html#create-ecr-registry

1) Make a change source code in your repository and push changes to GitHub

2) Jenkins pulls the code from your Git repository into a workspace

3) builds the container image, pushes the container image to ECR

4) creates a task and service definition, and starts your service.

Without dynamic ports, only one instance of a service can be deployed per container as the port being used by the instance cannot be used by any other instance. When you update the service, it will try to restart all its instances and if more than one instances are being started on a single EC2 container, the startup will fail.

Better to use docker containers with dynamic port mapping in ECS cluster.
31 changes: 31 additions & 0 deletions jenkins/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
user root;
worker_processes 1;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

server {
listen 80;
server_name localhost;

root /www;
index index.php index.html index.htm;

location / {
try_files $uri $uri/ /index.php;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
}
Loading