This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.5' | |
services: | |
web1: | |
image: yeasy/simple-web | |
environment: | |
VIRTUAL_HOST: domain.com | |
LETSENCRYPT_HOST: domain.com | |
web2: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as cdk from '@aws-cdk/core'; | |
import { MyVpc } from './vpc'; | |
export class DemoCdkStack extends cdk.Stack { | |
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); | |
const myVpc = new MyVpc(this, 'DemoVpc', { | |
vpcCidr: '10.0.0.0/16', | |
maxAzs: 2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as cdk from '@aws-cdk/core'; | |
import * as ec2 from '@aws-cdk/aws-ec2'; | |
export interface VpcProps { | |
vpcCidr: string; | |
maxAzs?: number; | |
publicSubnetsNo: number; | |
privateSubnetsNo?: number; | |
isolatedSubnetsNo?: number; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: node:10.15.3 | |
fetch_ssh_key: &fetch_ssh_key | |
step: | |
name: Fetch ssh key from S3 | |
script: | |
- apt-get update && apt-get install -y python3-pip | |
- pip3 install -U awscli | |
- aws --version | |
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: node:10.15.3 | |
fetch_ssh_key: &fetch_ssh_key | |
step: | |
name: Fetch ssh key from S3 | |
script: | |
- apt-get update && apt-get install -y python3-pip | |
- pip3 install -U awscli | |
- aws --version | |
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Deploy with docker stack | |
docker_stack: | |
state: present | |
name: test | |
compose: | |
- ~/{{ dir_name }}/docker-compose.yml | |
environment: | |
NODE_ENV: "{{ NODE_ENV }}" | |
PORT: "{{ PORT }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: production | |
become: true | |
roles: | |
- install_docker | |
- init_swarm | |
tasks: | |
- include_role: | |
name: copy_compose_src | |
vars: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- include_role: | |
name: deploy_prod_stack | |
vars: | |
dir_name: compose.production | |
NODE_ENV: "{{ lookup('env', 'PRODUCTION')}}" | |
PORT: "{{ lookup('env', 'PORT') }}" | |
DB_HOST: "{{ lookup('env', 'DB_PRODUCTION') }}" | |
DH_USERNAME: "{{ lookup('env', 'DH_USERNAME') }}" | |
IMAGE_BASE_NAME: "{{ lookup('env', 'IMAGE_BASE_NAME') }}" | |
PROXY_IMAGE_NAME: "{{ lookup('env', 'PROXY_IMAGE_NAME') }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Copy compose source | |
copy: | |
src: ../../../../{{ dir_name }}/docker-compose.yml | |
dest: ~/{{ dir_name }}/ | |
owner: root | |
group: root | |
mode: '0644' | |
register: copy_status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Pull latest images | |
docker_compose: | |
project_src: ~/{{ dir_name }} | |
pull: yes | |
state: present | |
environment: | |
NODE_ENV: "{{ NODE_ENV }}" | |
PORT: "{{ PORT }}" | |
DB_HOST: "{{ DB_HOST }}" |
NewerOlder