├── .gitignore ├── ReadMe.md ├── backendless ├── Dockerfile └── docker-compose.yml ├── cabot ├── docker-compose.yml └── production.env ├── centos-nginx-ldap-php ├── docker-compose.yml ├── nginx │ ├── Dockerfile │ ├── prepare.sh │ └── startup.sh └── var │ └── index.php ├── cirkol ├── docker-compose.rancher.yml └── docker-compose.yml ├── compose-with-volumes └── docker-compose.yml ├── dind-swarm ├── docker-compose.rancher.yml └── docker-compose.yml ├── docker-proxy └── docker.cmd ├── elastic-stack ├── docker-compose.yml └── logstash │ └── logstash.conf ├── elasticsearch ├── data │ └── elasticsearch.yml ├── docker-compose.yml └── sample-data │ ├── ReadMe.md │ ├── index.js │ └── package.json ├── etcd └── docker-compose.yml ├── gitlab └── docker-compose.yml ├── go-cli ├── docker-cli │ ├── docker-compose.yml │ └── main.go └── main.go ├── go-compiler ├── docker-compose.yml └── src │ ├── httplistener │ └── httplistener.go ├── go-glide └── docker-compose.yml ├── gogit └── docker-compose.yml ├── gomicro ├── docker-compose.yml └── micro │ └── Dockerfile ├── haproxy-loadbalance ├── docker-compose.yml ├── docker_cmd.sh └── v2 │ └── docker_cmd.sh ├── inside-docker4mac └── d4mac.sh ├── jenkins └── docker-compose.yml ├── mattermost └── docker-compose.yml ├── mysql ├── docker-compose.prod.yml └── docker-compose.yml ├── nginx-proxy ├── .nginx │ └── conf.d │ │ └── default.conf ├── certs │ └── dhparam.pem ├── docker-compose.rancher.yml ├── docker-compose.yml ├── etc │ └── hosts └── nginx │ └── conf.d │ └── default.conf ├── nsq └── docker-compose.yml ├── others ├── docker-compose.yml └── jasmin.sh ├── parse ├── both │ ├── Dockerfile │ ├── dashboard-config.json │ ├── index.js │ ├── init.sh │ └── server-config.json ├── dashboard │ ├── Dockerfile │ └── dashboard-config.json ├── docker-compose.yml ├── hub │ ├── Dockerfile │ ├── docker-compose.demo.yml │ ├── index.js │ ├── main.js │ └── package.json └── server │ ├── Dockerfile │ └── server-config.json ├── phabricator ├── Dockerfile ├── Dockerfile.bak ├── ReadMe.md ├── docker-compose.yml └── script │ └── centos7_init.sh ├── prod └── treafik-cmd.md ├── rocketchat ├── docker-compose.yml └── scripts │ └── demo.coffee ├── sentry └── docker-compose.yml ├── shipyard-with-swarm └── docker-compose.yml ├── summer-web-local ├── ReadMe.md ├── command │ └── command.sh └── docker-compose.yml ├── summer-web ├── ReadMe.md ├── command │ └── command.sh ├── docker-compose.swarm.yml └── docker-compose.yml ├── swarm ├── docker-compose.yml └── docker_cmd.sh ├── symfony ├── .gitignore ├── ReadMe.md ├── config │ ├── nginx │ │ ├── app.conf │ │ ├── nginx.conf │ │ ├── php54.conf │ │ ├── php56.conf │ │ ├── php70.conf │ │ └── upstream.conf │ ├── php54 │ │ ├── php-fpm.conf │ │ └── symfony.ini │ ├── php56 │ │ ├── php-fpm.conf │ │ └── symfony.ini │ └── php70 │ │ ├── php-fpm.conf │ │ └── symfony.ini ├── docker-compose.yml └── php56 │ └── Dockerfile ├── symfony_dev ├── .gitignore ├── ReadMe.md ├── config │ ├── nginx │ │ ├── app.conf │ │ ├── nginx.conf │ │ ├── php54.conf │ │ ├── php56.conf │ │ ├── php70.conf │ │ └── upstream.conf │ ├── php54 │ │ ├── php-fpm.conf │ │ └── symfony.ini │ ├── php56 │ │ ├── php-fpm.conf │ │ └── symfony.ini │ └── php70 │ │ ├── php-fpm.conf │ │ └── symfony.ini ├── docker-compose.yml └── php56 │ └── Dockerfile ├── traefik └── docker-compose.yml ├── transfer-volume └── cmd.sh └── visualizer └── cmd.md /.gitignore: -------------------------------------------------------------------------------- 1 | jenkins/data 2 | prometheus/ 3 | cirkol/data/ 4 | traefik/admin 5 | traefik/db 6 | traefik/log 7 | *.override.yml 8 | -------------------------------------------------------------------------------- /ReadMe.md: -------------------------------------------------------------------------------- 1 | 2 | ### Install docker 3 | 4 | ``` 5 | 6 | sudo yum update 7 | 8 | curl -fsSL https://get.docker.com/ | sh 9 | 10 | sudo service docker start 11 | sudo docker run hello-world 12 | ``` 13 | 14 | ### Install docker-compose 15 | ``` 16 | curl -L "https://github.com/docker/compose/releases/download/1.9.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose 17 | chmod +x /usr/local/bin/docker-compose 18 | ``` 19 | 20 | ### docker update 21 | 22 | * need add parameters to docker daemon 23 | ``` 24 | /usr/lib/systemd/system/docker.service 25 | 26 | eg: 27 | docker daemon -g /mnt/docker -H fd:// -H unix:///var/run/docker.sock --cluster-store etcd://etcd.darg.ws --cluster-advertise 192.168.20.23:2375 28 | ``` 29 | 30 | ### cleanup stopped container 31 | ``` 32 | docker rm $(docker ps -aq) 33 | ``` 34 | 35 | ### cleanup no-used volumes 36 | 37 | ``` 38 | docker volume rm $(docker volume ls -q) 39 | ``` 40 | 41 | ### cleanup images 42 | ``` 43 | docker rmi $(docker images | grep '' | awk '{print $3}') 44 | ``` 45 | 46 | 47 | ### Change Docker Dir 48 | ``` 49 | $dest=/mnt/docker 50 | 51 | docker ps -q | xargs docker kill 52 | systemctl stop docker 53 | cd /var/lib/docker/devicemapper/mnt 54 | umount ./* 55 | mv /var/lib/docker $dest 56 | ln -s $dest /var/lib/docker 57 | systemctl start docker 58 | ``` 59 | 60 | 61 | ### Bash Completion 62 | Linux: 63 | 64 | ``` 65 | curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose 66 | curl -L https://raw.githubusercontent.com/docker/docker/v$(docker version -f "{{.Server.Version}}")/contrib/completion/bash/docker -o /etc/bash_completion.d/docker 67 | ``` 68 | 69 | Mac: 70 | ``` 71 | ln -s /Applications/Docker.app/Contents/Resources/etc/docker.bash-completion /usr/local/etc/bash_completion.d/docker 72 | ln -s /Applications/Docker.app/Contents/Resources/etc/docker-machine.bash-completion /usr/local/etc/bash_completion.d/docker-machine 73 | ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion /usr/local/etc/bash_completion.d/docker-compose 74 | 75 | curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/bash/docker-compose > /usr/local/etc/bash_completion.d/docker-compose 76 | curl -L https://raw.githubusercontent.com/docker/docker/v$(docker version -f "{{.Server.Version}}")/contrib/completion/bash/docker > /usr/local/etc/bash_completion.d/docker 77 | 78 | files=(docker-machine docker-machine-wrapper docker-machine-prompt) 79 | for f in "${files[@]}"; do 80 | curl -L https://raw.githubusercontent.com/docker/machine/v$(docker-machine --version | tr -ds ',' ' ' | awk 'NR==1{print $(3)}')/contrib/completion/bash/$f.bash > /usr/local/etc/bash_completion.d/$f 81 | done 82 | 83 | ``` 84 | 85 | 86 | ### Zsh Completion 87 | 88 | ``` 89 | curl -L https://raw.githubusercontent.com/docker/machine/v$(docker-machine --version | tr -ds ',' ' ' | awk 'NR==1{print $(3)}')/contrib/completion/zsh/_docker-machine > ~/.zsh/completion/_docker-machine 90 | curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/zsh/_docker-compose > ~/.zsh/completion/_docker-compose 91 | curl -L https://raw.githubusercontent.com/docker/docker/v$(docker version -f "{{.Server.Version}}")/contrib/completion/zsh/_docker > ~/.zsh/completion/_docker 92 | ``` 93 | 94 | ### Kill process in docker container tomcat 95 | ``` 96 | docker exec tomcat sh -c 'kill `ps -aux | grep java|grep -v grep | awk -F " " '"'"'{print $2}'"'"'`' 97 | ``` 98 | 99 | Backup: 100 | 101 | [Link](http://stackoverflow.com/questions/26331651/how-can-i-backup-a-docker-container-with-its-data-volumes/26339869#26339869) 102 | 103 | ``` 104 | docker run --rm --volumes-from container-name -v $(pwd):/backup -w container-backup-dir busybox tar cvf /backup/backup.tar . 105 | ``` 106 | 107 | 108 | ### docker daemon config 109 | 110 | ``` 111 | sudo mkdir -p /etc/docker && \ 112 | sudo tee /etc/docker/daemon.json <<-'EOF' 113 | { 114 | "registry-mirrors": ["https://XXXXXX.mirror.aliyuncs.com"] 115 | } 116 | EOF 117 | sudo systemctl daemon-reload 118 | sudo systemctl restart docker 119 | ``` 120 | 121 | 122 | ### tar backup & restore 123 | 124 | ``` 125 | tar -cvf ~/backupportainer.tar . 126 | 127 | tar -xvpf ~/backupportainer.tar -C /var/lib/docker/volumes 128 | 129 | ``` 130 | 131 | 132 | ### colorful bash 133 | 134 | ``` 135 | export PS1="[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]" 136 | ``` -------------------------------------------------------------------------------- /backendless/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos 2 | 3 | RUN curl -L -o /mnt/backendless.run https://downloads.bitnami.com/files/stacks/backendless/3.0.0-16/backendless-3.0.0-16-linux-x64-installer.run 4 | 5 | WORKDIR /mnt 6 | 7 | EXPOSE 80 8080 8 | 9 | CMD ["/bin/bash"] -------------------------------------------------------------------------------- /backendless/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | app: 4 | build: . 5 | restart: always 6 | stdin_open: true 7 | environment: 8 | - VIRTUAL_HOST=bel.dev.darg.ws 9 | - VIRTUAL_PORT=80 -------------------------------------------------------------------------------- /cabot/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | # migrate: #just run once 5 | # image: cabotapp/cabot 6 | # command: cabot migrate 7 | # env_file: 8 | # - production.env 9 | # links: 10 | # - postgres:postgres 11 | # - redis:redis 12 | app: 13 | image: cabotapp/cabot 14 | command: gunicorn cabot.wsgi:application -b 0.0.0.0:5000 15 | env_file: 16 | - production.env 17 | ports: 18 | - 5000:5000 19 | links: 20 | - postgres:postgres 21 | - redis:redis 22 | worker: 23 | image: cabotapp/cabot 24 | command: celery worker -A cabot 25 | env_file: 26 | - production.env 27 | links: 28 | - postgres:postgres 29 | - redis:redis 30 | beat: 31 | image: cabotapp/cabot 32 | command: celery beat -A cabot 33 | env_file: 34 | - production.env 35 | links: 36 | - postgres:postgres 37 | - redis:redis 38 | postgres: 39 | image: postgres 40 | redis: 41 | image: redis -------------------------------------------------------------------------------- /cabot/production.env: -------------------------------------------------------------------------------- 1 | DATABASE_URL=postgres://postgres@postgres:5432/postgres 2 | CELERY_BROKER_URL=redis://redis:6379/1 -------------------------------------------------------------------------------- /centos-nginx-ldap-php/docker-compose.yml: -------------------------------------------------------------------------------- 1 | app: 2 | build: nginx 3 | volumes: 4 | - ./var:/var/www -------------------------------------------------------------------------------- /centos-nginx-ldap-php/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:7 2 | 3 | MAINTAINER Paul 4 | 5 | # Install EPEL 6 | RUN yum install -y epel-release && yum clean all 7 | 8 | # Update RPM Packages 9 | RUN yum -y update && yum clean all 10 | 11 | # Install Nginx 12 | RUN yum install -y nginx && yum clean all 13 | 14 | # forward request and error logs to docker log collector 15 | RUN ln -sf /dev/stdout /var/log/nginx/access.log 16 | RUN ln -sf /dev/stderr /var/log/nginx/error.log 17 | 18 | # be backwards compatible with pre-official images 19 | RUN ln -sf ../share/nginx /usr/local/nginx 20 | 21 | # ldap 22 | RUN yum install -y openldap-servers openldap-clients 23 | 24 | # php 25 | RUN yum install -y php 26 | 27 | # prepare container 28 | ADD prepare.sh /prepare.sh 29 | RUN chmod 755 /prepare.sh 30 | RUN /prepare.sh 31 | 32 | # add startup script 33 | ADD startup.sh /startup.sh 34 | RUN chmod 755 /startup.sh 35 | 36 | ENV SLAPD_URL ldapi:/// ldap:/// 37 | 38 | VOLUME ["/etc/nginx"] 39 | VOLUME ["/usr/share/nginx/html"] 40 | VOLUME ["/var/www"] 41 | 42 | EXPOSE 80 443 389 43 | 44 | CMD /startup.sh 45 | -------------------------------------------------------------------------------- /centos-nginx-ldap-php/nginx/prepare.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # add 'server_tokens off' to nginx.conf 4 | # to hide server version 5 | # TIPP: check with `curl -I http://xxxx` 6 | 7 | sed -i '/http {/a \ 8 | server_tokens off;' /etc/nginx/nginx.conf 9 | 10 | # change test page 11 | sed -i 's/Fedora/Docker Container with CentOS/' /usr/share/nginx/html/index.html 12 | 13 | # save default config 14 | # 15 | cp -r /etc/nginx /etc/nginx.default -------------------------------------------------------------------------------- /centos-nginx-ldap-php/nginx/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if [[ ! -f /var/lib/ldap/DB_CONFIG ]]; then 6 | cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG 7 | fi 8 | 9 | chown -R ldap:ldap /var/lib/ldap /etc/openldap/slapd.d 10 | 11 | if [[ ! -z "$MAX_NOFILE" ]]; then 12 | ulimit -n $MAX_NOFILE 13 | fi 14 | 15 | 16 | if [ ! -f /etc/nginx/nginx.conf ] 17 | then 18 | cp -r /etc/nginx.default/* /etc/nginx 19 | fi 20 | 21 | NGINX=/usr/sbin/nginx 22 | 23 | # show Version and compile config 24 | $NGINX -V 25 | 26 | # test config 27 | #$NGINX -t 28 | 29 | $NGINX -g "daemon on;" 30 | 31 | 32 | exec slapd -d 3000 -u ldap -g ldap -h "$SLAPD_URL" 33 | 34 | -------------------------------------------------------------------------------- /centos-nginx-ldap-php/var/index.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/awesome-startup/docker-compose/2f9490b10d0a8699d7c91cddeee46b3e253d8d8e/centos-nginx-ldap-php/var/index.php -------------------------------------------------------------------------------- /cirkol/docker-compose.rancher.yml: -------------------------------------------------------------------------------- 1 | server: 2 | image: dockerepo/godep 3 | ports: 4 | - "10087:10086" 5 | working_dir: /go/src/github.com/llitfkitfk/cirkol 6 | tty: true 7 | entrypoint: "" 8 | command: sh -c "git clone https://github.com/CrawlApi/go-crawl.git . || git pull origin master && godep restore && go run apiServer.go" -------------------------------------------------------------------------------- /cirkol/docker-compose.yml: -------------------------------------------------------------------------------- 1 | server: 2 | image: dockerepo/godep 3 | ports: 4 | - "10087:10086" 5 | working_dir: /go/src/github.com/llitfkitfk/cirkol 6 | tty: true 7 | entrypoint: "" 8 | command: sh -c "git clone https://github.com/CrawlApi/go-crawl.git . || git pull origin master && godep restore && go run apiServer.go" -------------------------------------------------------------------------------- /compose-with-volumes/docker-compose.yml: -------------------------------------------------------------------------------- 1 | versions: '2' 2 | services: 3 | nginx: 4 | image: jwilder/nginx-proxy 5 | ports: 6 | - "80:80" 7 | - "443:443" 8 | restart: always 9 | volumes_from: 10 | - data 11 | volumes: 12 | - ./certs:/etc/nginx/certs:rw 13 | - /etc/nginx/vhost.d 14 | - /usr/share/nginx/html 15 | - volume-data:/etc/test-volume 16 | - /var/run/docker.sock:/tmp/docker.sock:ro 17 | volumes: 18 | volume-data: 19 | external: 20 | name: previous-create-volumes 21 | nginx-data: 22 | driver: local -------------------------------------------------------------------------------- /dind-swarm/docker-compose.rancher.yml: -------------------------------------------------------------------------------- 1 | dind: 2 | image: docker:1.12.0-rc2-dind 3 | privileged: true 4 | ports: 5 | - "2377:2377" 6 | labels: 7 | io.rancher.container.hostname_override: container_name 8 | io.rancher.container.pull_image: 'always' 9 | io.rancher.sidekicks: dind-data 10 | volumes: 11 | - data:/var/lib/docker 12 | container_name: dind 13 | dind-data: 14 | image: alpine 15 | labels: 16 | io.rancher.container.start_once: 'true' 17 | io.rancher.container.hostname_override: container_name 18 | volumes: 19 | - /var/lib/docker 20 | command: sh -------------------------------------------------------------------------------- /dind-swarm/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | dind: 5 | image: docker:1.12.0-rc2-dind 6 | privileged: true 7 | ports: 8 | - "2377:2377" 9 | volumes: 10 | - data:/var/lib/docker 11 | container_name: dind 12 | client: 13 | image: docker:1.12.0-rc2 14 | links: 15 | - dind:docker 16 | command: version 17 | volumes: 18 | data: 19 | external: 20 | name: docker-data -------------------------------------------------------------------------------- /docker-proxy/docker.cmd: -------------------------------------------------------------------------------- 1 | docker run -d -p 2375:2375 --restart=always --name shipyard-proxy -v /var/run/docker.sock:/var/run/docker.sock -e PORT=2375 shipyard/docker-proxy:latest -------------------------------------------------------------------------------- /elastic-stack/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | # tomcat: 4 | # image: tomcat 5 | # ports: 6 | # - 8080:8080 7 | # volumes: 8 | # - /usr/local/tomcat/logs 9 | logstash: 10 | image: logstash:2.4 11 | volumes_from: 12 | - container:symfony_nginx_1 13 | links: 14 | - elasticsearch:elasticsearch 15 | ports: 16 | - 5000:5000 17 | volumes: 18 | - ./logstash/logstash.conf:/etc/logstash/conf.d/logstash.conf 19 | command: -f '/etc/logstash/conf.d/logstash.conf' 20 | elasticsearch: 21 | image: elasticsearch:2.4 22 | ports: 23 | - 9200:9200 24 | kibana: 25 | image: kibana:4.6 26 | links: 27 | - elasticsearch:elasticsearch 28 | ports: 29 | - 5601:5601 -------------------------------------------------------------------------------- /elastic-stack/logstash/logstash.conf: -------------------------------------------------------------------------------- 1 | input { 2 | file { 3 | path => "/var/log/nginx/symfony_access.log" 4 | start_position => "beginning" 5 | } 6 | } 7 | output { 8 | elasticsearch { 9 | hosts => ["elasticsearch:9200"] 10 | } 11 | stdout { codec => rubydebug } 12 | } -------------------------------------------------------------------------------- /elasticsearch/data/elasticsearch.yml: -------------------------------------------------------------------------------- 1 | network.host: 0.0.0.0 2 | 3 | # This is only for Testing with your localhost 4 | # Get rid of it before shipping to production! 5 | http.cors.enabled : true 6 | http.cors.allow-origin : "*" 7 | http.cors.allow-methods : OPTIONS, HEAD, GET, POST, PUT, DELETE 8 | http.cors.allow-headers : X-Requested-With,X-Auth-Token,Content-Type, Content-Length -------------------------------------------------------------------------------- /elasticsearch/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | elasticsearch: 4 | image: elasticsearch 5 | restart: always 6 | ports: 7 | - "9200:9200" 8 | - "9300:9300" 9 | volumes: 10 | - ./data/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml 11 | environment: 12 | - VIRTUAL_HOST=es.d1.darg.ws 13 | - VIRTUAL_PORT=9200 14 | - "constraint:node==docker1" 15 | command: elasticsearch 16 | # elasticsearch-1: 17 | # image: elasticsearch 18 | # container_name: elasticsearch-1 19 | # ports: 20 | # - "9200:9200" 21 | # - "9300:9300" 22 | # volumes: 23 | # - ./data/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml 24 | # command: elasticsearch 25 | 26 | kibana-frontend: 27 | image: kibana:latest 28 | container_name: kibana-frontend 29 | ports: 30 | - "5601:5601" 31 | links: 32 | - elasticsearch:elasticsearch -------------------------------------------------------------------------------- /elasticsearch/sample-data/ReadMe.md: -------------------------------------------------------------------------------- 1 | 2 | ## command 3 | 4 | docker-compose up -d 5 | 6 | Then run node index.js -------------------------------------------------------------------------------- /elasticsearch/sample-data/index.js: -------------------------------------------------------------------------------- 1 | /* This is a script to index photos into elasticsearch. 2 | This part of a post on searching through photos using Elasticsearch 3 | Read more at http://blog.sandeepchivukula.com */ 4 | 5 | // Extended from https://github.com/jettro/nodejs-photo-indexer// 6 | // If you're running this on a VM an you run out of memory create a swapfile 7 | // using the instructions here: 8 | // http://stackoverflow.com/questions/26193654/node-js-catch-enomem-error-thrown-after-spawn 9 | 10 | "use strict"; 11 | 12 | var walk = require('walk') 13 | , fs = require('fs') 14 | , path = require('path') 15 | , exif = require('exif2') 16 | ,readline = require('readline') 17 | ,elasticsearch = require('elasticsearch'); 18 | 19 | 20 | 21 | /* Do you love hard coded constants ??*/ 22 | var suffix = ".jpg" // Types of images to index 23 | , startdir = process.argv[2] || './photos' // The Folder with images to index 24 | , queue = 100 // How many items to queue before sending to ES 25 | , hostandport = '192.168.99.100:9200' //ES Server and Port 26 | , indexname='photos' //ES Index Name 27 | , doctype ='photo' // ES Document Type 28 | , items = []; 29 | 30 | 31 | /* First create the Indices */ 32 | var client = new elasticsearch.Client({host: hostandport}); 33 | 34 | client.indices.create({ 35 | index: indexname, 36 | body: {}, 37 | //This lets us ignore the error when the index already exists. 38 | ignore:[400] 39 | }).then( 40 | function(body) { 41 | console.log("create index!"); 42 | /* If we were being clever we could read this from a seperate file */ 43 | client.indices.putMapping({ 44 | index: indexname, 45 | type:doctype, 46 | body: { 47 | "photo": { 48 | "_all": { 49 | "enabled": true 50 | }, 51 | "properties": { 52 | "file_name":{ 53 | "type": "string", 54 | "index": "not_analyzed" 55 | }, 56 | "name": { 57 | "type": "string", 58 | "index": "not_analyzed" 59 | }, 60 | "camera": { 61 | "type": "string", 62 | "analyzer":"english", 63 | "fields":{ 64 | "raw":{ 65 | "type":"string", 66 | "index": "not_analyzed" 67 | } 68 | } 69 | 70 | }, 71 | "lens": { 72 | "type": "string", 73 | "index": "not_analyzed" 74 | }, 75 | "create_Date": { 76 | "type": "date", 77 | "format": "yyyy:MM:dd HH:mm:ss||yyyy:MM:dd HH:mm:ss.SS||yyyy:MM:dd HH:mm||yyyy:MM:dd HH:mm:ss.SSS" 78 | }, 79 | "iso": { 80 | "type": "integer" 81 | }, 82 | "focalLength": { 83 | "type": "string", 84 | "analyzer":"english", 85 | "fields":{ 86 | "raw":{ 87 | "type":"string", 88 | "index": "not_analyzed" 89 | } 90 | } 91 | 92 | }, 93 | "location":{ 94 | "type":"geo_point" 95 | } 96 | 97 | } 98 | } 99 | } 100 | }).then (function(body){console.log("Put mapping !");}, function(err){console.log(err);}); 101 | 102 | 103 | }, function(err) { 104 | console.log(err) 105 | } 106 | ); 107 | 108 | /* Go through each directory and extract data */ 109 | var walker = walk.walk(startdir); 110 | 111 | walker.on('file', function(root, stat, next) { 112 | console.log("Walk " + stat.name); 113 | // Add this file to the list of files 114 | if (strEndsWith(stat.name.toLowerCase(),suffix)) { 115 | extractData(root + '/' + stat.name, next); 116 | } 117 | next(); 118 | }); 119 | 120 | /* Add a user input so that we wait for the extraction processes to finish 121 | before flushing into the index 122 | */ 123 | walker.on('end', function() { 124 | /* we do this little hokey pokey in case things are still in flight */ 125 | var rl = readline.createInterface({ 126 | input: process.stdin, 127 | output: process.stdout 128 | }); 129 | 130 | rl.question("What do you think of node.js? ", function(answer) { 131 | console.log("Thank you for your valuable feedback:", answer); 132 | rl.close(); 133 | flushItems(items); 134 | console.log("We are done!"); 135 | }); 136 | 137 | }); 138 | 139 | 140 | /* This is the core work horse that calls the 141 | functions to get the data from the images an add 142 | it to a search object */ 143 | function extractData(file) { 144 | 145 | 146 | exif(file, function(err, obj){ 147 | if(err) { 148 | console.log(err); 149 | 150 | } else 151 | { 152 | //console.log("Creating the object"); 153 | var searchObj = {}; 154 | searchObj.id = file; 155 | //We want something guranteed to be unqiue here like a primary key but this works. 156 | searchObj.orientation=obj["orientation"]; 157 | searchObj.flash=obj["flash"]; 158 | searchObj.lens=obj["lens"]; 159 | searchObj.aperture=obj["aperture"]; 160 | searchObj.megapixels=obj["megapixels"]; 161 | searchObj.file_name=obj["file name"]; 162 | searchObj.directory=obj["directory"]; 163 | searchObj.file_size=obj["file size"]; 164 | searchObj.make=obj["make"]; 165 | searchObj.camera_model_name=obj["camera model name"]; 166 | searchObj.x_resolution=obj["x resolution"]; 167 | searchObj.y_resolution=obj["y resolution"]; 168 | searchObj.resolution_unit=obj["resolution unit"]; 169 | searchObj.create_Date=obj["create date"]; 170 | searchObj.focal_length=obj["focal length"]; 171 | searchObj.focus_position=obj["focus position"]; 172 | searchObj.focus_distance=obj["focus distance"]; 173 | searchObj.lens_f_stops=obj["lens f stops"]; 174 | searchObj.shutter_speed=obj["shutter speed"]; 175 | searchObj.depth_of_field=obj["depth of field"]; 176 | searchObj.GPS_Altitude=obj["gps altitude"]; 177 | searchObj.GPS_Date_Time=obj["gps date/time"]; 178 | searchObj.GPS_Latitude=obj["gps latitude"]; 179 | searchObj.GPS_Longitude=obj["gps longitude"]; 180 | searchObj.gps_altitude=obj["gps altitude"]; 181 | obj["gps position"] >"" ? searchObj.location= gpstodd(obj["gps position"]): 1; 182 | sendToElasticsearch(searchObj); 183 | 184 | } 185 | }); 186 | 187 | getPalette(file, function(colors){ 188 | var searchObj = {} 189 | searchObj.id = file; 190 | searchObj.colors=[] 191 | colors.forEach(function(color) 192 | { 193 | searchObj.colors.push({"h":color[0],"s":color[1],"v":color[2]}) 194 | 195 | }); 196 | sendToElasticsearch(searchObj); 197 | }); 198 | 199 | }; 200 | 201 | 202 | 203 | /* Some Utility functions */ 204 | function strEndsWith(str, suffix) { 205 | return str.match(suffix+"$")==suffix; 206 | } 207 | 208 | /* Convert from GPS Degrees in EXIF to Degree Decimal so the ES understands the GPS */ 209 | function gpstodd (input) 210 | { 211 | input = input.replace(/\'/g," min").replace(/\"/g,' sec').replace(/\,/g,"").split(" ") 212 | 213 | var lat= (parseFloat(input[0])+parseFloat(input[2]/60)+parseFloat(input[4]/(60*60)) )* (input[6] =="S" ? -1 : 1); 214 | var lng=(parseFloat(input[7])+parseFloat(input[9]/60)+parseFloat(input[11]/(60*60)) ) * (input[13] =="W" ? -1 : 1); 215 | //console.log(searchObj) 216 | return {"lat": lat, "lon":lng} 217 | } 218 | 219 | /* Get Color information from the photos */ 220 | var getPalette = function(file, callback){ 221 | //from https://github.com/tj/palette 222 | var convert = require('color-convert') 223 | ,palette= require('palette') 224 | ,Canvas = require('canvas'); 225 | 226 | var img = new Canvas.Image; 227 | img.src = file; 228 | var canvas = new Canvas(img.width, img.height); 229 | var ctx = canvas.getContext('2d'); 230 | ctx.drawImage(img, 0, 0, img.width/4, img.height/4); 231 | 232 | var colors = palette(canvas); 233 | var output =[] 234 | 235 | colors.forEach(function(color){ 236 | output.push(convert.rgb.hsv(color)) 237 | }) 238 | 239 | callback(output); 240 | }; 241 | 242 | 243 | 244 | /*Collect and Flsuh using the Bulk Index */ 245 | function sendToElasticsearch(searchObj) { 246 | console.log("Sending to elastic"); 247 | 248 | //We'll do an upsert here b/c we don't which feature will return first 249 | items.push({"update":{"_id":searchObj.id}},{"doc": searchObj, "doc_as_upsert":true}); 250 | //console.log(items); 251 | if (items.length >= 100) { 252 | var new_items = items 253 | flushItems(new_items); 254 | new_items = []; 255 | items=[]; 256 | } 257 | } 258 | 259 | function flushItems(new_items) { 260 | console.log("Flushing items"); 261 | client.bulk({ 262 | index: indexname, 263 | type: doctype, 264 | body: new_items 265 | }, function(err,response) { 266 | if (err) { 267 | console.log(JSON.stringify(err)); 268 | } 269 | console.log(JSON.stringify(response)); 270 | 271 | }); 272 | } 273 | -------------------------------------------------------------------------------- /elasticsearch/sample-data/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "photo-indexer", 3 | "version": "0.1.0", 4 | "description": "Node js script to index photos into ES using the exiftool. Extended from https://github.com/jettro/nodejs-photo-indexer/", 5 | "main": "index.js", 6 | "dependencies": { 7 | "canvas": "^1.3.12", 8 | "color-convert": "^1.0.0", 9 | "colors-palette": "0.0.4", 10 | "elasticsearch": "", 11 | "exif2": "", 12 | "palette": "0.0.1", 13 | "walk": "" 14 | }, 15 | "author": "Sandeep Chivukula", 16 | "license": "GPLv3", 17 | "private": true 18 | } 19 | -------------------------------------------------------------------------------- /etcd/docker-compose.yml: -------------------------------------------------------------------------------- 1 | etcd: 2 | image: microbox/etcd 3 | restart: always 4 | environment: 5 | - VIRTUAL_HOST=etcd.darg.ws 6 | - VIRTUAL_PORT=4001 7 | command: 8 | -name discovery -------------------------------------------------------------------------------- /gitlab/docker-compose.yml: -------------------------------------------------------------------------------- 1 | b: 2 | image: busybox 3 | volumes: 4 | - mysql-data:/var/lib/mysql 5 | - gitlab-data:/home/git/data 6 | - gitlab-log-data:/var/log/gitlab 7 | mysql: 8 | image: sameersbn/mysql:latest 9 | environment: 10 | - DB_USER=gitlab 11 | - DB_PASS=secretpassword 12 | - DB_NAME=gitlabhq_production_d 13 | volumes_from: 14 | - db 15 | gitlab: 16 | image: sameersbn/gitlab:7.8.4 17 | links: 18 | - redis:redisio 19 | - mysql:mysql 20 | volumes_from: 21 | - db 22 | environment: 23 | - GITLAB_HOST=git.wizmacau.com 24 | - GITLAB_SSH_PORT=10022 25 | - SMTP_ENABLED=true 26 | - SMTP_HOST=192.168.20.210 27 | - SMTP_PASS=bAw8jO0hiN0Relk6eUl6In2tAbr7Iat8 28 | - SMTP_USER=edm 29 | - SMTP_PORT=587 30 | - SMTP_STARTTLS=true 31 | - GITLAB_EMAIL=gitlab@smtp.wizmacau.com 32 | - SMTP_OPENSSL_VERIFY_MODE=none 33 | ports: 34 | - "10080:80" 35 | - "10022:22" 36 | redis: 37 | image: sameersbn/redis:latest 38 | -------------------------------------------------------------------------------- /go-cli/docker-cli/docker-compose.yml: -------------------------------------------------------------------------------- 1 | app: 2 | image: centos 3 | volumes: 4 | - docker -------------------------------------------------------------------------------- /go-cli/docker-cli/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | log "github.com/Sirupsen/logrus" 5 | "github.com/codegangsta/cli" 6 | "github.com/samalba/dockerclient" 7 | "os" 8 | "time" 9 | ) 10 | 11 | // Callback used to listen to Docker's events 12 | func eventCallback(event *dockerclient.Event, ec chan error, args ...interface{}) { 13 | log.Printf("Received event: %#v\n", *event) 14 | } 15 | 16 | func main() { 17 | app := cli.NewApp() 18 | app.Name = "docker-cli" 19 | app.Usage = "docker cli to deploy symfony project" 20 | app.Version = "0.1.1" 21 | app.Author = "Paul" 22 | app.Email = "paul@wizmacau.com" 23 | 24 | // Init the client 25 | docker, _ := dockerclient.NewDockerClient("unix:///var/run/docker.sock", nil) 26 | 27 | var host string 28 | app.Flags = []cli.Flag{ 29 | cli.StringFlag{ 30 | Name: "host, o", 31 | Value: "", 32 | Usage: "virtual host name for symfony project", 33 | Destination: &host, 34 | }, 35 | } 36 | 37 | app.Action = func(c *cli.Context) { 38 | println("Start Deploy!") 39 | if c.NArg() > 0 { 40 | } 41 | if host == "" { 42 | println("Please specify host name! --host") 43 | } else { 44 | println(host) 45 | } 46 | } 47 | 48 | if err := app.Run(os.Args); err != nil { 49 | log.Fatal(err) 50 | } 51 | 52 | // Get only running containers 53 | containers, err := docker.ListContainers(false, false, "") 54 | if err != nil { 55 | log.Fatal(err) 56 | } 57 | for _, c := range containers { 58 | log.Println(c.Id, c.Names) 59 | } 60 | 61 | // Inspect the first container returned 62 | if len(containers) > 0 { 63 | id := containers[0].Id 64 | info, _ := docker.InspectContainer(id) 65 | log.Println(info) 66 | } 67 | 68 | // Build a docker image 69 | // some.tar contains the build context (Dockerfile any any files it needs to add/copy) 70 | dockerBuildContext, err := os.Open("some.tar") 71 | defer dockerBuildContext.Close() 72 | buildImageConfig := &dockerclient.BuildImage{ 73 | Context: dockerBuildContext, 74 | RepoName: "your_image_name", 75 | SuppressOutput: false, 76 | } 77 | reader, err := docker.BuildImage(buildImageConfig) 78 | if err != nil { 79 | log.Fatal(err) 80 | } 81 | println(reader) 82 | 83 | // Create a container 84 | containerConfig := &dockerclient.ContainerConfig{ 85 | Image: "ubuntu:14.04", 86 | Cmd: []string{"bash"}, 87 | AttachStdin: true, 88 | Tty: true} 89 | containerId, err := docker.CreateContainer(containerConfig, "foobar", nil) 90 | if err != nil { 91 | log.Fatal(err) 92 | } 93 | 94 | // Start the container 95 | hostConfig := &dockerclient.HostConfig{} 96 | err = docker.StartContainer(containerId, hostConfig) 97 | if err != nil { 98 | log.Fatal(err) 99 | } 100 | 101 | // Stop the container (with 5 seconds timeout) 102 | docker.StopContainer(containerId, 5) 103 | 104 | // Listen to events 105 | docker.StartMonitorEvents(eventCallback, nil) 106 | 107 | // Hold the execution to look at the events coming 108 | time.Sleep(3600 * time.Second) 109 | 110 | } 111 | -------------------------------------------------------------------------------- /go-cli/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | "github.com/codegangsta/cli" 6 | ) 7 | 8 | func main() { 9 | app := cli.NewApp() 10 | app.Name = "boom" 11 | app.Usage = "make an explosive entrance" 12 | app.Action = func(c *cli.Context) { 13 | println("boom! I say!") 14 | } 15 | 16 | app.Run(os.Args) 17 | } -------------------------------------------------------------------------------- /go-compiler/docker-compose.yml: -------------------------------------------------------------------------------- 1 | compiler: 2 | image: golang 3 | volumes: 4 | - ./src:/go/src 5 | stdin_open: true 6 | command: bash 7 | -------------------------------------------------------------------------------- /go-compiler/src/httplistener: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/awesome-startup/docker-compose/2f9490b10d0a8699d7c91cddeee46b3e253d8d8e/go-compiler/src/httplistener -------------------------------------------------------------------------------- /go-compiler/src/httplistener.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/gin-gonic/gin" 5 | "net/http" 6 | "log" 7 | "io/ioutil" 8 | ) 9 | 10 | func main() { 11 | router := gin.Default() 12 | router.Use(gin.Logger()) 13 | 14 | router.POST("/api/sentry", func(c *gin.Context) { 15 | 16 | body, err := ioutil.ReadAll(c.Request.Body) 17 | 18 | if err != nil { 19 | panic(err) 20 | } 21 | 22 | log.Print(string(body)) 23 | 24 | c.JSON(http.StatusOK, gin.H{ 25 | "status": true, 26 | "message": "ok", 27 | }) 28 | }) 29 | 30 | router.HEAD("/", func(c *gin.Context) { 31 | body, err := ioutil.ReadAll(c.Request.Body) 32 | 33 | if err != nil { 34 | panic(err) 35 | } 36 | 37 | log.Print(string(body)) 38 | }) 39 | 40 | router.Run("0.0.0.0:18080") 41 | } 42 | -------------------------------------------------------------------------------- /go-glide/docker-compose.yml: -------------------------------------------------------------------------------- 1 | server: 2 | image: dockerepo/glide 3 | ports: 4 | - "10087:10086" 5 | volumes_from: 6 | - gitsource 7 | working_dir: /go/src/github.com/llitfkitfk/cirkol 8 | stdin_open: true 9 | command: go run apiServer.go 10 | gitsource: 11 | image: dockerepo/git 12 | working_dir: /go/src/github.com/llitfkitfk/cirkol 13 | volumes: 14 | - /go/src/github.com/llitfkitfk/cirkol 15 | command: clone https://github.com/CrawlApi/go-crawl.git . 16 | -------------------------------------------------------------------------------- /gogit/docker-compose.yml: -------------------------------------------------------------------------------- 1 | data: 2 | image: gogs/gogs 3 | entrypoint: /bin/true 4 | app: 5 | image: gogs/gogs 6 | volumes_from: 7 | - data 8 | ports: 9 | - "10022:22" 10 | links: 11 | - db 12 | environment: 13 | - VIRTUAL_HOST=gogit.darg.ws 14 | - VIRTUAL_PORT=3000 15 | db: 16 | image: mysql 17 | environment: 18 | MYSQL_ROOT_PASSWORD: root 19 | MYSQL_DATABASE: symfony 20 | MYSQL_USER: root 21 | MYSQL_PASSWORD: root -------------------------------------------------------------------------------- /gomicro/docker-compose.yml: -------------------------------------------------------------------------------- 1 | web: 2 | build: micro 3 | links: 4 | - consul 5 | ports: 6 | - "8082:8082" 7 | command: --registry_address=consul:8500 --register_interval=5 --register_ttl=10 web 8 | consul: 9 | command: -server -bootstrap -rejoin 10 | image: progrium/consul:latest 11 | ports: 12 | - "8500:8500" 13 | api: 14 | command: --registry_address=consul:8500 --register_interval=5 --register_ttl=10 api 15 | build: micro 16 | links: 17 | - consul 18 | ports: 19 | - "8080:8080" 20 | sidecar: 21 | command: --registry_address=consul:8500 --register_interval=5 --register_ttl=10 sidecar 22 | build: micro 23 | links: 24 | - consul 25 | ports: 26 | - "8081:8081" -------------------------------------------------------------------------------- /gomicro/micro/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang 2 | 3 | RUN go get -v github.com/micro/micro 4 | 5 | EXPOSE 8082 6 | 7 | ENTRYPOINT ["micro"] 8 | -------------------------------------------------------------------------------- /haproxy-loadbalance/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | db1: 4 | image: mysql 5 | container_name: db1 6 | ports: 7 | - "3306:3306" 8 | expose: 9 | - 3306 10 | environment: 11 | - MYSQL_ROOT_PASSWORD=root1 12 | - MYSQL_DATABASE=db-demo 13 | - MYSQL_USER=root1 14 | - MYSQL_PASSWORD=root1 15 | - TCP_PORTS=3306 16 | - "constraint:node==docker1" 17 | db2: 18 | image: mysql 19 | container_name: db2 20 | ports: 21 | - "3306:3306" 22 | expose: 23 | - 3306 24 | environment: 25 | - MYSQL_ROOT_PASSWORD=root2 26 | - MYSQL_DATABASE=db-demo 27 | - MYSQL_USER=root2 28 | - MYSQL_PASSWORD=root2 29 | - TCP_PORTS=3306 30 | - "constraint:node==docker2" 31 | # haproxy: 32 | # image: tutum/haproxy 33 | # environment: 34 | # - "constraint:node==docker1" 35 | # links: 36 | # - db1 37 | # - db2 38 | # ports: 39 | # - "3306:3306" 40 | networks: 41 | default: 42 | external: 43 | name: test-overlay 44 | -------------------------------------------------------------------------------- /haproxy-loadbalance/docker_cmd.sh: -------------------------------------------------------------------------------- 1 | docker run -d --link db1 --net test-overlay -e "constraint:node==docker1" -p 3306:3306 tutum/haproxy 2 | 3 | 4 | -------------------------------------------------------------------------------- /haproxy-loadbalance/v2/docker_cmd.sh: -------------------------------------------------------------------------------- 1 | docker rm $(docker ps -lq) 2 | docker logs $(docker ps -lq) 3 | docker run -it --rm --name haproxy-syntax-check haproxy haproxy -c -f /usr/local/etc/haproxy/haproxy.cfg 4 | docker run -d -v $PWD//haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro -p 38080:8080 haproxy 5 | 6 | 7 | ``` 8 | global 9 | # log haproxy-logger local0 notice 10 | # user haproxy 11 | # group haproxy 12 | defaults 13 | log global 14 | retries 2 15 | timeout connect 3000 16 | timeout server 5000 17 | timeout client 5000 18 | listen mysql-cluster 19 | bind 0.0.0.0:3306 20 | mode tcp 21 | #option mysql-check user haproxy_check (This is not needed as for Layer 4 balancing) 22 | option tcp-check 23 | balance roundrobin 24 | # The below nodes would be hit on 1:1 ratio. If you want it to be 1:2 then add 'weight 2' just after the line. 25 | # server mysql1 mysql1:3306 check 26 | # server mysql2 mysql2:3306 check 27 | # Enable cluster status 28 | listen mysql-clusterstats 29 | bind 0.0.0.0:8080 30 | mode http 31 | stats enable 32 | stats uri / 33 | stats realm Strictly\ Private 34 | stats auth status:keypas5 35 | 36 | ``` -------------------------------------------------------------------------------- /inside-docker4mac/d4mac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker run -it --privileged --pid=host debian nsenter -t -1 -m -u -n -i sh -------------------------------------------------------------------------------- /jenkins/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | app: 4 | image: jenkins 5 | restart: always 6 | ports: 7 | - "8085:8080" 8 | volumes: 9 | - ./data:/var/jenkins_home -------------------------------------------------------------------------------- /mattermost/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | app: 4 | image: mattermost/platform 5 | restart: always 6 | environment: 7 | - VIRTUAL_HOST=mm.d1.darg.ws 8 | - VIRTUAL_PORT=80 -------------------------------------------------------------------------------- /mysql/docker-compose.prod.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | db: 5 | image: mysql:5.7 6 | ports: 7 | - "3306:3306" 8 | restart: always 9 | volumes: 10 | - mysql-prod:/var/lib/mysql 11 | - mysql-prod-conf:/etc/mysql/conf.d 12 | environment: 13 | MYSQL_ROOT_PASSWORD: prod-secret-pw 14 | MYSQL_DATABASE: proddatabase 15 | MYSQL_USER: produser 16 | MYSQL_PASSWORD: prodpassword 17 | volumes: 18 | mysql-prod: -------------------------------------------------------------------------------- /mysql/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | db: 4 | image: mysql:5.5 5 | ports: 6 | - "3306:3306" 7 | restart: always 8 | volumes: 9 | - mysql-data:/var/lib/mysql 10 | environment: 11 | MYSQL_ROOT_PASSWORD: password 12 | volumes: 13 | mysql-data: -------------------------------------------------------------------------------- /nginx-proxy/.nginx/conf.d/default.conf: -------------------------------------------------------------------------------- 1 | # If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the 2 | # scheme used to connect to this server 3 | map $http_x_forwarded_proto $proxy_x_forwarded_proto { 4 | default $http_x_forwarded_proto; 5 | '' $scheme; 6 | } 7 | # If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any 8 | # Connection header that may have been passed to this server 9 | map $http_upgrade $proxy_connection { 10 | default upgrade; 11 | '' close; 12 | } 13 | gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; 14 | log_format vhost '$host $remote_addr - $remote_user [$time_local] ' 15 | '"$request" $status $body_bytes_sent ' 16 | '"$http_referer" "$http_user_agent"'; 17 | access_log off; 18 | # HTTP 1.1 support 19 | proxy_http_version 1.1; 20 | proxy_buffering off; 21 | proxy_set_header Host $http_host; 22 | proxy_set_header Upgrade $http_upgrade; 23 | proxy_set_header Connection $proxy_connection; 24 | proxy_set_header X-Real-IP $remote_addr; 25 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 26 | proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto; 27 | server { 28 | server_name _; # This is just an invalid value which will never trigger on a real hostname. 29 | listen 80; 30 | access_log /var/log/nginx/access.log vhost; 31 | return 503; 32 | } 33 | upstream ghost.localhost { 34 | } 35 | server { 36 | server_name ghost.localhost; 37 | listen 80 ; 38 | access_log /var/log/nginx/access.log vhost; 39 | location / { 40 | proxy_pass http://ghost.localhost; 41 | } 42 | } 43 | upstream ghost2.localhost { 44 | } 45 | server { 46 | server_name ghost2.localhost; 47 | listen 80 ; 48 | access_log /var/log/nginx/access.log vhost; 49 | location / { 50 | proxy_pass http://ghost2.localhost; 51 | } 52 | } 53 | upstream whoami.localhost { 54 | } 55 | server { 56 | server_name whoami.localhost; 57 | listen 80 ; 58 | access_log /var/log/nginx/access.log vhost; 59 | location / { 60 | proxy_pass http://whoami.localhost; 61 | } 62 | } 63 | upstream whoami2.localhost { 64 | } 65 | server { 66 | server_name whoami2.localhost; 67 | listen 80 ; 68 | access_log /var/log/nginx/access.log vhost; 69 | location / { 70 | proxy_pass http://whoami2.localhost; 71 | } 72 | } 73 | upstream whoami2.localhostm { 74 | } 75 | server { 76 | server_name whoami2.localhostm; 77 | listen 80 ; 78 | access_log /var/log/nginx/access.log vhost; 79 | location / { 80 | proxy_pass http://whoami2.localhostm; 81 | } 82 | } 83 | upstream whoami4.localhost { 84 | } 85 | server { 86 | server_name whoami4.localhost; 87 | listen 80 ; 88 | access_log /var/log/nginx/access.log vhost; 89 | location / { 90 | proxy_pass http://whoami4.localhost; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /nginx-proxy/certs/dhparam.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN DH PARAMETERS----- 2 | MIIBCAKCAQEAjr8Zu6TGevnjvPIuV1RpGIysKjLYFKSG7+dXoaa5uwJD4j3dlpeb 3 | JO7Wjjg1jugMQ8JMiretLUnRIFiKPW/1gU9Yz9YVwqNmscviIREQ0EsIr7KJk176 4 | aSUugRW75NyOrp/w37Mm0yPteC8jyM8RP7fjuz54NB/8GlIz8lpJcf7+muPL9vaf 5 | jsqZqsm2but8IpVRWvCDK0hhGeZFVLouWcaedTKw2JY2/J2GSpPXjCzIVYwNBk0X 6 | +Mf18ew5pTs1v2E3m4MilxH09xSDhmJ6hXZ7s/OAw0OOXo8y2qVd/AfNMPWSNo8H 7 | VdFSbazhJ8Xa/g8q/YIs38P92VuUOZ/MAwIBAg== 8 | -----END DH PARAMETERS----- 9 | -------------------------------------------------------------------------------- /nginx-proxy/docker-compose.rancher.yml: -------------------------------------------------------------------------------- 1 | nginx-proxy: 2 | image: jwilder/nginx-proxy 3 | container_name: nginx-proxy 4 | ports: 5 | - "80:80" 6 | - "443:443" 7 | restart: always 8 | volumes: 9 | - /var/run/docker.sock:/tmp/docker.sock:ro 10 | - /root/certs:/etc/nginx/certs:rw 11 | - /etc/nginx/vhost.d 12 | - /usr/share/nginx/html 13 | letsencrypt: 14 | image: jrcs/letsencrypt-nginx-proxy-companion:stable 15 | volumes: 16 | - /var/run/docker.sock:/var/run/docker.sock:ro 17 | - /root/certs:/etc/nginx/certs:rw 18 | labels: 19 | io.rancher.container.hostname_override: container_name 20 | io.rancher.container.pull_image: 'always' 21 | io.rancher.sidekicks: nginx-proxy 22 | volumes_from: 23 | - nginx-proxy -------------------------------------------------------------------------------- /nginx-proxy/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | nginx-proxy: 4 | image: jwilder/nginx-proxy:0.3.0 5 | container_name: nginx-proxy 6 | ports: 7 | - "80:80" 8 | - "443:443" 9 | restart: always 10 | volumes: 11 | - /var/run/docker.sock:/tmp/docker.sock:ro 12 | - /root/certs:/etc/nginx/certs:rw 13 | - /etc/nginx/vhost.d 14 | - ./nginx/conf.d:/etc/nginx/conf.d 15 | - /usr/share/nginx/html 16 | # letsencrypt: 17 | # image: jrcs/letsencrypt-nginx-proxy-companion 18 | # volumes: 19 | # - /var/run/docker.sock:/var/run/docker.sock:ro 20 | # - /root/certs:/etc/nginx/certs:rw 21 | # volumes_from: 22 | # - nginx-proxy -------------------------------------------------------------------------------- /nginx-proxy/etc/hosts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/awesome-startup/docker-compose/2f9490b10d0a8699d7c91cddeee46b3e253d8d8e/nginx-proxy/etc/hosts -------------------------------------------------------------------------------- /nginx-proxy/nginx/conf.d/default.conf: -------------------------------------------------------------------------------- 1 | # If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the 2 | # scheme used to connect to this server 3 | map $http_x_forwarded_proto $proxy_x_forwarded_proto { 4 | default $http_x_forwarded_proto; 5 | '' $scheme; 6 | } 7 | # If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any 8 | # Connection header that may have been passed to this server 9 | map $http_upgrade $proxy_connection { 10 | default upgrade; 11 | '' close; 12 | } 13 | gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; 14 | log_format vhost '$host $remote_addr - $remote_user [$time_local] ' 15 | '"$request" $status $body_bytes_sent ' 16 | '"$http_referer" "$http_user_agent"'; 17 | access_log off; 18 | # HTTP 1.1 support 19 | proxy_http_version 1.1; 20 | proxy_buffering off; 21 | proxy_set_header Host $http_host; 22 | proxy_set_header Upgrade $http_upgrade; 23 | proxy_set_header Connection $proxy_connection; 24 | proxy_set_header X-Real-IP $remote_addr; 25 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 26 | proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto; 27 | server { 28 | server_name _; # This is just an invalid value which will never trigger on a real hostname. 29 | listen 80; 30 | access_log /var/log/nginx/access.log vhost; 31 | return 503; 32 | } 33 | upstream pma.localhost { 34 | # jovial_bassi 35 | server 172.17.0.4:80; 36 | } 37 | server { 38 | server_name pma.localhost; 39 | listen 80 ; 40 | access_log /var/log/nginx/access.log vhost; 41 | location / { 42 | proxy_pass http://pma.localhost; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nsq/docker-compose.yml: -------------------------------------------------------------------------------- 1 | lookupd: 2 | image: nsqio/nsq 3 | ports: 4 | - "4160:4160" 5 | - "4161:4161" 6 | command: /nsqlookupd 7 | nsqd: 8 | image: nsqio/nsq 9 | ports: 10 | - "4150:4150" 11 | - "4151:4151" 12 | links: 13 | - lookupd 14 | command: /nsqd --broadcast-address=nsqd --lookupd-tcp-address=lookupd:4160 15 | nsqadmin: 16 | image: nsqio/nsq 17 | links: 18 | - lookupd 19 | ports: 20 | - "4170:4170" 21 | - "4171:4171" 22 | links: 23 | - lookupd 24 | command: /nsqadmin --lookupd-http-address=lookupd:4161 -------------------------------------------------------------------------------- /others/docker-compose.yml: -------------------------------------------------------------------------------- 1 | composer: 2 | image: dockerepo/composer 3 | stdin_open: true 4 | entrypoint: sh 5 | tty: true -------------------------------------------------------------------------------- /others/jasmin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker run -d -p 1401:1401 -p 2775:2775 -p 8990:8990 -v /mnt/smpp:/var/log/jasmin --name jasmin_01 jookies/jasmin:latest 4 | -------------------------------------------------------------------------------- /parse/both/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node 2 | 3 | #RUN npm install -g parse-server 4 | 5 | WORKDIR /parse 6 | 7 | RUN npm install -g parse-server@2.2.6 8 | RUN npm install -g parse-dashboard@1.0.7 9 | 10 | ADD init.sh /parse 11 | 12 | RUN chmod +x init.sh 13 | 14 | ENTRYPOINT ["./init.sh"] 15 | 16 | EXPOSE 1337 4040 -------------------------------------------------------------------------------- /parse/both/dashboard-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "apps": [ 3 | { 4 | "serverURL": "http://192.168.30.73:8083/parse", 5 | "appId": "X4jwAIMI2sCuH99ueEI4c8LdTbgnkrR4u5kSqsc8", 6 | "masterKey": "43p7s64k54z9uOKgztcC23CXx0cAM6RbdXObWfVt", 7 | "appName": "pro", 8 | "production": true 9 | } 10 | ], 11 | "users": [ 12 | { 13 | "user": "user", 14 | "pass": "pass" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /parse/both/index.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var ParseDashboard = require('parse-dashboard'); 3 | var ParseServer = require('parse-server').ParseServer; 4 | 5 | var app = express(); 6 | 7 | var api = new ParseServer({ 8 | databaseURI: 'mongodb://' + process.env.MONGO_PORT_27017_TCP_ADDR + ':' + process.env.MONGO_PORT_27017_TCP_PORT + '/dev', // Connection string for your MongoDB database 9 | cloud: '/home/myApp/cloud/main.js', // Absolute path to your Cloud Code 10 | appId: 'myAppId', 11 | masterKey: 'myMasterKey', // Keep this key secret! 12 | fileKey: 'optionalFileKey', 13 | serverURL: 'http://localhost:1337/parse' // Don't forget to change to https if needed 14 | }); 15 | 16 | // Serve the Parse API on the /parse URL prefix 17 | app.use('/parse', api); 18 | 19 | app.listen(1337, function () { 20 | console.log('parse-server-example running on port 1337.'); 21 | }); 22 | 23 | var dashboard = new ParseDashboard({ 24 | "apps": [ 25 | { 26 | "serverURL": "http://localhost:1337/parse", 27 | "appId": "myAppId", 28 | "masterKey": "myMasterKey", 29 | "appName": "MyApp" 30 | } 31 | ] 32 | }); 33 | 34 | // make the Parse Dashboard available at /dashboard 35 | app.use('/dashboard', dashboard); 36 | 37 | var httpServer = require('http').createServer(app); 38 | httpServer.listen(4040); 39 | 40 | -------------------------------------------------------------------------------- /parse/both/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | parse-server server-config.json & 4 | 5 | parse-dashboard --config dashboard-config.json --allowInsecureHTTP true -------------------------------------------------------------------------------- /parse/both/server-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "serverURL": "http://localhost:1337/parse", 3 | "appId": "X4jwAIMI2sCuH99ueEI4c8LdTbgnkrR4u5kSqsc8", 4 | "masterKey": "43p7s64k54z9uOKgztcC23CXx0cAM6RbdXObWfVt", 5 | "databaseURI": "mongodb://@mongo:27017/dev" 6 | } -------------------------------------------------------------------------------- /parse/dashboard/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node 2 | 3 | RUN npm install -g parse-dashboard@1.0.7 4 | 5 | WORKDIR /dashboard 6 | 7 | ENTRYPOINT ["parse-dashboard"] 8 | 9 | EXPOSE 4040 10 | 11 | CMD ["-h"] -------------------------------------------------------------------------------- /parse/dashboard/dashboard-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "apps": [ 3 | { 4 | "serverURL": "http://192.168.30.73:1337/parse", 5 | "appId": "X4jwAIMI2sCuH99ueEI4c8LdTbgnkrR4u5kSqsc8", 6 | "masterKey": "43p7s64k54z9uOKgztcC23CXx0cAM6RbdXObWfVt", 7 | "appName": "test", 8 | "production": true 9 | }, 10 | { 11 | "serverURL": "http://192.168.30.73:8001/parse", 12 | "appId": "X4jwAIMI2sCuH99ueEI4c8LdTbgnkrR4u5kSqsc8", 13 | "masterKey": "43p7s64k54z9uOKgztcC23CXx0cAM6RbdXObWfVt", 14 | "appName": "dev" 15 | }, 16 | { 17 | "serverURL": "http://192.168.30.73:8002/parse", 18 | "appId": "X4jwAIMI2sCuH99ueEI4c8LdTbgnkrR4u5kSqsc8", 19 | "masterKey": "43p7s64k54z9uOKgztcC23CXx0cAM6RbdXObWfVt", 20 | "appName": "pro", 21 | "production": true 22 | }, 23 | { 24 | "serverURL": "http://192.168.30.73:8003/parse", 25 | "appId": "X4jwAIMI2sCuH99ueEI4c8LdTbgnkrR4u5kSqsc8", 26 | "masterKey": "43p7s64k54z9uOKgztcC23CXx0cAM6RbdXObWfVt", 27 | "appName": "demo" 28 | } 29 | ], 30 | "users": [ 31 | { 32 | "user": "user", 33 | "pass": "pass" 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /parse/docker-compose.yml: -------------------------------------------------------------------------------- 1 | server1: 2 | image: dockerepo/parse-server 3 | ports: 4 | - "9002:1337" 5 | environment: 6 | APP_ID: appId1 7 | MASTER_KEY: masterKey1 8 | MONGO_DB_NAME: dev1 9 | PARSE_PUBLIC_ADDR: 192.168.20.24 10 | PARSE_PUBLIC_PORT: 9002 11 | links: 12 | - db:mongo 13 | server2: 14 | image: dockerepo/parse-server 15 | ports: 16 | - "9003:1337" 17 | environment: 18 | APP_ID: appId2 19 | MASTER_KEY: masterKey2 20 | MONGO_DB_NAME: dev2 21 | PARSE_PUBLIC_ADDR: 192.168.20.24 22 | PARSE_PUBLIC_PORT: 9003 23 | links: 24 | - db:mongo 25 | gitsource: 26 | image: dockerepo/git 27 | working_dir: /parse/src 28 | labels: 29 | io.rancher.container.start_once: 'true' 30 | volumes: 31 | - /parse/src 32 | command: clone https://gist.github.com/756f5533576dabedd6a3200fc67135cf.git index.js 33 | db: 34 | image: mongo 35 | ports: 36 | - "27017:27017" 37 | dashboard: 38 | image: dockerepo/parse-dashboard 39 | labels: 40 | io.rancher.sidekicks: gitsource 41 | volumes_from: 42 | - gitsource 43 | links: 44 | - server1:s1 45 | - server2:s2 46 | ports: 47 | - "9100:4040" -------------------------------------------------------------------------------- /parse/hub/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node 2 | 3 | WORKDIR /parse 4 | 5 | ADD package.json /parse 6 | ADD main.js /parse/cloud/main.js 7 | ADD index.js /parse 8 | 9 | RUN npm install 10 | 11 | ENV MONGO_DB_NAME=dev 12 | 13 | ENV APP_ID=appId 14 | ENV MASTER_KEY=masterKey 15 | 16 | ENV ADMIN_USER=user 17 | ENV ADMIN_PASS=pass 18 | 19 | ENV PARSE_PUBLIC_ADDR=localhost 20 | ENV PARSE_PUBLIC_PORT=1337 21 | 22 | ENV PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=true 23 | 24 | EXPOSE $PARSE_PORT 4040 -------------------------------------------------------------------------------- /parse/hub/docker-compose.demo.yml: -------------------------------------------------------------------------------- 1 | server: 2 | image: dockerepo/parse-server 3 | restart: always 4 | environment: 5 | - MONGO_DB_NAME=dev 6 | - APP_ID=X4jwAIMI2sCuH99ueEI4c8LdTbgnkrR4u5kSqsc8 7 | - MASTER_KEY=43p7s64k54z9uOKgztcC23CXx0cAM6RbdXObWfVt 8 | ports: 9 | - "9001:1337" 10 | links: 11 | - db:mongo 12 | dashboard: 13 | image: dockerepo/parse-dashboard 14 | restart: always 15 | environment: 16 | - PARSE_PUBLIC_ADDR=192.168.30.73 17 | - PARSE_PUBLIC_PORT=9001 18 | - APP_ID=X4jwAIMI2sCuH99ueEI4c8LdTbgnkrR4u5kSqsc8 19 | - MASTER_KEY=43p7s64k54z9uOKgztcC23CXx0cAM6RbdXObWfVt 20 | ports: 21 | - "9000:4040" 22 | db: 23 | image: mongo 24 | ports: 25 | - "27017:27017" 26 | # both: 27 | # build: both 28 | # links: 29 | # - db:mongo 30 | # ports: 31 | # - "8084:4040" 32 | # - "8083:1337" 33 | # volumes: 34 | # - ./both/dashboard-config.json:/parse/dashboard-config.json 35 | # - ./both/server-config.json:/parse/server-config.json 36 | 37 | # server-dev: 38 | # build: server 39 | # restart: always 40 | # volumes: 41 | # - ./server/server-config.json:/parse/server-config.json 42 | # ports: 43 | # - "8001:1337" 44 | # links: 45 | # - db:mongo 46 | # command: server-config.json 47 | # server-pro: 48 | # build: server 49 | # restart: always 50 | # volumes: 51 | # - ./server/server-config.json:/parse/server-config.json 52 | # ports: 53 | # - "8002:1337" 54 | # links: 55 | # - db:mongo 56 | # command: server-config.json 57 | # server-demo: 58 | # build: server 59 | # restart: always 60 | # volumes: 61 | # - ./server/server-config.json:/parse/server-config.json 62 | # ports: 63 | # - "8003:1337" 64 | # links: 65 | # - db:mongo 66 | # command: server-config.json -------------------------------------------------------------------------------- /parse/hub/index.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var ParseDashboard = require('parse-dashboard'); 3 | var ParseServer = require('parse-server').ParseServer; 4 | 5 | var app = express(); 6 | 7 | var api = new ParseServer({ 8 | databaseURI: 'mongodb://@mongo:27017/' + process.env.MONGO_DB_NAME, // Connection string for your MongoDB database 9 | cloud: '/parse/cloud/main.js', // Absolute path to your Cloud Code 10 | appId: process.env.APP_ID, 11 | masterKey: process.env.MASTER_KEY, // Keep this key secret! 12 | serverURL: 'http://localhost:' + process.env.PARSE_SERVER_PORT + '/parse' // Don't forget to change to https if needed 13 | }); 14 | 15 | // Serve the Parse API on the /parse URL prefix 16 | app.use('/parse', api); 17 | // var allowInsecureHTTP =true; 18 | var dashboard = new ParseDashboard({ 19 | "apps": [ 20 | { 21 | "serverURL": "http://" + process.env.PARSE_PUBLIC_ADDR + ":" + process.env.PARSE_PUBLIC_PORT + "/parse", 22 | "appId": process.env.APP_ID, 23 | "masterKey": process.env.MASTER_KEY, // Keep this key secret! 24 | "appName": "demo" 25 | } 26 | ], 27 | "users": [ 28 | { 29 | "user": process.env.ADMIN_USER, 30 | "pass": process.env.ADMIN_PASS 31 | } 32 | ] 33 | }, process.env.PARSE_DASHBOARD_ALLOW_INSECURE_HTTP); 34 | 35 | // make the Parse Dashboard available at /dashboard 36 | app.use('/dashboard', dashboard); 37 | 38 | var httpServer = require('http').createServer(app); 39 | httpServer.listen(4040); 40 | 41 | app.listen(process.env.PARSE_SERVER_PORT, function () { 42 | console.log('parse-server-example running on port 1337.'); 43 | }); 44 | -------------------------------------------------------------------------------- /parse/hub/main.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/awesome-startup/docker-compose/2f9490b10d0a8699d7c91cddeee46b3e253d8d8e/parse/hub/main.js -------------------------------------------------------------------------------- /parse/hub/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "parse-server-dashboard", 3 | "version": "1.0.0", 4 | "description": "parse-server parse-dashboard", 5 | "main": "index.js", 6 | "license": "MIT", 7 | "dependencies": { 8 | "express": "~4.13.4", 9 | "parse-dashboard": "1.0.11", 10 | "parse-server": "2.2.8" 11 | }, 12 | "scripts": { 13 | "start": "node index.js --allowInsecureHTTP=1" 14 | }, 15 | "engines": { 16 | "node": ">=4.3" 17 | } 18 | } -------------------------------------------------------------------------------- /parse/server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node 2 | 3 | #RUN npm install -g parse-server 4 | 5 | WORKDIR /parse 6 | 7 | RUN npm install -g parse-server@2.2.6 8 | 9 | ENTRYPOINT ["parse-server"] 10 | 11 | EXPOSE 1337 12 | 13 | CMD ["-h"] 14 | -------------------------------------------------------------------------------- /parse/server/server-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "serverURL": "http://localhost:1337/parse", 3 | "appId": "X4jwAIMI2sCuH99ueEI4c8LdTbgnkrR4u5kSqsc8", 4 | "masterKey": "43p7s64k54z9uOKgztcC23CXx0cAM6RbdXObWfVt", 5 | "databaseURI": "mongodb://@mongo:27017/dev" 6 | } -------------------------------------------------------------------------------- /phabricator/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:7 2 | 3 | ADD ./script /usr/local/script 4 | 5 | RUN chmod +x /usr/local/script/*.sh 6 | 7 | RUN /usr/local/script/centos7_init.sh 8 | 9 | # Expose nginx on port 80 and 443 10 | EXPOSE 80 11 | EXPOSE 443 -------------------------------------------------------------------------------- /phabricator/Dockerfile.bak: -------------------------------------------------------------------------------- 1 | FROM centos:7 2 | 3 | MAINTAINER Paul 4 | 5 | # Install EPEL 6 | RUN yum install -y epel-release 7 | 8 | # Update RPM Packages 9 | RUN yum -y update 10 | 11 | # Install Nginx 12 | RUN yum install -y nginx git 13 | 14 | WORKDIR /phabricator 15 | 16 | RUN git clone https://github.com/phacility/libphutil.git && \ 17 | git clone https://github.com/phacility/arcanist.git && \ 18 | git clone https://github.com/phacility/phabricator.git 19 | 20 | RUN export PATH="$PATH:/somewhere/arcanist/bin/" 21 | 22 | RUN yum install pcre-devel 23 | 24 | RUN yum install php-pear && pecl install apc 25 | 26 | RUN yum clean all -------------------------------------------------------------------------------- /phabricator/ReadMe.md: -------------------------------------------------------------------------------- 1 | Command: 2 | 3 | 4 | 5 | docker-compose build -------------------------------------------------------------------------------- /phabricator/docker-compose.yml: -------------------------------------------------------------------------------- 1 | app: 2 | build: . 3 | command: 4 | bash -------------------------------------------------------------------------------- /phabricator/script/centos7_init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sed -i 's@^exclude@#exclude@' /etc/yum.conf 4 | yum clean all 5 | yum makecache 6 | 7 | yum check-update 8 | 9 | # upgrade OS 10 | yum -y upgrade 11 | 12 | # install needed packages 13 | for Package in deltarpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libaio readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch bc expect rsync git lsof lrzsz 14 | do 15 | yum -y install $Package 16 | done 17 | 18 | yum -y update bash openssl glibc 19 | 20 | # use gcc-4.4 21 | if [ -n "`gcc --version | head -n1 | grep '4\.1\.'`" ];then 22 | yum -y install gcc44 gcc44-c++ libstdc++44-devel 23 | export CC="gcc44" CXX="g++44" 24 | fi 25 | 26 | # close SELINUX 27 | setenforce 0 28 | sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config 29 | 30 | # PS1 31 | [ -z "`cat /etc/bashrc | grep ^PS1`" ] && echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ "' >> /etc/bashrc 32 | 33 | # history size 34 | sed -i 's/^HISTSIZE=.*$/HISTSIZE=100/' /etc/profile 35 | [ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc 36 | 37 | # /etc/security/limits.conf 38 | [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf 39 | sed -i '/^# End of file/,$d' /etc/security/limits.conf 40 | cat >> /etc/security/limits.conf <> /etc/rc.local 48 | 49 | # set timezone 50 | rm -rf /etc/localtime 51 | ln -s /usr/share/zoneinfo/Asia/Macau /etc/localtime 52 | 53 | # /etc/sysctl.conf 54 | sed -i 's/net.ipv4.tcp_syncookies.*$/net.ipv4.tcp_syncookies = 1/g' /etc/sysctl.conf 55 | [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF 56 | fs.file-max=65535 57 | net.ipv4.tcp_fin_timeout = 30 58 | net.ipv4.tcp_tw_reuse = 1 59 | net.ipv4.tcp_tw_recycle = 1 60 | net.ipv4.ip_local_port_range = 1024 65000 61 | net.ipv4.tcp_max_syn_backlog = 65536 62 | net.ipv4.tcp_max_tw_buckets = 20000 63 | net.ipv4.route.gc_timeout = 100 64 | net.ipv4.tcp_syn_retries = 1 65 | net.ipv4.tcp_synack_retries = 1 66 | net.core.somaxconn = 65535 67 | net.core.netdev_max_backlog = 262144 68 | net.ipv4.tcp_timestamps = 0 69 | net.ipv4.tcp_max_orphans = 262144 70 | EOF 71 | sysctl -p 72 | 73 | sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/locale.conf 74 | init q 75 | 76 | # update time 77 | ntpdate pool.ntp.org 78 | [ -z "`grep 'ntpdate' /var/spool/cron/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root; } 79 | service crond restart -------------------------------------------------------------------------------- /prod/treafik-cmd.md: -------------------------------------------------------------------------------- 1 | docker service create \ 2 | --name traefik-prod \ 3 | --constraint=node.role==manager \ 4 | --publish 80:80 \ 5 | --mount type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock \ 6 | --network traefik-net \ 7 | traefik \ 8 | --docker \ 9 | --docker.swarmmode \ 10 | --docker.domain=swarm.gokit.info \ 11 | --docker.watch \ 12 | --web 13 | 14 | 15 | docker service create \ 16 | --name whoami2 \ 17 | --label traefik.port=80 \ 18 | --label traefik.backend.loadbalancer.method=drr \ 19 | --network traefik-net \ 20 | emilevauge/whoami 21 | 22 | docker service create \ 23 | --network traefik-net \ 24 | --name=dash \ 25 | --env DASH_PORT_8080_TCP=tcp://traefik-prod:8080 \ 26 | --label traefik.port=8080 \ 27 | --constraint=node.role==manager \ 28 | svendowideit/ambassador 29 | 30 | docker service create \ 31 | --network traefik-net \ 32 | --name=viz \ 33 | --label traefik.port=8080 \ 34 | --constraint=node.role==manager \ 35 | --mount=type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock \ 36 | manomarks/visualizer 37 | 38 | docker service create \ 39 | --mode global \ 40 | --network traefik-net \ 41 | --mount type=bind,source=/,destination=/rootfs,ro=1 \ 42 | --mount type=bind,source=/var/run,destination=/var/run \ 43 | --mount type=bind,source=/sys,destination=/sys,ro=1 \ 44 | --mount type=bind,source=/var/lib/docker/,destination=/var/lib/docker,ro=1 \ 45 | --label traefik.port=8080 \ 46 | --name=cadvisor \ 47 | google/cadvisor:latest 48 | 49 | docker service create \ 50 | --name admin \ 51 | --network traefik-net \ 52 | --label traefik.port=9000 \ 53 | --constraint=node.role==manager \ 54 | --mount type=volume,src=portainer-prod,dst=/data \ 55 | --mount type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock \ 56 | portainer/portainer \ 57 | -H unix:///var/run/docker.sock 58 | 59 | 60 | docker service create \ 61 | --name vaultier \ 62 | --label traefik.port=80 \ 63 | --network traefik-net \ 64 | rclick/vaultier:latest -------------------------------------------------------------------------------- /rocketchat/docker-compose.yml: -------------------------------------------------------------------------------- 1 | db: 2 | image: mongo 3 | restart: always 4 | command: --smallfiles 5 | rocket: 6 | image: rocket.chat 7 | restart: always 8 | environment: 9 | ROOT_URL: http://rocketchat.jacklam.it 10 | VIRTUAL_HOST: rocketchat.jacklam.it 11 | VIRTUAL_PORT: 3000 12 | links: 13 | - db 14 | expose: 15 | - "3000" 16 | bot: 17 | image: rocketchat/hubot-rocketchat 18 | restart: always 19 | links: 20 | - rocket:rocketchat 21 | volumes: 22 | - ./scripts:/home/hubot/scripts 23 | environment: 24 | ROCKETCHAT_URL: http://rocketchat:3000 25 | ROCKETCHAT_ROOM: '' 26 | LISTEN_ON_ALL_PUBLIC: 'true' 27 | ROCKETCHAT_USER: hubot 28 | ROCKETCHAT_PASSWORD: hubot 29 | ROCKETCHAT_AUTH: password 30 | BOT_NAME: hubot 31 | EXTERNAL_SCRIPTS: hubot-diagnostics,hubot-help,hubot-google-images,hubot-google-translate,hubot-pugme,hubot-maps,hubot-rules,hubot-shipit -------------------------------------------------------------------------------- /rocketchat/scripts/demo.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Example scripts for you to examine and try out. 3 | # 4 | # Commands: 5 | # hubot http post test "{\"title\": \"xxx\", \"body\": \"xxx\", \"userId\": 1}" - Reply with http post response 6 | # hubot http get test - Reply with http get response 7 | # hubot reply test - Reply with message 8 | # 9 | # Notes: 10 | # They are commented out by default, because most of them are pretty silly and 11 | # wouldn't be useful and amusing enough for day to day huboting. 12 | # Uncomment the ones you want to try and experiment with. 13 | # 14 | # These are from the scripting documentation: https://github.com/github/hubot/blob/master/docs/scripting.md 15 | 16 | module.exports = (robot) -> 17 | 18 | robot.respond /reply test/i, (res) -> 19 | res.reply "Reply message \n Room id: #{res.message.room}" 20 | 21 | robot.respond /http get test/i, (msg) -> 22 | msg.http("http://jsonplaceholder.typicode.com/posts/1") 23 | .get() (err, res, body) -> 24 | msg.reply "#{body}" 25 | 26 | robot.respond /http post test (.*)/i, (msg) -> 27 | data = JSON.parse msg.match[1] 28 | msg.http("http://jsonplaceholder.typicode.com/posts") 29 | .header('Content-Type', 'application/json') 30 | .post(data) (err, res, body) -> 31 | msg.reply "#{body}" 32 | 33 | robot.respond /reply me/i, (res) -> 34 | res.reply "At your service! \n Room: ##{res.message.room}" 35 | 36 | robot.hear /^test$/i, (res) -> 37 | res.send "Test? TESTING? WE DON'T NEED NO TEST, EVERYTHING WORKS!" 38 | 39 | robot.respond /open the (.*) doors/i, (res) -> 40 | doorType = res.match[1] 41 | if doorType is "pod bay" 42 | res.reply "I'm afraid I can't let you do that." 43 | else 44 | res.reply "Opening #{doorType} doors" 45 | 46 | 47 | robot.hear /I like pie/i, (res) -> 48 | res.emote "makes a freshly baked pie" 49 | 50 | 51 | robot.respond /lulz/i, (res) -> 52 | res.send res.random ['lol', 'rofl', 'lmao'] 53 | 54 | 55 | robot.topic (res) -> 56 | res.send "#{res.message.text}? That's a Paddlin'" 57 | 58 | 59 | robot.enter (res) -> 60 | res.send res.random ['Hi', 'Target Acquired', 'Firing', 'Hello friend.', 'Gotcha', 'I see you'] 61 | 62 | 63 | robot.leave (res) -> 64 | res.send res.random ['Are you still there?', 'Target lost', 'Searching'] 65 | 66 | 67 | answer = process.env.HUBOT_ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE_THE_UNIVERSE_AND_EVERYTHING 68 | robot.respond /what is the answer to the ultimate question of life/, (res) -> 69 | unless answer? 70 | res.send "Missing HUBOT_ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE_THE_UNIVERSE_AND_EVERYTHING in environment: please set and try again" 71 | return 72 | res.send "#{answer}, but what is the question?" 73 | 74 | 75 | robot.respond /you are a little slow/, (res) -> 76 | setTimeout () -> 77 | res.send "Who you calling 'slow'?" 78 | , 60 * 1000 79 | 80 | 81 | annoyIntervalId = null 82 | 83 | robot.respond /annoy me/, (res) -> 84 | if annoyIntervalId 85 | res.send "AAAAAAAAAAAEEEEEEEEEEEEEEEEEEEEEEEEIIIIIIIIHHHHHHHHHH" 86 | return 87 | res.send "Hey, want to hear the most annoying sound in the world?" 88 | annoyIntervalId = setInterval () -> 89 | res.send "AAAAAAAAAAAEEEEEEEEEEEEEEEEEEEEEEEEIIIIIIIIHHHHHHHHHH" 90 | , 1000 91 | 92 | robot.respond /unannoy me/, (res) -> 93 | if annoyIntervalId 94 | res.send "GUYS, GUYS, GUYS!" 95 | clearInterval(annoyIntervalId) 96 | annoyIntervalId = null 97 | else 98 | res.send "Not annoying you right now, am I?" 99 | 100 | 101 | robot.router.post '/hubot/chatsecrets/:room', (req, res) -> 102 | room = req.params.room 103 | data = JSON.parse req.body.payload 104 | secret = data.secret 105 | robot.messageRoom room, "I have a secret: #{secret}" 106 | res.send 'OK' 107 | 108 | 109 | robot.error (err, res) -> 110 | robot.logger.error "DOES NOT COMPUTE" 111 | if res? 112 | res.reply "DOES NOT COMPUTE" 113 | 114 | 115 | robot.respond /have a soda/i, (res) -> 116 | # Get number of sodas had (coerced to a number). 117 | sodasHad = robot.brain.get('totalSodas') * 1 or 0 118 | if sodasHad > 4 119 | res.reply "I'm too fizzy.." 120 | else 121 | res.reply 'Sure!' 122 | robot.brain.set 'totalSodas', sodasHad+1 123 | 124 | 125 | robot.respond /sleep it off/i, (res) -> 126 | robot.brain.set 'totalSodas', 0 127 | res.reply 'zzzzz' -------------------------------------------------------------------------------- /sentry/docker-compose.yml: -------------------------------------------------------------------------------- 1 | sentry: 2 | image: sentry 3 | environment: 4 | - SENTRY_SECRET_KEY=b63e5c4b1780da4e3ab6a5dae804e42b2ad8f80f 5 | - LETSENCRYPT_HOST=sentry.wizmacau.com 6 | - LETSENCRYPT_EMAIL=it@wizmacau.com 7 | - PORT=9000 8 | - VIRTUAL_HOST=sentry.wizmacau.com 9 | - SENTRY_SERVER_EMAIL=it@wizmacau.com 10 | - SENTRY_EMAIL_HOST=192.168.20.210 11 | - SENTRY_EMAIL_PORT=587 12 | - SENTRY_EMAIL_USER=edm 13 | - SENTRY_EMAIL_PASSWORD=bAw8jO0hiN0Relk6eUl6In2tAbr7Iat8 14 | - SENTRY_EMAIL_USE_TLS=True 15 | - SENTRY_DB_NAME=postgres 16 | - SENTRY_REDIS_DB=2 17 | links: 18 | - "postgres:postgres" 19 | - "redis:redis" 20 | ports: 21 | - "29000:9000" 22 | extra_hosts: 23 | - "paul.escher.wizmacau.com:192.168.20.22" 24 | volumes: 25 | - "./data/files:/var/lib/sentry/files" 26 | celery: 27 | image: sentry 28 | environment: 29 | - SENTRY_SECRET_KEY=b63e5c4b1780da4e3ab6a5dae804e42b2ad8f80f 30 | - SENTRY_DB_NAME=postgres 31 | - SENTRY_REDIS_DB=2 32 | links: 33 | - "postgres:postgres" 34 | - "redis:redis" 35 | command: celery worker 36 | beat: 37 | image: sentry 38 | environment: 39 | - SENTRY_SECRET_KEY=b63e5c4b1780da4e3ab6a5dae804e42b2ad8f80f 40 | - SENTRY_DB_NAME=postgres 41 | - SENTRY_REDIS_DB=2 42 | links: 43 | - "postgres:postgres" 44 | - "redis:redis" 45 | command: celery beat 46 | postgres: 47 | image: postgres:9.4.1 48 | environment: 49 | - POSTGRES_USER=admin 50 | - POSTGRES_PASSWORD=admin 51 | volumes: 52 | - "./postgres/data:/var/lib/postgresql/data" 53 | redis: 54 | image: redis:2.8.19 -------------------------------------------------------------------------------- /shipyard-with-swarm/docker-compose.yml: -------------------------------------------------------------------------------- 1 | rethinkdb: 2 | image: rethinkdb 3 | restart: always 4 | manager: 5 | image: swarm 6 | restart: always 7 | ports: 8 | - "4000:4000" 9 | command: 10 | manage --host tcp://0.0.0.0:4000 etcd://etcd.darg.ws 11 | controller: 12 | image: shipyard/shipyard:latest 13 | restart: always 14 | ports: 15 | - "9000:8080" 16 | links: 17 | - manager:swarm 18 | - rethinkdb 19 | command: 20 | server -d tcp://swarm:4000 21 | proxy: 22 | image: ehazlett/docker-proxy:latest 23 | command: -i 24 | restart: always 25 | ports: 26 | - "2375:2375" 27 | volumes: 28 | - "/var/run/docker.sock:/var/run/docker.sock" 29 | swarm: 30 | image: swarm 31 | command: 32 | join --advertise 192.168.99.106:2375 etcd://etcd.darg.ws -------------------------------------------------------------------------------- /summer-web-local/ReadMe.md: -------------------------------------------------------------------------------- 1 | # summer-web in docker 2 | 3 | ## Docker环境配置 4 | 5 | ### For mac or pc 6 | #### 安装 Docker-ToolBox 7 | [Download Link](https://www.docker.com/products/docker-toolbox) 8 | 9 | #### 开启与配置Docker Machine 10 | ``` 11 | docker-machine start default 12 | 13 | eval $(docker-machine env default) 14 | ``` 15 | ### For linux 16 | 17 | #### 安装docker 18 | 19 | [Link](https://docs.docker.com/engine/installation/linux/centos/) 20 | 21 | ## 预设 22 | 23 | * Change `/summer-web-path` in `docker-compose.yml` 24 | ``` 25 | ... 26 | volumes: 27 | - /path-to-your-summer-folder-name:/tomcat/webapps/ROOT 28 | ... 29 | ``` 30 | 31 | #### 部署 32 | ``` 33 | docker-compose up -d 34 | ``` 35 | #### 检查环境 36 | ``` 37 | docker-compose ps 38 | ``` 39 | 40 | #### 编译java 41 | ``` 42 | docker-compose run java javac xxxx 43 | 44 | javac xxxx in command/command.sh 45 | 46 | ``` 47 | 48 | #### 日志 49 | ``` 50 | docker-compose logs tomcatapp 51 | ``` 52 | 53 | #### 葡语encoder 54 | 55 | http://www.web2generators.com/html-based-tools/online-html-entities-encoder-and-decoder 56 | 57 | 58 | ## IDEA配置: 59 | 60 | #### 下载 61 | https://www.jetbrains.com/idea/ 62 | 63 | #### 导入 64 | 选择 `Open Project` 65 | 66 | #### 配置Project Structure 67 | 1. `Project`选项 添加java SDK 68 | 2. `Modules`选项 修改`WEB-INF/classes`为Sources 69 | 3. `Libraries`选项 添加`javax.servlet.jsp:jsp-api:2.2`依赖 70 | 71 | 72 | Summer Activity Server 73 | #### 重启tomcat: 74 | `sudo service tomcat restart` 75 | 76 | #### 重启nginx: 77 | `sudo service nginx restart` 78 | 79 | #### 重启php: 80 | PHP 54 81 | `sudo service php54-fpm restart` 82 | PHP 7 83 | `sudo service php-fpm restart` 84 | 85 | -------------------------------------------------------------------------------- /summer-web-local/command/command.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | javac -encoding utf8 -classpath ./ summer/ShareFunc.java 4 | javac -encoding utf8 -classpath ./ summer/Function.java 5 | javac -encoding utf8 -classpath ./ summer/SearchCourse.java 6 | javac -encoding utf8 -classpath ./ summerpt/SearchCourse.java 7 | javac -encoding utf8 -classpath ./ summer/SearchDraw.java 8 | javac -encoding utf8 -classpath ./ summerpt/SearchDraw.java 9 | javac -encoding utf8 -classpath ./ summer/SearchSign.java 10 | javac -encoding utf8 -classpath ./ summerpt/SearchSign.java 11 | javac -encoding utf8 -classpath ./ summer/PrintDraw.java 12 | javac -encoding utf8 -classpath ./ summer/SearchSign.java 13 | javac -encoding utf8 -classpath ./ summer/ShowCourse.java 14 | javac -encoding utf8 -classpath ./ summerpt/ShowCourse.java 15 | javac -encoding utf8 -classpath ./ summer/Sign.java 16 | javac -encoding utf8 -classpath ./ summerpt/Sign.java 17 | javac -encoding utf8 -classpath ./ summer/GetCategory.java 18 | javac -encoding utf8 -classpath ./ summer/SA_2015.java 19 | javac -encoding utf8 -classpath ./ summer/ShowCourse_toplux.java 20 | javac -encoding utf8 -classpath ./ util/MysqlConnection.java 21 | javac -encoding utf8 -classpath ./ util/ResourceUtil.java 22 | javac -encoding utf8 -classpath ../lib/ojdbc14.jar:./ summer/Report.java 23 | javac -encoding utf8 -classpath ../lib/ojdbc14.jar:./ summer/ShowCourseOraclePstat.java 24 | javac -encoding utf8 -classpath ../lib/ojdbc14.jar:./ summer/SearchCourseOraclePstat.java 25 | javac -encoding utf8 -classpath ../lib/ojdbc14.jar:./ summerpt/ShowCourseOraclePstat.java 26 | javac -encoding utf8 -classpath ../lib/ojdbc14.jar:./ summer/GetCategoryOracle.java 27 | javac -encoding utf8 -classpath ./:../lib/ojdbc14.jar util/myOracleConnection.java 28 | javac -encoding utf8 -classpath ./ summer/SA_2015O.java 29 | 30 | # java -cp ./:../lib/mm.mysql-2.0.11-bin.jar TestMySQL 31 | native2ascii -encoding UTF-8 i18n/Trans_cn.txt i18n/Trans_cn.properties 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /summer-web-local/docker-compose.yml: -------------------------------------------------------------------------------- 1 | 2 | app: 3 | image: tutum/tomcat:4.1 4 | ports: 5 | - "8888:8080" 6 | volumes: 7 | - ../summer-web-local:/tomcat/webapps/ROOT 8 | # java: 9 | # image: java:8-jdk 10 | # volumes: 11 | # - ../summer-web:/user/src/webapp 12 | # - ./command:/user/src/webapp/WEB-INF/classes/docker-command 13 | # working_dir: /user/src/webapp/WEB-INF/classes 14 | # command: 15 | # bash 16 | # # ./docker-command/command.sh 17 | -------------------------------------------------------------------------------- /summer-web/ReadMe.md: -------------------------------------------------------------------------------- 1 | # summer-web in docker 2 | 3 | ## Docker环境配置 4 | 5 | ### For mac or pc 6 | #### 安装 Docker-ToolBox 7 | [Download Link](https://www.docker.com/products/docker-toolbox) 8 | 9 | #### 开启与配置Docker Machine 10 | ``` 11 | docker-machine start default 12 | 13 | eval $(docker-machine env default) 14 | ``` 15 | ### For linux 16 | 17 | #### 安装docker 18 | 19 | [Link](https://docs.docker.com/engine/installation/linux/centos/) 20 | 21 | ## 预设 22 | 23 | * Change `/summer-web-path` in `docker-compose.yml` 24 | ``` 25 | ... 26 | volumes: 27 | - /path-to-your-summer-folder-name:/tomcat/webapps/ROOT 28 | ... 29 | ``` 30 | 31 | #### 部署 32 | ``` 33 | docker-compose up -d 34 | ``` 35 | #### 检查环境 36 | ``` 37 | docker-compose ps 38 | ``` 39 | 40 | #### 编译java 41 | ``` 42 | docker-compose run java javac xxxx 43 | 44 | javac xxxx in command/command.sh 45 | 46 | ``` 47 | 48 | #### 日志 49 | ``` 50 | docker-compose logs tomcatapp 51 | ``` 52 | 53 | #### 葡语encoder 54 | 55 | http://www.web2generators.com/html-based-tools/online-html-entities-encoder-and-decoder 56 | 57 | 58 | ## IDEA配置: 59 | 60 | #### 下载 61 | https://www.jetbrains.com/idea/ 62 | 63 | #### 导入 64 | 选择 `Open Project` 65 | 66 | #### 配置Project Structure 67 | 1. `Project`选项 添加java SDK 68 | 2. `Modules`选项 修改`WEB-INF/classes`为Sources 69 | 3. `Libraries`选项 添加`javax.servlet.jsp:jsp-api:2.2`依赖 70 | 71 | 72 | Summer Activity Server 73 | #### 重启tomcat: 74 | `sudo service tomcat restart` 75 | 76 | #### 重启nginx: 77 | `sudo service nginx restart` 78 | 79 | #### 重启php: 80 | PHP 54 81 | `sudo service php54-fpm restart` 82 | PHP 7 83 | `sudo service php-fpm restart` 84 | 85 | -------------------------------------------------------------------------------- /summer-web/command/command.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | javac -encoding utf8 -classpath ./ summer/ShareFunc.java 4 | javac -encoding utf8 -classpath ./ summer/Function.java 5 | javac -encoding utf8 -classpath ./ summer/SearchCourse.java 6 | javac -encoding utf8 -classpath ./ summerpt/SearchCourse.java 7 | javac -encoding utf8 -classpath ./ summer/SearchDraw.java 8 | javac -encoding utf8 -classpath ./ summerpt/SearchDraw.java 9 | javac -encoding utf8 -classpath ./ summer/SearchSign.java 10 | javac -encoding utf8 -classpath ./ summerpt/SearchSign.java 11 | javac -encoding utf8 -classpath ./ summer/PrintDraw.java 12 | javac -encoding utf8 -classpath ./ summer/SearchSign.java 13 | javac -encoding utf8 -classpath ./ summer/ShowCourse.java 14 | javac -encoding utf8 -classpath ./ summerpt/ShowCourse.java 15 | javac -encoding utf8 -classpath ./ summer/Sign.java 16 | javac -encoding utf8 -classpath ./ summerpt/Sign.java 17 | javac -encoding utf8 -classpath ./ summer/GetCategory.java 18 | javac -encoding utf8 -classpath ./ summer/SA_2015.java 19 | javac -encoding utf8 -classpath ./ summer/ShowCourse_toplux.java 20 | javac -encoding utf8 -classpath ./ util/MysqlConnection.java 21 | javac -encoding utf8 -classpath ./ util/ResourceUtil.java 22 | javac -encoding utf8 -classpath ./ summer/GetCategoryOracle.java 23 | javac -encoding utf8 -classpath ./:../lib/ojdbc6.jar:../lib/ucp.jar util/myOracleConnection.java 24 | 25 | javac -encoding utf8 -classpath ../lib/ojdbc14.jar:./ summer/Report.java 26 | javac -encoding utf8 -classpath ../lib/ojdbc14.jar:./ summer/ShowCourseOraclePstat.java 27 | javac -encoding utf8 -classpath ../lib/ojdbc14.jar:./ summer/SearchCourseOraclePstat.java 28 | javac -encoding utf8 -classpath ../lib/ojdbc14.jar:./ summerpt/ShowCourseOraclePstat.java 29 | 30 | 31 | javac -encoding utf8 -classpath ./ summer/SA_2015O.java 32 | 33 | # java -cp ./:../lib/mm.mysql-2.0.11-bin.jar TestMySQL 34 | native2ascii -encoding UTF-8 i18n/Trans_cn.txt i18n/Trans_cn.properties 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /summer-web/docker-compose.swarm.yml: -------------------------------------------------------------------------------- 1 | nginx: 2 | image: nginx 3 | ports: 4 | - "29000:443" 5 | volumes: 6 | - "/etc/nginx/conf.d" 7 | - "/etc/nginx/vhost.d" 8 | - "/usr/share/nginx/html" 9 | - "./certs:/etc/nginx/certs:ro" 10 | gen: 11 | image: jwilder/docker-gen 12 | volumes_from: nginx 13 | volumes: 14 | - "/etc/docker-gen/templates/nginx.tmpl:ro" 15 | - "/var/run/docker.sock:/tmp/docker.sock:ro" 16 | command: 17 | -notify-sighup nginx -watch -only-exposed -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf 18 | letsencrypt: 19 | image: jrcs/letsencrypt-nginx-proxy-companion 20 | volumes_from: nginx 21 | volumes: 22 | - "./certs:/etc/nginx/certs:rw" 23 | - "/var/run/docker.sock:/tmp/docker.sock:ro" 24 | sentry: 25 | image: slafs/sentry 26 | env_file: 27 | - "environment" 28 | environment: 29 | - LETSENCRYPT_HOST=sentry.escher.wizmacau.com 30 | - LETSENCRYPT_EMAIL=it@wizmacau.com 31 | links: 32 | - "postgres:postgresdb" 33 | - "redis:redis" 34 | ports: 35 | - "29000:9000" 36 | volumes: 37 | - "/home/docker-compose/sentry/data:/data" 38 | postgres: 39 | image: postgres:9.4.1 40 | redis: 41 | image: redis:2.8.19 -------------------------------------------------------------------------------- /summer-web/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | app: 4 | image: tomcat:8.0-jre8 5 | depends_on: 6 | - db 7 | volumes: 8 | - ../summer-web:/usr/local/tomcat/webapps/ROOT 9 | labels: 10 | - "traefik.port=8080" 11 | - "traefik.backend=summer" 12 | - "traefik.frontend.rule=Host:summer.l.wizmacau.com" 13 | networks: 14 | - web 15 | java: 16 | image: java:8-jdk 17 | volumes: 18 | - ../summer-web:/user/src/webapp 19 | - ./command:/user/src/webapp/WEB-INF/classes/docker-command 20 | working_dir: /user/src/webapp/WEB-INF/classes 21 | command: 22 | bash 23 | # ./docker-command/command.sh 24 | db: 25 | image: mysql 26 | ports: 27 | - "3306:3306" 28 | environment: 29 | - MYSQL_ROOT_PASSWORD=summer 30 | - MYSQL_DATABASE=summer03 31 | - MYSQL_USER=summer 32 | - MYSQL_PASSWORD=summer 33 | networks: 34 | web: 35 | external: 36 | name: traefik_webgateway -------------------------------------------------------------------------------- /swarm/docker-compose.yml: -------------------------------------------------------------------------------- 1 | manager: 2 | image: swarm 3 | restart: always 4 | ports: 5 | - 4000:4000 6 | command: 7 | manage --host tcp://0.0.0.0:4000 etcd://etcd.darg.ws 8 | proxy: 9 | image: ehazlett/docker-proxy:latest 10 | command: -i 11 | restart: always 12 | ports: 13 | - "2375:2375" 14 | volumes: 15 | - "/var/run/docker.sock:/var/run/docker.sock" 16 | swarm: 17 | image: swarm 18 | command: 19 | join --advertise 192.168.99.106:2375 etcd://etcd.darg.ws -------------------------------------------------------------------------------- /swarm/docker_cmd.sh: -------------------------------------------------------------------------------- 1 | export DOCKER_HOST=$(docker-machine ip default):4000 2 | 3 | docker run \ 4 | -ti \ 5 | -d \ 6 | --restart=always \ 7 | --name shipyard-swarm-manager \ 8 | swarm:latest \ 9 | manage --host tcp://0.0.0.0:4000 etcd://etcd.darg.ws 10 | 11 | docker run \ 12 | -ti \ 13 | -d \ 14 | --restart=always \ 15 | --name shipyard-swarm-agent \ 16 | swarm:latest \ 17 | join --addr 192.168.30.57:2376 etcd://etcd.darg.ws 18 | 19 | 20 | 21 | docker-machine create \ 22 | -d virtualbox \ 23 | --engine-opt="cluster-store=etcd://etcd.darg.ws" \ 24 | --engine-opt="cluster-advertise=eth1:2376" \ 25 | swarm-agent 26 | 27 | 28 | 29 | docker --tlscacert="/Users/llitfkitfk/.docker/machine/certs/ca.pem" \ 30 | --tlscert="/Users/llitfkitfk/.docker/machine/certs/cert.pem" \ 31 | --tlskey="/Users/llitfkitfk/.docker/machine/certs/key.pem" \ 32 | -H tcp://192.168.99.100:2375 info -------------------------------------------------------------------------------- /symfony/.gitignore: -------------------------------------------------------------------------------- 1 | /data 2 | config/nginx/logs -------------------------------------------------------------------------------- /symfony/ReadMe.md: -------------------------------------------------------------------------------- 1 | # **Symfony in Docker** 2 | 3 | 4 | ## Docker Configuration 5 | 6 | ### For mac or pc 7 | #### Install Docker-ToolBox 8 | [Download Link](https://www.docker.com/products/docker-toolbox) 9 | 10 | #### Start & config docker machine 11 | ``` 12 | docker-machine start default 13 | 14 | eval $(docker-machine env default) 15 | ``` 16 | ### For linux 17 | #### Install docker 18 | [Link](https://docs.docker.com/engine/installation/linux/centos/) 19 | 20 | ## Prerequisites 21 | 22 | * Change `/symfony-project-path` in `docker-compose.yml` 23 | ``` 24 | app: 25 | build: code 26 | volumes: 27 | - /path-to-your-symfony-project-folder-name:/symfony 28 | ``` 29 | 30 | * php running environment: 31 | * php54 (by default) 32 | * if using php56/php70: just ununcomment php56/php70 in `docker-compose.yml` (php56 in demo): 33 | 34 | ``` 35 | ... 36 | 37 | php56: 38 | build: php56 39 | volumes: 40 | - ./config/php56/symfony.ini:/usr/local/etc/php/conf.d/symfony.ini 41 | - ./config/php56/php-fpm.conf:/etc/php-fpm.conf 42 | links: 43 | - db 44 | - redis 45 | volumes_from: 46 | - app 47 | ... 48 | 49 | nginx: 50 | image: nginx 51 | ports: 52 | - 80:80 53 | volumes: 54 | - ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro 55 | - ./config/nginx/php54.conf:/etc/nginx/conf.d/php54.conf 56 | - ./config/nginx/php56.conf:/etc/nginx/conf.d/php56.conf 57 | # - ./config/nginx/php70.conf:/etc/nginx/conf.d/php70.conf 58 | - ./config/nginx/logs:/var/log/nginx 59 | links: 60 | - php54 61 | - php56 62 | # - php70 63 | volumes_from: 64 | - app 65 | ``` 66 | 67 | 68 | ## Deploy symfony in Docker 69 | 70 | #### Build 71 | ``` 72 | docker-compose build 73 | ``` 74 | 75 | #### Deploy 76 | ``` 77 | docker-compose up -d 78 | ``` 79 | 80 | #### check runing 81 | ``` 82 | docker-compose ps 83 | ``` 84 | 85 | #### logs 86 | ``` 87 | docker-compose logs nginx 88 | ``` 89 | #### db 90 | * symfony project config: 91 | * Modify symfony-project `app/config/parameters.yml` 92 | ``` 93 | parameters: 94 | ... 95 | database_host: db 96 | redis_host: redis 97 | ... 98 | ``` 99 | 100 | * GUI Connection: IP 101 | ``` 102 | docker-machine ip default 103 | ``` 104 | 105 | * MySQL_PASSWORD in `docker-compose.yml`: 106 | ``` 107 | db: 108 | image: mysql 109 | ports: 110 | - 3306:3306 111 | environment: 112 | MYSQL_ROOT_PASSWORD: root 113 | MYSQL_DATABASE: symfony 114 | MYSQL_USER: root 115 | MYSQL_PASSWORD: root 116 | ``` 117 | 118 | #### Command 119 | * run `./app/console` 120 | ``` 121 | docker-compose run php ./app/console 122 | ``` 123 | * run `./cc` 124 | ``` 125 | docker-compose run php ./cc 126 | ``` 127 | * ... 128 | 129 | ## Launcher 130 | 131 | * Add Hosts (using php54) 132 | ``` 133 | echo "$(docker-machine ip default) php54.symfony.dev" >> /etc/hosts 134 | ``` 135 | 136 | * Open Browser http://php54.symfony.dev/app_dev.php/admintools 137 | 138 | 139 | -------------------------------------------------------------------------------- /symfony/config/nginx/app.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name app.symfony.dev; 3 | 4 | error_log /var/log/nginx/symfony_error.log; 5 | access_log /var/log/nginx/symfony_access.log; 6 | 7 | set $root_path /symfony/web; 8 | root $root_path; 9 | 10 | location / { 11 | try_files $uri @rewriteapp; 12 | } 13 | 14 | location @rewriteapp { 15 | rewrite ^(.*)$ /app.php/$1 last; 16 | } 17 | 18 | location ~ ^/(app|app_dev|config)\.php(/|$) { 19 | fastcgi_pass php-upstream; 20 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 21 | include fastcgi_params; 22 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 23 | fastcgi_param HTTPS off; 24 | } 25 | 26 | 27 | 28 | } -------------------------------------------------------------------------------- /symfony/config/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | user www-data; 2 | worker_processes 4; 3 | pid /run/nginx.pid; 4 | 5 | events { 6 | worker_connections 2048; 7 | } 8 | 9 | http { 10 | sendfile on; 11 | keepalive_timeout 65; 12 | include /etc/nginx/mime.types; 13 | default_type application/octet-stream; 14 | #gzip on; 15 | include /etc/nginx/conf.d/*.conf; 16 | include /etc/nginx/sites-enabled/*; 17 | } 18 | 19 | daemon off; -------------------------------------------------------------------------------- /symfony/config/nginx/php54.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name php54.symfony.dev; 3 | root /symfony/web; 4 | 5 | location / { 6 | try_files $uri @rewriteapp; 7 | } 8 | 9 | location @rewriteapp { 10 | rewrite ^(.*)$ /app.php/$1 last; 11 | } 12 | 13 | location ~ ^/(app|app_dev|config)\.php(/|$) { 14 | fastcgi_pass php54:9000; 15 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 16 | include fastcgi_params; 17 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 18 | fastcgi_param HTTPS off; 19 | } 20 | 21 | error_log /var/log/nginx/symfony_error.log; 22 | access_log /var/log/nginx/symfony_access.log; 23 | } -------------------------------------------------------------------------------- /symfony/config/nginx/php56.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name symfony.dev; 3 | root /symfony/web; 4 | 5 | 6 | location / { 7 | try_files $uri @rewriteapp; 8 | } 9 | 10 | location @rewriteapp { 11 | rewrite ^(.*)$ /app.php/$1 last; 12 | } 13 | 14 | location ~ ^/(app|app_dev|config)\.php(/|$) { 15 | fastcgi_pass php-upstream; 16 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 17 | include fastcgi_params; 18 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 19 | fastcgi_param HTTPS off; 20 | } 21 | 22 | error_log /var/log/nginx/symfony_error.log; 23 | access_log /var/log/nginx/symfony_access.log; 24 | } -------------------------------------------------------------------------------- /symfony/config/nginx/php70.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name php70.symfony.dev; 3 | root /symfony/web; 4 | 5 | location / { 6 | try_files $uri @rewriteapp; 7 | } 8 | 9 | location @rewriteapp { 10 | rewrite ^(.*)$ /app.php/$1 last; 11 | } 12 | 13 | location ~ ^/(app|app_dev|config)\.php(/|$) { 14 | fastcgi_pass php70:9000; 15 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 16 | include fastcgi_params; 17 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 18 | fastcgi_param HTTPS off; 19 | } 20 | 21 | error_log /var/log/nginx/symfony_error.log; 22 | access_log /var/log/nginx/symfony_access.log; 23 | } -------------------------------------------------------------------------------- /symfony/config/nginx/upstream.conf: -------------------------------------------------------------------------------- 1 | upstream php-upstream { server app:9000; } -------------------------------------------------------------------------------- /symfony/config/php54/php-fpm.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'symfony'. 2 | ; the variable $pool can we used in any directive and will be replaced by the 3 | ; pool name ('symfony' here) 4 | [symfony] 5 | 6 | ; Unix user/group of processes 7 | ; Note: The user is mandatory. If the group is not set, the default user's group 8 | ; will be used. 9 | user = www-data 10 | group = www-data 11 | 12 | ; The address on which to accept FastCGI requests. 13 | ; Valid syntaxes are: 14 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on 15 | ; a specific port; 16 | ; 'port' - to listen on a TCP socket to all addresses on a 17 | ; specific port; 18 | ; '/path/to/unix/socket' - to listen on a unix socket. 19 | ; Note: This value is mandatory. 20 | listen = 0.0.0.0:9000 21 | 22 | ; Choose how the process manager will control the number of child processes. 23 | ; Possible Values: 24 | ; static - a fixed number (pm.max_children) of child processes; 25 | ; dynamic - the number of child processes are set dynamically based on the 26 | ; following directives. With this process management, there will be 27 | ; always at least 1 children. 28 | ; pm.max_children - the maximum number of children that can 29 | ; be alive at the same time. 30 | ; pm.start_servers - the number of children created on startup. 31 | ; pm.min_spare_servers - the minimum number of children in 'idle' 32 | ; state (waiting to process). If the number 33 | ; of 'idle' processes is less than this 34 | ; number then some children will be created. 35 | ; pm.max_spare_servers - the maximum number of children in 'idle' 36 | ; state (waiting to process). If the number 37 | ; of 'idle' processes is greater than this 38 | ; number then some children will be killed. 39 | ; ondemand - no children are created at startup. Children will be forked when 40 | ; new requests will connect. The following parameter are used: 41 | ; pm.max_children - the maximum number of children that 42 | ; can be alive at the same time. 43 | ; pm.process_idle_timeout - The number of seconds after which 44 | ; an idle process will be killed. 45 | ; Note: This value is mandatory. 46 | pm = dynamic 47 | 48 | ; The number of child processes to be created when pm is set to 'static' and the 49 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 50 | ; This value sets the limit on the number of simultaneous requests that will be 51 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 52 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 53 | ; CGI. The below defaults are based on a server without much resources. Don't 54 | ; forget to tweak pm.* to fit your needs. 55 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 56 | ; Note: This value is mandatory. 57 | pm.max_children = 20 58 | 59 | ; The number of child processes created on startup. 60 | ; Note: Used only when pm is set to 'dynamic' 61 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 62 | pm.start_servers = 2 63 | 64 | ; The desired minimum number of idle server processes. 65 | ; Note: Used only when pm is set to 'dynamic' 66 | ; Note: Mandatory when pm is set to 'dynamic' 67 | pm.min_spare_servers = 1 68 | 69 | ; The desired maximum number of idle server processes. 70 | ; Note: Used only when pm is set to 'dynamic' 71 | ; Note: Mandatory when pm is set to 'dynamic' 72 | pm.max_spare_servers = 3 73 | 74 | ;--------------------- 75 | 76 | ; Make specific Docker environment variables available to PHP 77 | env[DB_1_ENV_MYSQL_DATABASE] = $DB_1_ENV_MYSQL_DATABASE 78 | env[DB_1_ENV_MYSQL_USER] = $DB_1_ENV_MYSQL_USER 79 | env[DB_1_ENV_MYSQL_PASSWORD] = $DB_1_ENV_MYSQL_PASSWORD 80 | 81 | catch_workers_output = yes -------------------------------------------------------------------------------- /symfony/config/php54/symfony.ini: -------------------------------------------------------------------------------- 1 | date.timezone =Asia/Macao -------------------------------------------------------------------------------- /symfony/config/php56/php-fpm.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'symfony'. 2 | ; the variable $pool can we used in any directive and will be replaced by the 3 | ; pool name ('symfony' here) 4 | [symfony] 5 | 6 | ; Unix user/group of processes 7 | ; Note: The user is mandatory. If the group is not set, the default user's group 8 | ; will be used. 9 | user = www-data 10 | group = www-data 11 | 12 | ; The address on which to accept FastCGI requests. 13 | ; Valid syntaxes are: 14 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on 15 | ; a specific port; 16 | ; 'port' - to listen on a TCP socket to all addresses on a 17 | ; specific port; 18 | ; '/path/to/unix/socket' - to listen on a unix socket. 19 | ; Note: This value is mandatory. 20 | listen = 0.0.0.0:9000 21 | 22 | ; Choose how the process manager will control the number of child processes. 23 | ; Possible Values: 24 | ; static - a fixed number (pm.max_children) of child processes; 25 | ; dynamic - the number of child processes are set dynamically based on the 26 | ; following directives. With this process management, there will be 27 | ; always at least 1 children. 28 | ; pm.max_children - the maximum number of children that can 29 | ; be alive at the same time. 30 | ; pm.start_servers - the number of children created on startup. 31 | ; pm.min_spare_servers - the minimum number of children in 'idle' 32 | ; state (waiting to process). If the number 33 | ; of 'idle' processes is less than this 34 | ; number then some children will be created. 35 | ; pm.max_spare_servers - the maximum number of children in 'idle' 36 | ; state (waiting to process). If the number 37 | ; of 'idle' processes is greater than this 38 | ; number then some children will be killed. 39 | ; ondemand - no children are created at startup. Children will be forked when 40 | ; new requests will connect. The following parameter are used: 41 | ; pm.max_children - the maximum number of children that 42 | ; can be alive at the same time. 43 | ; pm.process_idle_timeout - The number of seconds after which 44 | ; an idle process will be killed. 45 | ; Note: This value is mandatory. 46 | pm = dynamic 47 | 48 | ; The number of child processes to be created when pm is set to 'static' and the 49 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 50 | ; This value sets the limit on the number of simultaneous requests that will be 51 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 52 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 53 | ; CGI. The below defaults are based on a server without much resources. Don't 54 | ; forget to tweak pm.* to fit your needs. 55 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 56 | ; Note: This value is mandatory. 57 | pm.max_children = 20 58 | 59 | ; The number of child processes created on startup. 60 | ; Note: Used only when pm is set to 'dynamic' 61 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 62 | pm.start_servers = 2 63 | 64 | ; The desired minimum number of idle server processes. 65 | ; Note: Used only when pm is set to 'dynamic' 66 | ; Note: Mandatory when pm is set to 'dynamic' 67 | pm.min_spare_servers = 1 68 | 69 | ; The desired maximum number of idle server processes. 70 | ; Note: Used only when pm is set to 'dynamic' 71 | ; Note: Mandatory when pm is set to 'dynamic' 72 | pm.max_spare_servers = 3 73 | 74 | ;--------------------- 75 | 76 | ; Make specific Docker environment variables available to PHP 77 | env[DB_1_ENV_MYSQL_DATABASE] = $DB_1_ENV_MYSQL_DATABASE 78 | env[DB_1_ENV_MYSQL_USER] = $DB_1_ENV_MYSQL_USER 79 | env[DB_1_ENV_MYSQL_PASSWORD] = $DB_1_ENV_MYSQL_PASSWORD 80 | 81 | catch_workers_output = yes -------------------------------------------------------------------------------- /symfony/config/php56/symfony.ini: -------------------------------------------------------------------------------- 1 | date.timezone =Asia/Macao -------------------------------------------------------------------------------- /symfony/config/php70/php-fpm.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'symfony'. 2 | ; the variable $pool can we used in any directive and will be replaced by the 3 | ; pool name ('symfony' here) 4 | [symfony] 5 | 6 | ; Unix user/group of processes 7 | ; Note: The user is mandatory. If the group is not set, the default user's group 8 | ; will be used. 9 | user = www-data 10 | group = www-data 11 | 12 | ; The address on which to accept FastCGI requests. 13 | ; Valid syntaxes are: 14 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on 15 | ; a specific port; 16 | ; 'port' - to listen on a TCP socket to all addresses on a 17 | ; specific port; 18 | ; '/path/to/unix/socket' - to listen on a unix socket. 19 | ; Note: This value is mandatory. 20 | listen = 0.0.0.0:9000 21 | 22 | ; Choose how the process manager will control the number of child processes. 23 | ; Possible Values: 24 | ; static - a fixed number (pm.max_children) of child processes; 25 | ; dynamic - the number of child processes are set dynamically based on the 26 | ; following directives. With this process management, there will be 27 | ; always at least 1 children. 28 | ; pm.max_children - the maximum number of children that can 29 | ; be alive at the same time. 30 | ; pm.start_servers - the number of children created on startup. 31 | ; pm.min_spare_servers - the minimum number of children in 'idle' 32 | ; state (waiting to process). If the number 33 | ; of 'idle' processes is less than this 34 | ; number then some children will be created. 35 | ; pm.max_spare_servers - the maximum number of children in 'idle' 36 | ; state (waiting to process). If the number 37 | ; of 'idle' processes is greater than this 38 | ; number then some children will be killed. 39 | ; ondemand - no children are created at startup. Children will be forked when 40 | ; new requests will connect. The following parameter are used: 41 | ; pm.max_children - the maximum number of children that 42 | ; can be alive at the same time. 43 | ; pm.process_idle_timeout - The number of seconds after which 44 | ; an idle process will be killed. 45 | ; Note: This value is mandatory. 46 | pm = dynamic 47 | 48 | ; The number of child processes to be created when pm is set to 'static' and the 49 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 50 | ; This value sets the limit on the number of simultaneous requests that will be 51 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 52 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 53 | ; CGI. The below defaults are based on a server without much resources. Don't 54 | ; forget to tweak pm.* to fit your needs. 55 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 56 | ; Note: This value is mandatory. 57 | pm.max_children = 20 58 | 59 | ; The number of child processes created on startup. 60 | ; Note: Used only when pm is set to 'dynamic' 61 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 62 | pm.start_servers = 2 63 | 64 | ; The desired minimum number of idle server processes. 65 | ; Note: Used only when pm is set to 'dynamic' 66 | ; Note: Mandatory when pm is set to 'dynamic' 67 | pm.min_spare_servers = 1 68 | 69 | ; The desired maximum number of idle server processes. 70 | ; Note: Used only when pm is set to 'dynamic' 71 | ; Note: Mandatory when pm is set to 'dynamic' 72 | pm.max_spare_servers = 3 73 | 74 | ;--------------------- 75 | 76 | ; Make specific Docker environment variables available to PHP 77 | env[DB_1_ENV_MYSQL_DATABASE] = $DB_1_ENV_MYSQL_DATABASE 78 | env[DB_1_ENV_MYSQL_USER] = $DB_1_ENV_MYSQL_USER 79 | env[DB_1_ENV_MYSQL_PASSWORD] = $DB_1_ENV_MYSQL_PASSWORD 80 | 81 | catch_workers_output = yes -------------------------------------------------------------------------------- /symfony/config/php70/symfony.ini: -------------------------------------------------------------------------------- 1 | date.timezone =Asia/Macao -------------------------------------------------------------------------------- /symfony/docker-compose.yml: -------------------------------------------------------------------------------- 1 | db: 2 | image: mysql 3 | ports: 4 | - 3306:3306 5 | environment: 6 | MYSQL_ROOT_PASSWORD: root 7 | MYSQL_DATABASE: symfony 8 | MYSQL_USER: root 9 | MYSQL_PASSWORD: root 10 | app: 11 | image: dockerepo/symfony 12 | ports: 13 | - 9000:9000 14 | volumes: 15 | - ./config/php70/symfony.ini:/usr/local/etc/php/conf.d/symfony.ini 16 | - ./config/php70/php-fpm.conf:/usr/local/etc/php-fpm.conf 17 | - ~/Documents/git/app/symfony:/symfony 18 | links: 19 | - db 20 | nginx: 21 | image: dockerepo/nginx 22 | ports: 23 | - 80:80 24 | volumes_from: 25 | - app 26 | volumes: 27 | - ./config/nginx/nginx.conf:/etc/nginx/nginx.conf 28 | - ./config/nginx/upstream.conf:/etc/nginx/conf.d/upstream.conf 29 | - ./config/nginx/app.conf:/etc/nginx/conf.d/app.conf 30 | - ./data/logs:/var/log/nginx 31 | links: 32 | - app 33 | composer: 34 | image: dockerepo/composer 35 | entrypoint: sh 36 | stdin_open: true 37 | tty: true 38 | volumes: 39 | - ~/Documents/git/app/symfony:/app 40 | - ~/.ssh:/root/.ssh 41 | - composer:/composer -------------------------------------------------------------------------------- /symfony/php56/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:5.6-fpm 2 | 3 | # update 4 | RUN apt-get update 5 | 6 | # extension - except: imagick apc xdebug geoip redis 7 | RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng12-dev 8 | RUN docker-php-ext-install iconv mcrypt mysql mysqli pdo pdo_mysql mbstring gd 9 | RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 10 | 11 | # extension - redis 12 | ENV PHP_REDIS_VERSION 2.2.7 13 | RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/${PHP_REDIS_VERSION}.tar.gz \ 14 | && tar xfz /tmp/redis.tar.gz \ 15 | && rm -r /tmp/redis.tar.gz \ 16 | && mv phpredis-${PHP_REDIS_VERSION} /usr/src/php/ext/redis \ 17 | && docker-php-ext-install redis 18 | 19 | RUN usermod -u 1000 www-data 20 | 21 | WORKDIR /symfony 22 | 23 | EXPOSE 9000 24 | 25 | VOLUME ["/user/local/etc/php/conf.d/symfony.ini"] 26 | VOLUME ["/etc/php-fpm.conf"] 27 | 28 | CMD ["php-fpm", "-F"] -------------------------------------------------------------------------------- /symfony_dev/.gitignore: -------------------------------------------------------------------------------- 1 | /config/nginx/logs 2 | /project -------------------------------------------------------------------------------- /symfony_dev/ReadMe.md: -------------------------------------------------------------------------------- 1 | # **Symfony in Docker** 2 | 3 | 4 | ## Docker Configuration 5 | 6 | ### For mac or pc 7 | #### Install Docker-ToolBox 8 | [Download Link](https://www.docker.com/products/docker-toolbox) 9 | 10 | #### Start & config docker machine 11 | ``` 12 | docker-machine start default 13 | 14 | eval $(docker-machine env default) 15 | ``` 16 | ### For linux 17 | #### Install docker 18 | [Link](https://docs.docker.com/engine/installation/linux/centos/) 19 | 20 | ## Prerequisites 21 | 22 | * Change `/symfony-project-path` in `docker-compose.yml` 23 | ``` 24 | app: 25 | build: code 26 | volumes: 27 | - /path-to-your-symfony-project-folder-name:/symfony 28 | ``` 29 | 30 | * php running environment: 31 | * php54 (by default) 32 | * if using php56/php70: just ununcomment php56/php70 in `docker-compose.yml` (php56 in demo): 33 | 34 | ``` 35 | ... 36 | 37 | php56: 38 | build: php56 39 | volumes: 40 | - ./config/php56/symfony.ini:/usr/local/etc/php/conf.d/symfony.ini 41 | - ./config/php56/php-fpm.conf:/etc/php-fpm.conf 42 | links: 43 | - db 44 | - redis 45 | volumes_from: 46 | - app 47 | ... 48 | 49 | nginx: 50 | image: nginx 51 | ports: 52 | - 80:80 53 | volumes: 54 | - ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro 55 | - ./config/nginx/php54.conf:/etc/nginx/conf.d/php54.conf 56 | - ./config/nginx/php56.conf:/etc/nginx/conf.d/php56.conf 57 | # - ./config/nginx/php70.conf:/etc/nginx/conf.d/php70.conf 58 | - ./config/nginx/logs:/var/log/nginx 59 | links: 60 | - php54 61 | - php56 62 | # - php70 63 | volumes_from: 64 | - app 65 | ``` 66 | 67 | 68 | ## Deploy symfony in Docker 69 | 70 | #### Build 71 | ``` 72 | docker-compose build 73 | ``` 74 | 75 | #### Deploy 76 | ``` 77 | docker-compose up -d 78 | ``` 79 | 80 | #### check runing 81 | ``` 82 | docker-compose ps 83 | ``` 84 | 85 | #### logs 86 | ``` 87 | docker-compose logs nginx 88 | ``` 89 | #### db 90 | * symfony project config: 91 | * Modify symfony-project `app/config/parameters.yml` 92 | ``` 93 | parameters: 94 | ... 95 | database_host: db 96 | redis_host: redis 97 | ... 98 | ``` 99 | 100 | * GUI Connection: IP 101 | ``` 102 | docker-machine ip default 103 | ``` 104 | 105 | * MySQL_PASSWORD in `docker-compose.yml`: 106 | ``` 107 | db: 108 | image: mysql 109 | ports: 110 | - 3306:3306 111 | environment: 112 | MYSQL_ROOT_PASSWORD: root 113 | MYSQL_DATABASE: symfony 114 | MYSQL_USER: root 115 | MYSQL_PASSWORD: root 116 | ``` 117 | 118 | #### Command 119 | * run `./app/console` 120 | ``` 121 | docker-compose run php ./app/console 122 | ``` 123 | * run `./cc` 124 | ``` 125 | docker-compose run php ./cc 126 | ``` 127 | * ... 128 | 129 | ## Launcher 130 | 131 | * Add Hosts (using php54) 132 | ``` 133 | echo "$(docker-machine ip default) php54.symfony.dev" >> /etc/hosts 134 | ``` 135 | 136 | * Open Browser http://php54.symfony.dev/app_dev.php/admintools 137 | 138 | 139 | -------------------------------------------------------------------------------- /symfony_dev/config/nginx/app.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name app.symfony.dev; 3 | 4 | error_log /var/log/nginx/symfony_error.log; 5 | access_log /var/log/nginx/symfony_access.log; 6 | 7 | set $root_path /symfony/web; 8 | root $root_path; 9 | 10 | location / { 11 | try_files $uri /app_dev.php$is_args$args; 12 | } 13 | 14 | location ~ ^/(index|app|app_dev|config)\.php(/|$) { 15 | fastcgi_pass app:9000; 16 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 17 | include fastcgi_params; 18 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 19 | fastcgi_param HTTPS off; 20 | } 21 | 22 | 23 | 24 | } -------------------------------------------------------------------------------- /symfony_dev/config/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | user www-data; 2 | worker_processes 4; 3 | pid /run/nginx.pid; 4 | 5 | events { 6 | worker_connections 2048; 7 | } 8 | 9 | http { 10 | sendfile on; 11 | keepalive_timeout 65; 12 | include /etc/nginx/mime.types; 13 | default_type application/octet-stream; 14 | #gzip on; 15 | include /etc/nginx/conf.d/*.conf; 16 | include /etc/nginx/sites-enabled/*; 17 | } 18 | 19 | daemon off; -------------------------------------------------------------------------------- /symfony_dev/config/nginx/php54.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name php54.symfony.dev; 3 | root /symfony/web; 4 | 5 | location / { 6 | try_files $uri @rewriteapp; 7 | } 8 | 9 | location @rewriteapp { 10 | rewrite ^(.*)$ /app.php/$1 last; 11 | } 12 | 13 | location ~ ^/(app|app_dev|config)\.php(/|$) { 14 | fastcgi_pass php54:9000; 15 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 16 | include fastcgi_params; 17 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 18 | fastcgi_param HTTPS off; 19 | } 20 | 21 | error_log /var/log/nginx/symfony_error.log; 22 | access_log /var/log/nginx/symfony_access.log; 23 | } -------------------------------------------------------------------------------- /symfony_dev/config/nginx/php56.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name symfony.dev; 3 | root /symfony/web; 4 | 5 | 6 | location / { 7 | try_files $uri @rewriteapp; 8 | } 9 | 10 | location @rewriteapp { 11 | rewrite ^(.*)$ /app.php/$1 last; 12 | } 13 | 14 | location ~ ^/(app|app_dev|config)\.php(/|$) { 15 | fastcgi_pass php-upstream; 16 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 17 | include fastcgi_params; 18 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 19 | fastcgi_param HTTPS off; 20 | } 21 | 22 | error_log /var/log/nginx/symfony_error.log; 23 | access_log /var/log/nginx/symfony_access.log; 24 | } -------------------------------------------------------------------------------- /symfony_dev/config/nginx/php70.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name php70.symfony.dev; 3 | root /symfony/web; 4 | 5 | location / { 6 | try_files $uri @rewriteapp; 7 | } 8 | 9 | location @rewriteapp { 10 | rewrite ^(.*)$ /app.php/$1 last; 11 | } 12 | 13 | location ~ ^/(app|app_dev|config)\.php(/|$) { 14 | fastcgi_pass php70:9000; 15 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 16 | include fastcgi_params; 17 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 18 | fastcgi_param HTTPS off; 19 | } 20 | 21 | error_log /var/log/nginx/symfony_error.log; 22 | access_log /var/log/nginx/symfony_access.log; 23 | } -------------------------------------------------------------------------------- /symfony_dev/config/nginx/upstream.conf: -------------------------------------------------------------------------------- 1 | upstream php-upstream { server app:9000; } -------------------------------------------------------------------------------- /symfony_dev/config/php54/php-fpm.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'symfony'. 2 | ; the variable $pool can we used in any directive and will be replaced by the 3 | ; pool name ('symfony' here) 4 | [symfony] 5 | 6 | ; Unix user/group of processes 7 | ; Note: The user is mandatory. If the group is not set, the default user's group 8 | ; will be used. 9 | user = www-data 10 | group = www-data 11 | 12 | ; The address on which to accept FastCGI requests. 13 | ; Valid syntaxes are: 14 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on 15 | ; a specific port; 16 | ; 'port' - to listen on a TCP socket to all addresses on a 17 | ; specific port; 18 | ; '/path/to/unix/socket' - to listen on a unix socket. 19 | ; Note: This value is mandatory. 20 | listen = 0.0.0.0:9000 21 | 22 | ; Choose how the process manager will control the number of child processes. 23 | ; Possible Values: 24 | ; static - a fixed number (pm.max_children) of child processes; 25 | ; dynamic - the number of child processes are set dynamically based on the 26 | ; following directives. With this process management, there will be 27 | ; always at least 1 children. 28 | ; pm.max_children - the maximum number of children that can 29 | ; be alive at the same time. 30 | ; pm.start_servers - the number of children created on startup. 31 | ; pm.min_spare_servers - the minimum number of children in 'idle' 32 | ; state (waiting to process). If the number 33 | ; of 'idle' processes is less than this 34 | ; number then some children will be created. 35 | ; pm.max_spare_servers - the maximum number of children in 'idle' 36 | ; state (waiting to process). If the number 37 | ; of 'idle' processes is greater than this 38 | ; number then some children will be killed. 39 | ; ondemand - no children are created at startup. Children will be forked when 40 | ; new requests will connect. The following parameter are used: 41 | ; pm.max_children - the maximum number of children that 42 | ; can be alive at the same time. 43 | ; pm.process_idle_timeout - The number of seconds after which 44 | ; an idle process will be killed. 45 | ; Note: This value is mandatory. 46 | pm = dynamic 47 | 48 | ; The number of child processes to be created when pm is set to 'static' and the 49 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 50 | ; This value sets the limit on the number of simultaneous requests that will be 51 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 52 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 53 | ; CGI. The below defaults are based on a server without much resources. Don't 54 | ; forget to tweak pm.* to fit your needs. 55 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 56 | ; Note: This value is mandatory. 57 | pm.max_children = 20 58 | 59 | ; The number of child processes created on startup. 60 | ; Note: Used only when pm is set to 'dynamic' 61 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 62 | pm.start_servers = 2 63 | 64 | ; The desired minimum number of idle server processes. 65 | ; Note: Used only when pm is set to 'dynamic' 66 | ; Note: Mandatory when pm is set to 'dynamic' 67 | pm.min_spare_servers = 1 68 | 69 | ; The desired maximum number of idle server processes. 70 | ; Note: Used only when pm is set to 'dynamic' 71 | ; Note: Mandatory when pm is set to 'dynamic' 72 | pm.max_spare_servers = 3 73 | 74 | ;--------------------- 75 | 76 | ; Make specific Docker environment variables available to PHP 77 | env[DB_1_ENV_MYSQL_DATABASE] = $DB_1_ENV_MYSQL_DATABASE 78 | env[DB_1_ENV_MYSQL_USER] = $DB_1_ENV_MYSQL_USER 79 | env[DB_1_ENV_MYSQL_PASSWORD] = $DB_1_ENV_MYSQL_PASSWORD 80 | 81 | catch_workers_output = yes -------------------------------------------------------------------------------- /symfony_dev/config/php54/symfony.ini: -------------------------------------------------------------------------------- 1 | date.timezone =Asia/Macao -------------------------------------------------------------------------------- /symfony_dev/config/php56/php-fpm.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'symfony'. 2 | ; the variable $pool can we used in any directive and will be replaced by the 3 | ; pool name ('symfony' here) 4 | [symfony] 5 | 6 | ; Unix user/group of processes 7 | ; Note: The user is mandatory. If the group is not set, the default user's group 8 | ; will be used. 9 | user = www-data 10 | group = www-data 11 | 12 | ; The address on which to accept FastCGI requests. 13 | ; Valid syntaxes are: 14 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on 15 | ; a specific port; 16 | ; 'port' - to listen on a TCP socket to all addresses on a 17 | ; specific port; 18 | ; '/path/to/unix/socket' - to listen on a unix socket. 19 | ; Note: This value is mandatory. 20 | listen = 0.0.0.0:9000 21 | 22 | ; Choose how the process manager will control the number of child processes. 23 | ; Possible Values: 24 | ; static - a fixed number (pm.max_children) of child processes; 25 | ; dynamic - the number of child processes are set dynamically based on the 26 | ; following directives. With this process management, there will be 27 | ; always at least 1 children. 28 | ; pm.max_children - the maximum number of children that can 29 | ; be alive at the same time. 30 | ; pm.start_servers - the number of children created on startup. 31 | ; pm.min_spare_servers - the minimum number of children in 'idle' 32 | ; state (waiting to process). If the number 33 | ; of 'idle' processes is less than this 34 | ; number then some children will be created. 35 | ; pm.max_spare_servers - the maximum number of children in 'idle' 36 | ; state (waiting to process). If the number 37 | ; of 'idle' processes is greater than this 38 | ; number then some children will be killed. 39 | ; ondemand - no children are created at startup. Children will be forked when 40 | ; new requests will connect. The following parameter are used: 41 | ; pm.max_children - the maximum number of children that 42 | ; can be alive at the same time. 43 | ; pm.process_idle_timeout - The number of seconds after which 44 | ; an idle process will be killed. 45 | ; Note: This value is mandatory. 46 | pm = dynamic 47 | 48 | ; The number of child processes to be created when pm is set to 'static' and the 49 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 50 | ; This value sets the limit on the number of simultaneous requests that will be 51 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 52 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 53 | ; CGI. The below defaults are based on a server without much resources. Don't 54 | ; forget to tweak pm.* to fit your needs. 55 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 56 | ; Note: This value is mandatory. 57 | pm.max_children = 20 58 | 59 | ; The number of child processes created on startup. 60 | ; Note: Used only when pm is set to 'dynamic' 61 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 62 | pm.start_servers = 2 63 | 64 | ; The desired minimum number of idle server processes. 65 | ; Note: Used only when pm is set to 'dynamic' 66 | ; Note: Mandatory when pm is set to 'dynamic' 67 | pm.min_spare_servers = 1 68 | 69 | ; The desired maximum number of idle server processes. 70 | ; Note: Used only when pm is set to 'dynamic' 71 | ; Note: Mandatory when pm is set to 'dynamic' 72 | pm.max_spare_servers = 3 73 | 74 | ;--------------------- 75 | 76 | ; Make specific Docker environment variables available to PHP 77 | env[DB_1_ENV_MYSQL_DATABASE] = $DB_1_ENV_MYSQL_DATABASE 78 | env[DB_1_ENV_MYSQL_USER] = $DB_1_ENV_MYSQL_USER 79 | env[DB_1_ENV_MYSQL_PASSWORD] = $DB_1_ENV_MYSQL_PASSWORD 80 | 81 | catch_workers_output = yes -------------------------------------------------------------------------------- /symfony_dev/config/php56/symfony.ini: -------------------------------------------------------------------------------- 1 | date.timezone =Asia/Macao -------------------------------------------------------------------------------- /symfony_dev/config/php70/php-fpm.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'symfony'. 2 | ; the variable $pool can we used in any directive and will be replaced by the 3 | ; pool name ('symfony' here) 4 | [symfony] 5 | 6 | ; Unix user/group of processes 7 | ; Note: The user is mandatory. If the group is not set, the default user's group 8 | ; will be used. 9 | user = www-data 10 | group = www-data 11 | 12 | ; The address on which to accept FastCGI requests. 13 | ; Valid syntaxes are: 14 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on 15 | ; a specific port; 16 | ; 'port' - to listen on a TCP socket to all addresses on a 17 | ; specific port; 18 | ; '/path/to/unix/socket' - to listen on a unix socket. 19 | ; Note: This value is mandatory. 20 | listen = 0.0.0.0:9000 21 | 22 | ; Choose how the process manager will control the number of child processes. 23 | ; Possible Values: 24 | ; static - a fixed number (pm.max_children) of child processes; 25 | ; dynamic - the number of child processes are set dynamically based on the 26 | ; following directives. With this process management, there will be 27 | ; always at least 1 children. 28 | ; pm.max_children - the maximum number of children that can 29 | ; be alive at the same time. 30 | ; pm.start_servers - the number of children created on startup. 31 | ; pm.min_spare_servers - the minimum number of children in 'idle' 32 | ; state (waiting to process). If the number 33 | ; of 'idle' processes is less than this 34 | ; number then some children will be created. 35 | ; pm.max_spare_servers - the maximum number of children in 'idle' 36 | ; state (waiting to process). If the number 37 | ; of 'idle' processes is greater than this 38 | ; number then some children will be killed. 39 | ; ondemand - no children are created at startup. Children will be forked when 40 | ; new requests will connect. The following parameter are used: 41 | ; pm.max_children - the maximum number of children that 42 | ; can be alive at the same time. 43 | ; pm.process_idle_timeout - The number of seconds after which 44 | ; an idle process will be killed. 45 | ; Note: This value is mandatory. 46 | pm = dynamic 47 | 48 | ; The number of child processes to be created when pm is set to 'static' and the 49 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 50 | ; This value sets the limit on the number of simultaneous requests that will be 51 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 52 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 53 | ; CGI. The below defaults are based on a server without much resources. Don't 54 | ; forget to tweak pm.* to fit your needs. 55 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 56 | ; Note: This value is mandatory. 57 | pm.max_children = 20 58 | 59 | ; The number of child processes created on startup. 60 | ; Note: Used only when pm is set to 'dynamic' 61 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 62 | pm.start_servers = 2 63 | 64 | ; The desired minimum number of idle server processes. 65 | ; Note: Used only when pm is set to 'dynamic' 66 | ; Note: Mandatory when pm is set to 'dynamic' 67 | pm.min_spare_servers = 1 68 | 69 | ; The desired maximum number of idle server processes. 70 | ; Note: Used only when pm is set to 'dynamic' 71 | ; Note: Mandatory when pm is set to 'dynamic' 72 | pm.max_spare_servers = 3 73 | 74 | ;--------------------- 75 | 76 | ; Make specific Docker environment variables available to PHP 77 | env[DB_1_ENV_MYSQL_DATABASE] = $DB_1_ENV_MYSQL_DATABASE 78 | env[DB_1_ENV_MYSQL_USER] = $DB_1_ENV_MYSQL_USER 79 | env[DB_1_ENV_MYSQL_PASSWORD] = $DB_1_ENV_MYSQL_PASSWORD 80 | 81 | catch_workers_output = yes -------------------------------------------------------------------------------- /symfony_dev/config/php70/symfony.ini: -------------------------------------------------------------------------------- 1 | date.timezone =Asia/Macao -------------------------------------------------------------------------------- /symfony_dev/docker-compose.yml: -------------------------------------------------------------------------------- 1 | db: 2 | image: mysql 3 | ports: 4 | - 3306:3306 5 | environment: 6 | MYSQL_ROOT_PASSWORD: root 7 | MYSQL_DATABASE: symfony 8 | MYSQL_USER: root 9 | MYSQL_PASSWORD: root 10 | app: 11 | image: dockerepo/symfony 12 | ports: 13 | - 9000:9000 14 | volumes: 15 | - ./config/php70/symfony.ini:/usr/local/etc/php/conf.d/symfony.ini 16 | - ./config/php70/php-fpm.conf:/usr/local/etc/php-fpm.conf 17 | - /Users/llitfkitfk/Documents/git/app/symfony:/symfony 18 | links: 19 | - db 20 | nginx: 21 | image: dockerepo/nginx 22 | ports: 23 | - 80:80 24 | volumes: 25 | - ./config/nginx/nginx.conf:/etc/nginx/nginx.conf 26 | - ./config/nginx/upstream.conf:/etc/nginx/conf.d/upstream.conf 27 | - ./config/nginx/app.conf:/etc/nginx/conf.d/app.conf 28 | - ./config/nginx/logs:/var/log/nginx 29 | links: 30 | - app 31 | composer: 32 | image: dockerepo/composer 33 | entrypoint: sh 34 | stdin_open: true 35 | tty: true 36 | volumes: 37 | - /Users/llitfkitfk/Documents/git/app/symfony:/app -------------------------------------------------------------------------------- /symfony_dev/php56/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:5.6-fpm 2 | 3 | # update 4 | RUN apt-get update 5 | 6 | # extension - except: imagick apc xdebug geoip redis 7 | RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng12-dev 8 | RUN docker-php-ext-install iconv mcrypt mysql mysqli pdo pdo_mysql mbstring gd 9 | RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 10 | 11 | # extension - redis 12 | ENV PHP_REDIS_VERSION 2.2.7 13 | RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/${PHP_REDIS_VERSION}.tar.gz \ 14 | && tar xfz /tmp/redis.tar.gz \ 15 | && rm -r /tmp/redis.tar.gz \ 16 | && mv phpredis-${PHP_REDIS_VERSION} /usr/src/php/ext/redis \ 17 | && docker-php-ext-install redis 18 | 19 | RUN usermod -u 1000 www-data 20 | 21 | WORKDIR /symfony 22 | 23 | EXPOSE 9000 24 | 25 | VOLUME ["/user/local/etc/php/conf.d/symfony.ini"] 26 | VOLUME ["/etc/php-fpm.conf"] 27 | 28 | CMD ["php-fpm", "-F"] -------------------------------------------------------------------------------- /traefik/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | app: 5 | image: traefik 6 | command: --web --docker --docker.domain=gokit.info 7 | restart: always 8 | networks: 9 | - webgateway 10 | ports: 11 | - "80:80" 12 | - "443:443" 13 | volumes: 14 | - /var/run/docker.sock:/var/run/docker.sock 15 | - /dev/null:/traefik.toml 16 | whoami: 17 | image: emilevauge/whoami 18 | networks: 19 | - webgateway 20 | labels: 21 | - "traefik.backend=whoami" 22 | - "traefik.frontend.rule=Host:whoami.gokit.info" 23 | admin: 24 | image: portainer/portainer 25 | command: -H unix:///var/run/docker.sock 26 | volumes: 27 | - /var/run/docker.sock:/var/run/docker.sock 28 | - ./admin/data:/data 29 | labels: 30 | - "traefik.port=9000" 31 | - "traefik.backend=admin" 32 | - "traefik.frontend.rule=Host:admin.gokit.info" 33 | networks: 34 | - webgateway 35 | dash: 36 | image: svendowideit/ambassador 37 | links: 38 | - app 39 | labels: 40 | - "traefik.port=8080" 41 | - "traefik.backend=dash" 42 | - "traefik.frontend.rule=Host:dash.gokit.info" 43 | environment: 44 | - DASH_PORT_8080_TCP=tcp://app:8080 45 | networks: 46 | - webgateway 47 | db: 48 | image: postgres:alpine 49 | environment: 50 | - POSTGRES_PASSWORD=mysecretpassword 51 | volumes: 52 | - ./db/data:/var/lib/postgresql/data 53 | networks: 54 | webgateway: 55 | driver: bridge 56 | -------------------------------------------------------------------------------- /transfer-volume/cmd.sh: -------------------------------------------------------------------------------- 1 | docker run --rm -v :/from alpine ash -c "cd /from ; tar -cf - . " | ssh 'docker run --rm -i -v :/to alpine ash -c "cd /to ; tar -xvf - " ' -------------------------------------------------------------------------------- /visualizer/cmd.md: -------------------------------------------------------------------------------- 1 | docker run -it -d -p 8000:8000 -e PORT=8000 -e HOST=localhost -v /var/run/docker.sock:/var/run/docker.sock manomarks/visualizer --------------------------------------------------------------------------------