diff --git a/backend/migrations/20210423103500_stream_domain.js b/backend/migrations/20210423103500_stream_domain.js new file mode 100644 index 00000000..a894ca5e --- /dev/null +++ b/backend/migrations/20210423103500_stream_domain.js @@ -0,0 +1,40 @@ +const migrate_name = 'stream_domain'; +const logger = require('../logger').migrate; + +/** + * Migrate + * + * @see http://knexjs.org/#Schema + * + * @param {Object} knex + * @param {Promise} Promise + * @returns {Promise} + */ +exports.up = function (knex/*, Promise*/) { + logger.info('[' + migrate_name + '] Migrating Up...'); + + return knex.schema.table('stream', (table) => { + table.renameColumn('forward_ip', 'forwarding_host'); + }) + .then(function () { + logger.info('[' + migrate_name + '] stream Table altered'); + }); +}; + +/** + * Undo Migrate + * + * @param {Object} knex + * @param {Promise} Promise + * @returns {Promise} + */ +exports.down = function (knex/*, Promise*/) { + logger.info('[' + migrate_name + '] Migrating Down...'); + + return knex.schema.table('stream', (table) => { + table.renameColumn('forwarding_host', 'forward_ip'); + }) + .then(function () { + logger.info('[' + migrate_name + '] stream Table altered'); + }); +}; diff --git a/backend/schema/endpoints/streams.json b/backend/schema/endpoints/streams.json index e93e1ff3..7d4878a8 100644 --- a/backend/schema/endpoints/streams.json +++ b/backend/schema/endpoints/streams.json @@ -20,9 +20,20 @@ "minimum": 1, "maximum": 65535 }, - "forward_ip": { - "type": "string", - "format": "ipv4" + "forwarding_host": { + "oneOf": [ + { + "$ref": "../definitions.json#/definitions/domain_name" + }, + { + "type": "string", + "format": "ipv4" + }, + { + "type": "string", + "format": "ipv6" + } + ] }, "forwarding_port": { "type": "integer", @@ -55,8 +66,8 @@ "incoming_port": { "$ref": "#/definitions/incoming_port" }, - "forward_ip": { - "$ref": "#/definitions/forward_ip" + "forwarding_host": { + "$ref": "#/definitions/forwarding_host" }, "forwarding_port": { "$ref": "#/definitions/forwarding_port" @@ -107,15 +118,15 @@ "additionalProperties": false, "required": [ "incoming_port", - "forward_ip", + "forwarding_host", "forwarding_port" ], "properties": { "incoming_port": { "$ref": "#/definitions/incoming_port" }, - "forward_ip": { - "$ref": "#/definitions/forward_ip" + "forwarding_host": { + "$ref": "#/definitions/forwarding_host" }, "forwarding_port": { "$ref": "#/definitions/forwarding_port" @@ -154,8 +165,8 @@ "incoming_port": { "$ref": "#/definitions/incoming_port" }, - "forward_ip": { - "$ref": "#/definitions/forward_ip" + "forwarding_host": { + "$ref": "#/definitions/forwarding_host" }, "forwarding_port": { "$ref": "#/definitions/forwarding_port" diff --git a/backend/templates/stream.conf b/backend/templates/stream.conf index 05f68772..76159a64 100644 --- a/backend/templates/stream.conf +++ b/backend/templates/stream.conf @@ -12,7 +12,7 @@ server { #listen [::]:{{ incoming_port }}; {% endif %} - proxy_pass {{ forward_ip }}:{{ forwarding_port }}; + proxy_pass {{ forwarding_host }}:{{ forwarding_port }}; # Custom include /data/nginx/custom/server_stream[.]conf; @@ -27,7 +27,7 @@ server { {% else -%} #listen [::]:{{ incoming_port }} udp; {% endif %} - proxy_pass {{ forward_ip }}:{{ forwarding_port }}; + proxy_pass {{ forwarding_host }}:{{ forwarding_port }}; # Custom include /data/nginx/custom/server_stream[.]conf; diff --git a/docker/rootfs/etc/services.d/frontend/run b/docker/rootfs/etc/services.d/frontend/run index 32558d98..a666d53e 100755 --- a/docker/rootfs/etc/services.d/frontend/run +++ b/docker/rootfs/etc/services.d/frontend/run @@ -4,6 +4,7 @@ if [ "$DEVELOPMENT" == "true" ]; then cd /app/frontend || exit 1 + # If yarn install fails: add --verbose --network-concurrency 1 yarn install yarn watch else diff --git a/docker/rootfs/etc/services.d/manager/run b/docker/rootfs/etc/services.d/manager/run index ba0fb05e..e365f4fb 100755 --- a/docker/rootfs/etc/services.d/manager/run +++ b/docker/rootfs/etc/services.d/manager/run @@ -6,6 +6,7 @@ cd /app || echo if [ "$DEVELOPMENT" == "true" ]; then cd /app || exit 1 + # If yarn install fails: add --verbose --network-concurrency 1 yarn install node --max_old_space_size=250 --abort_on_uncaught_exception node_modules/nodemon/bin/nodemon.js else diff --git a/frontend/js/app/nginx/stream/form.ejs b/frontend/js/app/nginx/stream/form.ejs index b0a72e48..eb80c373 100644 --- a/frontend/js/app/nginx/stream/form.ejs +++ b/frontend/js/app/nginx/stream/form.ejs @@ -14,8 +14,8 @@