diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Caddyfile | 45 | ||||
| -rw-r--r-- | db/db.js | 14 | ||||
| -rw-r--r-- | db/index.js | 1 | ||||
| l--------- | db/knexfile.js | 1 | ||||
| -rw-r--r-- | lib/rates.js | 1 | ||||
| -rw-r--r-- | prod.yml | 98 | ||||
| -rw-r--r-- | sampleconfig/knexfile.js | 17 |
8 files changed, 141 insertions, 37 deletions
@@ -23,3 +23,4 @@ docker-compose.mainnet.yml assets.json lm.yml lt.yml +caddy diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 00000000..16535102 --- /dev/null +++ b/Caddyfile @@ -0,0 +1,45 @@ +classic.coinos.io { + handle_path /api* { + reverse_proxy app:3119 + } + + handle /lnurl* { + reverse_proxy app:3118 + } + + handle /ws* { + reverse_proxy app:3119 + } + + handle { + root * /coinos + try_files {path}.html {path} /index.html + file_server + } + + tls { + dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN} + } +} + +coinos.io { + handle_path /api* { + reverse_proxy app:3119 + } + + handle /lnurl* { + reverse_proxy app:3118 + } + + handle /ws* { + reverse_proxy app:3119 + } + + handle { + reverse_proxy ui:3000 + } + + tls { + dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN} + } +} @@ -1,13 +1,5 @@ import Sequelize from "@sequelize/core"; -import dbOptions from "../config/knexfile"; +import config from "$config"; -let { database, user, password, host } = dbOptions[ - process.env.NODE_ENV -].connection; - -export default new Sequelize(database, user, password, { - host, - dialect: "mariadb", - logging: false, - dialectOptions: { multipleStatements: true, timezone: "Etc/GMT+7" } -}); +let { database, user, password, options } = config.db; +export default new Sequelize(database, user, password, options); diff --git a/db/index.js b/db/index.js index 3d5aab36..8c94a4d3 100644 --- a/db/index.js +++ b/db/index.js @@ -1,7 +1,6 @@ import Sequelize from "@sequelize/core"; import db from "$db/db"; -import dbOptions from "$config/knexfile"; db.authenticate().catch(err => { console.debug("Error connecting to database: " + err.message); diff --git a/db/knexfile.js b/db/knexfile.js deleted file mode 120000 index 3cf75ae7..00000000 --- a/db/knexfile.js +++ /dev/null @@ -1 +0,0 @@ -./../config/knexfile.js
\ No newline at end of file diff --git a/lib/rates.js b/lib/rates.js index 3d39b014..1827c1f6 100644 --- a/lib/rates.js +++ b/lib/rates.js @@ -5,6 +5,7 @@ import fs from "fs"; import binanceFactory from "./binance"; import { broadcast } from "./sockets"; import store from "./store"; +import { err, warn } from "$lib/logging"; const binance = binanceFactory(); @@ -1,27 +1,111 @@ version: '3.6' services: + caddy: + depends_on: + - app + container_name: caddy + image: gcr.io/coinos-326717/github.com/asoltys/caddy-cloudflare:latest + restart: always + ports: + - "80:80" + - "443:443" + volumes: + - /var/coinos:/coinos + - ./Caddyfile:/etc/caddy/Caddyfile + - ./caddy:/data + environment: + CLOUDFLARE_AUTH_TOKEN: "${CLOUDFLARE_AUTH_TOKEN}" + networks: + default: + ipv4_address: 172.42.0.21 + ui: + depends_on: + - app + container_name: ui + image: gcr.io/coinos-326717/github.com/coinos/coinos-ui:prod + restart: always app: + depends_on: + - cl + - maria + - bitcoin + - liquid container_name: app image: gcr.io/coinos-326717/github.com/coinos/coinos-server:prod restart: always - ports: - - '3118:3118' - - '3119:3119' environment: NODE_ENV: production NODE_OPTIONS: "--es-module-specifier-resolution=node --experimental-modules --loader ./loader.js --openssl-legacy-provider" volumes: - ./:/app - ./logs:/logs - - /root/.lnda/tls.cert:/tls.cert - extra_hosts: - - host.docker.internal:host-gateway + networks: + default: + ipv4_address: 172.42.0.22 maria: container_name: maria image: mariadb restart: always environment: - MARIADB_ROOT_PASSWORD: pw + MARIADB_ROOT_PASSWORD: password + volumes: + - ./mysql:/var/lib/mysql + bitcoin: + image: ghcr.io/vulpemventures/bitcoin + container_name: bitcoin + volumes: + - ./config/bitcoin:/home/bitcoin/.bitcoin + restart: always + networks: + default: + ipv4_address: 172.42.0.23 + liquid: + image: ghcr.io/vulpemventures/elements + container_name: liquid + volumes: + - ./config/liquid:/home/elements/.elements + restart: always + networks: + default: + ipv4_address: 172.42.0.24 + cl: + depends_on: + - bitcoin + image: elementsproject/lightningd:v0.12.0 + container_name: cl + restart: always + volumes: + - ./config/lightning:/root/.lightning + ports: + - "9736:9735" + networks: + default: + ipv4_address: 172.42.0.25 + lnd: + depends_on: + - bitcoin + - tor + image: lightninglabs/lnd:v0.15.1-beta + container_name: lnd + volumes: + - ./config/lnd:/root/.lnd + - ./config/bitcoin:/root/.bitcoin + - ./config/tor:/etc/tor + ports: + - "9735:9735" + restart: always + networks: + default: + ipv4_address: 172.42.0.26 + tor: + container_name: tor + image: dperson/torproxy + restart: always + volumes: + - ./config/tor:/etc/tor + networks: + default: + ipv4_address: 172.42.0.27 networks: default: name: net diff --git a/sampleconfig/knexfile.js b/sampleconfig/knexfile.js deleted file mode 100644 index dafb0d1c..00000000 --- a/sampleconfig/knexfile.js +++ /dev/null @@ -1,17 +0,0 @@ -// Update with your config settings. - -export default { - development: { - client: "mysql2", - connection: { - host: "maria", - database: "coinos", - user: "root", - password: "password" - }, - migrations: { - tableName: "migrations", - directory: "migrations" - } - } -}; |
