From c9ba2c4333471cfdb85c266606c309b76ff25fc8 Mon Sep 17 00:00:00 2001 From: David Siaw Date: Mon, 12 Jun 2017 19:39:11 +0900 Subject: [PATCH] restore original template and create one specially for docker. remove change from package.json --- config.docker.yaml | 256 +++++++++++++++++++++++++++++++++++++++++++ config.template.yaml | 41 ++++--- package.json | 2 +- run.sh | 2 +- 4 files changed, 278 insertions(+), 23 deletions(-) create mode 100644 config.docker.yaml diff --git a/config.docker.yaml b/config.docker.yaml new file mode 100644 index 00000000..662ba53d --- /dev/null +++ b/config.docker.yaml @@ -0,0 +1,256 @@ +# MySQL server details +# server: domain or IP of MySQL server +# database: a MySQL database that the user specified has read/write access to +# user: username to authenticate as +# password: password for user +mysql: + server: '${MYSQL_HOST}' + port: ${MYSQL_PORT} + database: '${MYSQL_DATABASE}' + user: '${MYSQL_USER}' + password: '${MYSQL_PASSWORD}' + pool-size: 10 + +# Define IPs/ports to listen on +# Each entry MUST define ip and port (ip can be '' to bind all available addresses) +# Each entry should set http, https, and/or io to true to listen for the corresponding +# service on that port. http/io and https/io can be combined, but if http and https +# are both specified, only https will be bound to that port. +# +# If you don't specify a url, the url io.domain:port or https.domain:port will be assumed +# for non-ssl and ssl websockets, respectively. You can override this by specifying the +# url for a websocket listener. +listen: +# Default HTTP server - default interface, port 8080 + - ip: '' + port: ${ROOT_PORT} + http: true +# Uncomment below to enable HTTPS/SSL websockets +# Note that you must also set https->enabled = true in the https definition +# - ip: '' +# port: 8443 +# https: true +# io: true +# Default Socket.IO server - default interface, port 1337 + - ip: '' + port: ${IO_ROOT_PORT} + io: true +# Example of how to bind an extra port to HTTP and Socket.IO +# - ip: '' +# port: 8081 +# http: true +# io: true +# url: 'http://my-other-thing.site.com:8081' + +# HTTP server details +http: + # Even though you may specify multiple ports to listen on for HTTP above, + # one port must be specified as default for the purposes of generating + # links with the appropriate port + full-address: "${ROOT_URL}" + default-port: ${ROOT_PORT} + domain: '${ROOT_URL}' + # Specifies the root domain for cookies. If you have multiple domains + # e.g. a.example.com and b.example.com, the root domain is example.com + root-domain: '${ROOT_DOMAIN}' + # Specify alternate domains/hosts that are allowed to set the login cookie + # Leave out the http:// + alt-domains: + - '127.0.0.1' + # Use express-minify to minify CSS and Javascript + minify: false + # Max-Age for caching. Value should be an integer in milliseconds or a string accepted by + # the `ms` module. Set to 0 to disable caching. + max-age: '7d' + # Set to false to disable gzip compression + gzip: true + # Customize the threshold byte size for applying gzip + gzip-threshold: 1024 + # Secret used for signed cookies. Can be anything, but make it unique and hard to guess + cookie-secret: 'change-me' + index: + # Maximum number of channels to display on the index page public channel list + max-entries: 50 + +# HTTPS server details +https: + enabled: ${HTTPS_ENABLED} + # Even though you may specify multiple ports to listen on for HTTPS above, + # one port must be specified as default for the purposes of generating + # links with the appropriate port + default-port: 8443 + domain: '${ROOT_URL}' + keyfile: 'localhost.key' + passphrase: '' + certfile: 'localhost.cert' + cafile: '' + ciphers: 'HIGH:!DSS:!aNULL@STRENGTH' + # Allow certain account pages to redirect to HTTPS if HTTPS is enabled. + # You may want to set this to false if you are reverse proxying HTTPS to a + # non-HTTPS address. + redirect: true + +# Page template values +# title goes in the upper left corner, description goes in a tag +html-template: + title: '${SYNC_TITLE}' + description: '${SYNC_DESCRIPTION}' + +# Socket.IO server details +io: + # In most cases this will be the same as the http.domain. + # However, if your HTTP traffic is going through a proxy (e.g. cloudflare) + # you will want to set up a passthrough domain for socket.io. + # If the root of this domain is not the same as the root of your HTTP domain + # (or HTTPS if SSL is enabled), logins won't work. + domain: '${IO_ROOT_URL}' + # Even though you may specify multiple ports to listen on for HTTP above, + # one port must be specified as default for the purposes of generating + # links with the appropriate port + default-port: ${IO_ROOT_PORT} + # limit the number of concurrent socket connections per IP address + ip-connection-limit: 10 + # Whether or not to use zlib to compress each socket message (this option is + # passed through to socket.io/engine.io). + # Note that while this may save a little bandwidth, it also consumes a lot + # more CPU and will bottleneck pretty quickly under heavy load. + per-message-deflate: false + +# Mailer details (used for sending password reset links) +# see https://github.com/andris9/Nodemailer +mail: + enabled: false + config: + service: 'Gmail' + auth: + user: 'some.user@gmail.com' + pass: 'supersecretpassword' + from-address: 'some.user@gmail.com' + from-name: 'CyTube Services' + +# YouTube v3 API key +# See https://developers.google.com/youtube/registering_an_application +# YouTube links will not work without this! +# Instructions: +# 1. Go to https://console.developers.google.com/project +# 2. Create a new API project +# 3. On the left sidebar, click "Credentials" under "APIs & auth" +# 4. Click "Create new Key" under "Public API access" +# 5. Click "Server key" +# 6. Under "APIs & auth" click "YouTube Data API" and then click "Enable API" +youtube-v3-key: '${YOUTUBE_KEY}' +# Minutes between saving channel state to disk +channel-save-interval: 5 +# Limit for the number of channels a user can register +max-channels-per-user: 5 +# Limit for the number of accounts an IP address can register +max-accounts-per-ip: 5 +# Minimum number of seconds between guest logins from the same IP +guest-login-delay: 60 + +# Configure statistics tracking +stats: + # Interval (in milliseconds) between data points - default 1h + interval: 3600000 + # Maximum age of a datapoint (ms) before it is deleted - default 24h + max-age: 86400000 + +# Configure periodic clearing of old alias data +aliases: + # Interval (in milliseconds) between subsequent runs of clearing + purge-interval: 3600000 + # Maximum age of an alias (in milliseconds) - default 1 month + max-age: 2592000000 + +# Workaround for Vimeo blocking my domain +vimeo-workaround: false + +# OPTIONAL: Use Vimeo's OAuth API instead of the anonymous API. +# This allows you to add private videos that have embedding enabled. +# See https://developer.vimeo.com/apps/new to register for this API. +# Note that in order to use this feature you must agree to Vimeo's +# Terms of Service and License Agreement. +vimeo-oauth: + enabled: false + consumer-key: '' + secret: '' + +# Regular expressions for defining reserved user and channel names and page titles +# The list of regular expressions will be joined with an OR, and compared without +# case sensitivity. +# +# Default: reserve any name containing "admin[istrator]" or "owner" as a word +# but only if it is separated by a dash or underscore (e.g. dadmin is not reserved +# but d-admin is) +reserved-names: + usernames: + - '^(.*?[-_])?admin(istrator)?([-_].*)?$' + - '^(.*?[-_])?owner([-_].*)?$' + channels: + - '^(.*?[-_])?admin(istrator)?([-_].*)?$' + - '^(.*?[-_])?owner([-_].*)?$' + pagetitles: [] + +# Provide a contact list for the /contact page +# Example: +# contacts: +# - name: 'my_name' +# title: 'administrator +# email: 'me@my.site' +contacts: [] + +playlist: + max-items: 4000 + # How often (in seconds), mediaUpdate packets are broadcast to clients + update-interval: 5 + +# If set to true, when the ipThrottle and lastguestlogin rate limiters are cleared +# periodically, the garbage collector will be invoked immediately. +# The server must be invoked with node --expose-gc index.js for this to have any effect. +aggressive-gc: false + +# Allows you to blacklist certain channels. Users will be automatically kicked +# upon trying to join one. +channel-blacklist: [] + +# If you have ffmpeg installed, you can query metadata from raw files, allowing +# server-synched raw file playback. This requires the following: +# * ffmpeg must be installed on the server +ffmpeg: + enabled: true +# Executable name for ffprobe if it is not "ffprobe". On Debian and Ubuntu (on which +# libav is used rather than ffmpeg proper), this is "avprobe" + ffprobe-exec: 'ffprobe' + +link-domain-blacklist: [] + +# Drop root if started as root!! +setuid: + enabled: false + group: 'users' + user: 'user' +# how long to wait in ms before changing uid/gid + timeout: 15 + +# Determines channel data storage mechanism. +# Defaults to 'file', in which channel data is JSON stringified and saved to a file +# in the `chandump/` folder. This is the legacy behavior of CyTube. +# The other possible option is 'database', in which case each key-value pair of +# channel data is stored as a row in the `channel_data` database table. +# To migrate legacy chandump files to the database, shut down CyTube (to prevent +# concurrent updates), then run `node lib/channel-storage/migrate.js`. +channel-storage: + type: 'file' + +# Allows for external services to access the system commandline +# Useful for setups where stdin isn't available such as when using PM2 +service-socket: + enabled: false + socket: 'service.sock' + +# Twitch Client ID for the data API (used for VOD lookups) +# https://github.com/justintv/Twitch-API/blob/master/authentication.md#developer-setup +twitch-client-id: '${TWITCH_CLIENT_ID}' + +poll: + max-options: 50 diff --git a/config.template.yaml b/config.template.yaml index 662ba53d..5d892b9b 100644 --- a/config.template.yaml +++ b/config.template.yaml @@ -4,11 +4,11 @@ # user: username to authenticate as # password: password for user mysql: - server: '${MYSQL_HOST}' - port: ${MYSQL_PORT} - database: '${MYSQL_DATABASE}' - user: '${MYSQL_USER}' - password: '${MYSQL_PASSWORD}' + server: 'localhost' + port: 3306 + database: 'cytube3' + user: 'cytube3' + password: '' pool-size: 10 # Define IPs/ports to listen on @@ -23,7 +23,7 @@ mysql: listen: # Default HTTP server - default interface, port 8080 - ip: '' - port: ${ROOT_PORT} + port: 8080 http: true # Uncomment below to enable HTTPS/SSL websockets # Note that you must also set https->enabled = true in the https definition @@ -33,7 +33,7 @@ listen: # io: true # Default Socket.IO server - default interface, port 1337 - ip: '' - port: ${IO_ROOT_PORT} + port: 1337 io: true # Example of how to bind an extra port to HTTP and Socket.IO # - ip: '' @@ -47,12 +47,11 @@ http: # Even though you may specify multiple ports to listen on for HTTP above, # one port must be specified as default for the purposes of generating # links with the appropriate port - full-address: "${ROOT_URL}" - default-port: ${ROOT_PORT} - domain: '${ROOT_URL}' + default-port: 8080 + domain: 'http://localhost' # Specifies the root domain for cookies. If you have multiple domains # e.g. a.example.com and b.example.com, the root domain is example.com - root-domain: '${ROOT_DOMAIN}' + root-domain: 'localhost' # Specify alternate domains/hosts that are allowed to set the login cookie # Leave out the http:// alt-domains: @@ -74,12 +73,12 @@ http: # HTTPS server details https: - enabled: ${HTTPS_ENABLED} + enabled: false # Even though you may specify multiple ports to listen on for HTTPS above, # one port must be specified as default for the purposes of generating # links with the appropriate port default-port: 8443 - domain: '${ROOT_URL}' + domain: 'https://localhost' keyfile: 'localhost.key' passphrase: '' certfile: 'localhost.cert' @@ -93,8 +92,8 @@ https: # Page template values # title goes in the upper left corner, description goes in a tag html-template: - title: '${SYNC_TITLE}' - description: '${SYNC_DESCRIPTION}' + title: 'Sync' + description: 'Free, open source synchtube' # Socket.IO server details io: @@ -103,11 +102,11 @@ io: # you will want to set up a passthrough domain for socket.io. # If the root of this domain is not the same as the root of your HTTP domain # (or HTTPS if SSL is enabled), logins won't work. - domain: '${IO_ROOT_URL}' + domain: 'http://localhost' # Even though you may specify multiple ports to listen on for HTTP above, # one port must be specified as default for the purposes of generating # links with the appropriate port - default-port: ${IO_ROOT_PORT} + default-port: 1337 # limit the number of concurrent socket connections per IP address ip-connection-limit: 10 # Whether or not to use zlib to compress each socket message (this option is @@ -138,7 +137,7 @@ mail: # 4. Click "Create new Key" under "Public API access" # 5. Click "Server key" # 6. Under "APIs & auth" click "YouTube Data API" and then click "Enable API" -youtube-v3-key: '${YOUTUBE_KEY}' +youtube-v3-key: '' # Minutes between saving channel state to disk channel-save-interval: 5 # Limit for the number of channels a user can register @@ -217,7 +216,7 @@ channel-blacklist: [] # server-synched raw file playback. This requires the following: # * ffmpeg must be installed on the server ffmpeg: - enabled: true + enabled: false # Executable name for ffprobe if it is not "ffprobe". On Debian and Ubuntu (on which # libav is used rather than ffmpeg proper), this is "avprobe" ffprobe-exec: 'ffprobe' @@ -250,7 +249,7 @@ service-socket: # Twitch Client ID for the data API (used for VOD lookups) # https://github.com/justintv/Twitch-API/blob/master/authentication.md#developer-setup -twitch-client-id: '${TWITCH_CLIENT_ID}' +twitch-client-id: null poll: - max-options: 50 + max-options: 50 \ No newline at end of file diff --git a/package.json b/package.json index e0e09235..1b9a0fae 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "csrf": "^3.0.0", "cytube-common": "git://github.com/CyTube/cytube-common", "cytube-mediaquery": "git://github.com/CyTube/mediaquery", - "cytubefilters": "git://github.com/davidsiaw/cytubefilters", + "cytubefilters": "git://github.com/calzoneman/cytubefilters#67c7c69a", "express": "^4.13.3", "express-minify": "^0.1.6", "graceful-fs": "^4.1.2", diff --git a/run.sh b/run.sh index efdc2990..3950765b 100755 --- a/run.sh +++ b/run.sh @@ -54,7 +54,7 @@ EOF rm -f $tfile fi -envsubst < config.template.yaml > config.yaml +envsubst < config.docker.yaml > config.yaml mysqld --user=root & while :