Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.1 Stable release #123

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 49 additions & 13 deletions config/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ ssl:
enabled: true
email: "support@example.com"
images:
peatio: rubykube/peatio:2.0.34
barong: rubykube/barong:2.0.51
peatio: rubykube/peatio:2.1.21
barong: rubykube/barong:2.1.4
frontend: rubykube/mikroapp:0.1.5
tower: rubykube/tower:0.1.8
tower: rubykube/tower:0.1.27
postmaster: quay.io/openware/postmaster:0.0.3
arke: rubykube/arke:0.1.5
arke: rubykube/arke:0.1.9
vendor:
frontend: https://github.com/rubykube/mikroapp.git
storage:
Expand All @@ -31,19 +31,55 @@ twilio:
phone_number: "+15005550000"
account_sid: "changeme"
auth_token: "changeme"
database:
host: "db"
user: "root"
password: "changeme"
redis:
host: "redis"
port: "6378"
vault:
host: "vault"
port: "8200"
token: "changeme"
rabbitmq:
host: "rabbitmq"
port: "5672"
user: "guest"
password: "guest"
peatio:
secret_key_base: "faiba2shei0Ae5gahCh4aipoh3meyaFi"
barong:
secret_key_base: "64"

sendgrid_api_key: changeme
arke:
strategy:
type: 'copy'
pair: 'ETHUSD'
type: copy
volume_ratio: 0.1
target:
driver: rubykube
host: 'http://www.app.local'
name: John
key: changeme
secret: changeme
market: 'ETHUSD'
host: "http://www.app.local"
key: ""
secret: ""
rate_limit: 1
sources:
- driver: bitfaker
market: 'tETHUSD'
host: "api.bitfinex.com"
key: ""
secret: ""
rate_limit: 0.2
- driver: bitfinex
name: Joe
key: changeme
secret: changeme
market: 'tETHUSD'
host: "api.bitfinex.com"
key: ""
secret: ""
rate_limit: 0.2
- driver: binance
market: 'ETHUSDT'
host: "api.binance.com"
key: ""
secret: ""
rate_limit: 0.2
8 changes: 5 additions & 3 deletions lib/microkube/renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ def render_keys
end

def generate_key(filename, public: false)
key = SSHKey.generate(type: 'RSA', bits: 2048)
File.open(filename, 'w') { |file| file.puts(key.private_key) }
File.open("#{filename}.pub", 'w') { |file| file.puts(key.ssh_public_key) } if public
unless File.file?(filename)
key = SSHKey.generate(type: 'RSA', bits: 2048)
File.open(filename, 'w') { |file| file.puts(key.private_key) }
File.open("#{filename}.pub", 'w') { |file| file.puts(key.ssh_public_key) } if public
end
end

def config
Expand Down
4 changes: 2 additions & 2 deletions templates/compose/app.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ services:
image: "<%= @config['images']['barong'] %>"
env_file:
- ../config/barong.env
ports:
- "8001:8001"
expose:
- "8001"
volumes:
- ../config/secrets:/secrets:ro
- ../config/barong/seeds.yml:/home/app/config/seeds.yml
Expand Down
6 changes: 3 additions & 3 deletions templates/compose/backend.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ services:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
ports:
- "3306:3306"
expose:
- "3306"
environment:
MYSQL_ROOT_PASSWORD: changeme
MYSQL_ROOT_PASSWORD: <%= @config['database']['password'] %>

redis:
image: redis:4.0.10
Expand Down
6 changes: 3 additions & 3 deletions templates/compose/gateway.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ services:
image: envoyproxy/envoy:v1.9.0
volumes:
- ../config/gateway:/etc/envoy/
ports:
- '8099:8099'
- '9099:9099'
expose:
- '8099'
- '9099'
command: /usr/local/bin/envoy --v2-config-only -l info -c /etc/envoy/envoy.yaml
labels:
traefik.enable: true
Expand Down
19 changes: 10 additions & 9 deletions templates/config/barong.env.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ DISABLE_SPRING=true

RAILS_ENV=production

SECRET_KEY_BASE=64
SECRET_KEY_BASE=<%= @config['barong']['secret_key_base'] %>

DATABASE_HOST=db
DATABASE_USER=root
DATABASE_PASS=changeme
DATABASE_HOST=<%= @config['database']['host'] %>
DATABASE_USER=<%= @config['database']['user'] %>
DATABASE_PASS=<%= @config['database']['password'] %>

TWILIO_PHONE_NUMBER=<%= @config['twilio']['phone_number'] %>
TWILIO_ACCOUNT_SID=<%= @config['twilio']['account_sid'] %>
Expand All @@ -24,11 +24,12 @@ STORAGE_SECRET_KEY=<%= @config['storage']['secretKey'] %>
JWT_PUBLIC_KEY=<%= @jwt_public_key %>
JWT_PRIVATE_KEY_PATH=/secrets/barong.key

VAULT_ADDRESS=http://vault:8200
VAULT_ADDRESS=http://<%= @config['vault']['host'] %>:<%= @config['vault']['port'] %>
VAULT_TOKEN=<%= @config['vault']['token'] %>

EVENT_API_JWT_PRIVATE_KEY=<%= @jwt_private_key %>
EVENT_API_JWT_ALGORITHM=RS256
EVENT_API_RABBITMQ_HOST=rabbitmq
EVENT_API_RABBITMQ_PORT=5672
EVENT_API_RABBITMQ_USERNAME=guest
EVENT_API_RABBITMQ_PASSWORD=guest
EVENT_API_RABBITMQ_HOST=<%= @config['rabbitmq']['host'] %>
EVENT_API_RABBITMQ_PORT=<%= @config['rabbitmq']['port'] %>
EVENT_API_RABBITMQ_USERNAME=<%= @config['rabbitmq']['user'] %>
EVENT_API_RABBITMQ_PASSWORD=<%= @config['rabbitmq']['password'] %>
8 changes: 6 additions & 2 deletions templates/config/frontend/tower.js.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
window.env = {
API_URL: 'http://<%= @config['app']['subdomain'] %>.<%= @config['app']['domain'] %>'
};
applogicUrl: 'http://<%= @config['app']['subdomain'] %>.<%= @config['app']['domain'] %>/api/v2/applogic',
authUrl: 'http://<%= @config['app']['subdomain'] %>.<%= @config['app']['domain'] %>/api/v2/barong',
msAlertDisplayTime: '5000',
tablePageLimit: 50,
minutesUntilAutoLogout: '5',
};
3 changes: 3 additions & 0 deletions templates/config/gateway/envoy.json.erb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@
"proxy-authorization",
"x-forwarded-host",
"x-forwarded-for",
"x-auth-apikey",
"x-auth-nonce",
"x-auth-signature",
"from"
],
"path_prefix": "/api/v2/auth",
Expand Down
3 changes: 3 additions & 0 deletions templates/config/gateway/envoy.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ static_resources:
- x-forwarded-host
- x-forwarded-for
- from
- x-auth-apikey
- x-auth-nonce
- x-auth-signature
path_prefix: "/api/v2/auth"
server_uri:
cluster: barong
Expand Down
24 changes: 12 additions & 12 deletions templates/config/peatio.env.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ LOG_LEVEL=debug

ADMIN=admin@barong.io

DATABASE_HOST=db
DATABASE_USER=root
DATABASE_PASS=changeme
DATABASE_HOST=<%= @config['database']['host'] %>
DATABASE_USER=<%= @config['database']['user'] %>
DATABASE_PASS=<%= @config['database']['password'] %>

VAULT_URL=http://vault:8200
VAULT_TOKEN=changeme
VAULT_URL=http://<%= @config['vault']['host'] %>:<%= @config['vault']['port'] %>
VAULT_TOKEN=<%= @config['vault']['token'] %>

REDIS_URL=redis://redis:6379
REDIS_URL=redis://<%= @config['redis']['host'] %>:<%= @config['redis']['port'] %>

RABBITMQ_HOST=rabbitmq
RABBITMQ_HOST=<%= @config['rabbitmq']['host'] %>

RANGER_HOST=ws.ranger.<%= @config['app']['domain'] %>
RANGER_PORT=80
Expand All @@ -31,14 +31,14 @@ JWT_PUBLIC_KEY=<%= @jwt_public_key %>

EVENT_API_JWT_PRIVATE_KEY=<%= @jwt_private_key %>
EVENT_API_JWT_ALGORITHM=RS256
EVENT_API_RABBITMQ_HOST=rabbitmq
EVENT_API_RABBITMQ_PORT=5672
EVENT_API_RABBITMQ_USERNAME=guest
EVENT_API_RABBITMQ_PASSWORD=guest
EVENT_API_RABBITMQ_HOST=<%= @config['rabbitmq']['host'] %>
EVENT_API_RABBITMQ_PORT=<%= @config['rabbitmq']['port'] %>
EVENT_API_RABBITMQ_USERNAME=<%= @config['rabbitmq']['user'] %>
EVENT_API_RABBITMQ_PASSWORD=<%= @config['rabbitmq']['password'] %>

MINIMUM_MEMBER_LEVEL_FOR_DEPOSIT=3
MINIMUM_MEMBER_LEVEL_FOR_WITHDRAW=3
MINIMUM_MEMBER_LEVEL_FOR_TRADING=3

SECRET_KEY_BASE=faiba2shei0Ae5gahCh4aipoh3meyaFi
SECRET_KEY_BASE=<%= @config['peatio']['secret_key_base'] %>
FORCE_SECURE_CONNECTION="false"
12 changes: 6 additions & 6 deletions templates/config/postmaster.env.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
RABBITMQ_HOST=rabbitmq
RABBITMQ_PORT=5672
RABBITMQ_USERNAME=guest
RABBITMQ_PASSWORD=guest
RABBITMQ_HOST=<%= @config['rabbitmq']['host'] %>
RABBITMQ_PORT=<%= @config['rabbitmq']['port'] %>
RABBITMQ_USERNAME=<%= @config['rabbitmq']['user'] %>
RABBITMQ_PASSWORD=<%= @config['rabbitmq']['password'] %>

SENDER_NAME=Microkube
SENDER_EMAIL=noreply@microkube.com
SENDER_NAME=<%= @config['app']['name'] %>
SENDER_EMAIL=noreply@<%= @config['app']['domain'] %>

CONFIRM_URL=http://<%= @config['app']['subdomain'] %>.<%= @config['app']['domain'] %>/accounts/confirmation?confirmation_token=#{}
RESET_URL=http://<%= @config['app']['subdomain'] %>.<%= @config['app']['domain'] %>/accounts/password_reset?reset_token=#{}
Expand Down
5 changes: 4 additions & 1 deletion templates/config/ranger.env.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ RANGER_CONNECT_SECURE="false"

LOG_LEVEL=debug

RABBITMQ_HOST=rabbitmq
RABBITMQ_HOST=<%= @config['rabbitmq']['host'] %>
RABBITMQ_PORT=<%= @config['rabbitmq']['port'] %>
RABBITMQ_USERNAME=<%= @config['rabbitmq']['user'] %>
RABBITMQ_PASSWORD=<%= @config['rabbitmq']['password'] %>

JWT_PUBLIC_KEY=<%= @jwt_public_key %>
7 changes: 7 additions & 0 deletions templates/config/traefik.toml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ defaultEntryPoints = [<%= '"https",' if @config['ssl']['enabled'] %>"http"]
[entryPoints.http]
address = ":80"
<% if @config['ssl']['enabled'] -%>
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
compress = true
[entryPoints.https.redirect]
regex = "^https://<%= @config['app']['domain'] %>/(.*)"
replacement = "https://<%= @config['app']['subdomain'] %>.<%= @config['app']['domain'] %>/$1"
permanent = true
[entryPoints.https.tls]
<% end -%>

Expand Down