Commit 4f550b0a authored by zkuang's avatar zkuang

initial release engineering

parents
Pipeline #108 canceled with stages
.*~
venv
*.pyc
__pycache__/
instance/
.pytest_cache/
.coverage
htmlcov/
dist/
build/
*.egg-info/
.~*
carbinet-admin-web.bak/
carbinet.sh
dump.rdb
.DS_Store
.idea/
sso/
ziti/
www/
version: "3.7"
services:
carbinet_migrate:
build: .
image: carbinet:latest
container_name: carbinet_migrate
links:
- mysql:mysql
- redis:redis
depends_on:
- "mysql"
- "redis"
environment:
- ALI_IOT_ACCESS_KEY_ID=LTAI4FsNmRpoK4wEmBP5xL2J
- ALI_IOT_ACCESS_KEY_SECRET=Mb9n4bTp3u6aLYThBoDy9S26cX4npD
- ALI_IOT_AMQP_UID=1360917180360377
- ALI_IOT_AMQP_ACCESS_KEY=LTAI4FsNmRpoK4wEmBP5xL2J
- ALI_IOT_AMQP_ACCESS_SECRET=Mb9n4bTp3u6aLYThBoDy9S26cX4npD
- DATABASE_URL=mysql+pymysql://carbinet:123456@mysql/carbinet
- REDIS_HOST=redis
- FLASK_MIGRATE=True
- ALI_IOT_AMQP_CLIENT_ID=carbinet
networks:
- ego
command: ["./wait-for-it.sh", "mysql:3306", "--", "flask", "db", "migrate"]
carbinet_upgrade:
build: .
image: carbinet:latest
container_name: carbinet_upgrade
links:
- mysql:mysql
- redis:redis
depends_on:
- "mysql"
- "redis"
- "carbinet_migrate"
environment:
- ALI_IOT_ACCESS_KEY_ID=LTAI4FsNmRpoK4wEmBP5xL2J
- ALI_IOT_ACCESS_KEY_SECRET=Mb9n4bTp3u6aLYThBoDy9S26cX4npD
- ALI_IOT_AMQP_UID=1360917180360377
- ALI_IOT_AMQP_ACCESS_KEY=LTAI4FsNmRpoK4wEmBP5xL2J
- ALI_IOT_AMQP_ACCESS_SECRET=Mb9n4bTp3u6aLYThBoDy9S26cX4npD
- DATABASE_URL=mysql+pymysql://carbinet:123456@mysql/carbinet
- REDIS_HOST=redis
- FLASK_MIGRATE=True
- ALI_IOT_AMQP_CLIENT_ID=carbinet
networks:
- ego
command: ["./wait-for-it.sh", "mysql:3306", "--", "flask", "db", "upgrade"]
carbinet_seed:
build: .
image: carbinet:latest
container_name: carbinet_seed
links:
- mysql:mysql
- redis:redis
depends_on:
- "mysql"
- "redis"
environment:
- ALI_IOT_ACCESS_KEY_ID=LTAI4FsNmRpoK4wEmBP5xL2J
- ALI_IOT_ACCESS_KEY_SECRET=Mb9n4bTp3u6aLYThBoDy9S26cX4npD
- ALI_IOT_AMQP_UID=1360917180360377
- ALI_IOT_AMQP_ACCESS_KEY=LTAI4FsNmRpoK4wEmBP5xL2J
- ALI_IOT_AMQP_ACCESS_SECRET=Mb9n4bTp3u6aLYThBoDy9S26cX4npD
- DATABASE_URL=mysql+pymysql://carbinet:123456@mysql/carbinet
- REDIS_HOST=redis
- FLASK_MIGRATE=True
- ALI_IOT_AMQP_CLIENT_ID=carbinet
networks:
- ego
command: ["./wait-for-it.sh", "mysql:3306", "--", "flask", "seed"]
sso_migrate:
build: ./sso
container_name: sso_migrate
image: gzego/sso:latest
links:
- mysql:mysql
depends_on:
- "mysql"
environment:
- SECRET_KEY=1gboig1%1%ljuz_h0&8m%s84ybxz42z3w0pu50qi%mobo%poae
- ALLOWED_HOSTS=["sso.gzego.com"]
- DB_NAME=sso
- DB_USERNAME=sso
- DB_PASSWORD=123456
- DB_HOST=mysql
- DB_PORT=3306
- CAS_SERVICES=["http://carbinet.gzego.com:8080/api/cas", "http://carbinet.gzego.com:8080/api/cas/logout"]
networks:
- ego
command: ["./wait-for-it.sh", "mysql:3306", "--", "python", "./manage.py", "migrate"]
carbinet_bash:
build: .
image: carbinet:latest
container_name: carbinet_migrate
links:
- mysql:mysql
- redis:redis
depends_on:
- "mysql"
- "redis"
environment:
- ALI_IOT_ACCESS_KEY_ID=LTAI4FsNmRpoK4wEmBP5xL2J
- ALI_IOT_ACCESS_KEY_SECRET=Mb9n4bTp3u6aLYThBoDy9S26cX4npD
- ALI_IOT_AMQP_UID=1360917180360377
- ALI_IOT_AMQP_ACCESS_KEY=LTAI4FsNmRpoK4wEmBP5xL2J
- ALI_IOT_AMQP_ACCESS_SECRET=Mb9n4bTp3u6aLYThBoDy9S26cX4npD
- DATABASE_URL=mysql+pymysql://carbinet:123456@ego-mysql/carbinet
- REDIS_HOST=redis
- FLASK_MIGRATE=True
- ALI_IOT_AMQP_CLIENT_ID=carbinet
networks:
- ego
command: ["./wait-for-it.sh", "mysql:3306", "--", "bash"]
version: "3.7"
services:
carbinet_production:
build: ./ziti/carbinet_service
ports:
- "8100:80"
container_name: carbinet
image: gzego/carbinet:latest
links:
- mysql:mysql
- redis:redis
depends_on:
- "mysql"
- "redis"
environment:
- FLASK_ENV=production
- ALI_IOT_ACCESS_KEY_ID=LTAI4FsNmRpoK4wEmBP5xL2J
- ALI_IOT_ACCESS_KEY_SECRET=Mb9n4bTp3u6aLYThBoDy9S26cX4npD
- ALI_IOT_AMQP_UID=1360917180360377
- ALI_IOT_AMQP_ACCESS_KEY=LTAI4FsNmRpoK4wEmBP5xL2J
- ALI_IOT_AMQP_ACCESS_SECRET=Mb9n4bTp3u6aLYThBoDy9S26cX4npD
- DATABASE_URL=mysql+pymysql://carbinet:123456@mysql/carbinet
- REDIS_HOST=redis
- ALI_IOT_AMQP_CLIENT_ID=carbinet
- CAS_SERVER=http://sso.gzego.com:8080
- CAS_REDIRECT_FRONTEND=http://carbinet.gzego.com:8080/#/cas_user
extra_hosts:
- "sso.gzego.com:192.168.43.52"
links:
- sso_production:sso
networks:
- ego
command: ["./wait-for-it.sh", "mysql:3306", "--", "gunicorn", "--log-file=-", "--worker-tmp-dir", "/dev/shm", "-w", "4", "-b", "0.0.0.0:80", "carbinet:create_app()"]
sso_production:
build: ./sso
ports:
- "8200:80"
container_name: sso
image: gzego/sso:latest
links:
- mysql:mysql
extra_hosts:
- "carbinet.gzego.com:192.168.43.52"
depends_on:
- "mysql"
environment:
- SECRET_KEY=1gboig1%1%ljuz_h0&8m%s84ybxz42z3w0pu50qi%mobo%poae
- ALLOWED_HOSTS=["sso.gzego.com"]
- DB_NAME=sso
- DB_USERNAME=sso
- DB_PASSWORD=123456
- DB_HOST=mysql
- DB_PORT=3306
- CAS_SERVICES=["http://carbinet.gzego.com:8080/api/cas", "http://carbinet.gzego.com:8080/api/cas/logout"]
networks:
- ego
command: ["./wait-for-it.sh", "mysql:3306", "--", "gunicorn", "-w", "4", "-b", "0.0.0.0:80", "account.wsgi"]
mysql:
image: mysql:5.7
container_name: ego-mysql
environment:
- MYSQL_ROOT_PASSWORD=123456
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
networks:
- ego
volumes:
- ./initdb:/docker-entrypoint-initdb.d
redis:
image: redis:latest
container_name: ego-redis
networks:
- ego
nginx:
image: nginx:latest
container_name: ego-nginx
volumes:
- ./www:/usr/share/nginx/html:ro
- ./nginx.conf:/etc/nginx/nginx.conf:ro
links:
- carbinet_production:carbinet
- sso_production:sso
networks:
- ego
ports:
- "8080:80"
networks:
ego:
driver: bridge
volumes:
www:
nginx.conf:
\ No newline at end of file
CREATE DATABASE sso;
CREATE DATABASE carbinet;
CREATE USER 'sso'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON sso.* TO 'sso'@'%';
CREATE USER 'carbinet'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON carbinet.* TO 'carbinet'@'%';
\ No newline at end of file
worker_processes 1;
user nobody nogroup;
# 'user nobody nobody;' for systems with 'nobody' as a group instead
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex off; # set to 'on' if nginx worker_processes > 1
# 'use epoll;' to enable for Linux 2.6+
# 'use kqueue;' to enable for FreeBSD, OSX
}
http {
include mime.types;
# fallback in case we can't determine a type
default_type application/octet-stream;
access_log /var/log/nginx/access.log combined;
sendfile on;
upstream app_server {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response
# for UNIX domain socket setups
server carbinet fail_timeout=0;
# for a TCP configuration
# server 192.168.0.7:8000 fail_timeout=0;
}
upstream api_server {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response
# for UNIX domain socket setups
server sso fail_timeout=0;
# for a TCP configuration
# server 192.168.0.7:8000 fail_timeout=0;
}
server {
# use 'listen 80 deferred;' for Linux
# use 'listen 80 accept_filter=httpready;' for FreeBSD
listen 80;
client_max_body_size 4G;
# set the correct host(s) for your site
server_name sso.gzego.com;
keepalive_timeout 5;
# path for static files
root /usr/share/nginx/html/sso;
location ~ /static/* {
root /usr/share/nginx/html/sso;
}
location / {
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;
proxy_pass http://sso;
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /usr/share/nginx/html/cas;
}
}
server {
listen 80;
server_name carbinet.gzego.com;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
root /usr/share/nginx/html/carbinet;
location / {
index index.html index.htm;
}
location ~ /static/* {
}
location = /cas_user {
try_files $uri /index.html;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
location ~ /api/* {
try_files $uri @proxy_to_api;
}
location @proxy_to_api {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;
proxy_pass http://carbinet;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment