├── README.md ├── ampache ├── ampache-cfg │ ├── Dockerfile │ ├── setup.sh │ └── var │ │ └── www │ │ ├── config │ │ ├── .htaccess │ │ └── ampache.cfg.php │ │ ├── play │ │ ├── .htaccess │ │ └── index.php │ │ └── rest │ │ ├── .htaccess │ │ └── index.php ├── ampache │ ├── docker-compose.yml │ └── rancher-compose.yml ├── db │ └── docker-compose.yml └── lb │ ├── docker-compose.yml │ └── rancher-compose.yml ├── droneio ├── README.md ├── docker-compose.yml └── rancher-compose.yml └── lychee-docker ├── Dockerfile ├── LICENSE ├── README.md ├── additional-files ├── cloud-config.yml └── elb-config ├── conf ├── lychee ├── php.conf └── startup.conf ├── docker-compose.yml ├── env ├── nfs ├── Dockerfile └── docker-compose.yml ├── rancher-compose.yml └── startup.sh /README.md: -------------------------------------------------------------------------------- 1 | # Rancher Compose Demos 2 | 3 | ## What is this? 4 | 5 | These are Docker Compose files used in Rancher Meetups, Demos and presentations. 6 | 7 | 8 | 9 | ### License 10 | 11 | Copyright (c) 2014-2015 Rancher Labs, Inc. 12 | 13 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -------------------------------------------------------------------------------- /ampache/ampache-cfg/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | RUN apt-get update && \ 4 | apt-get install -y curl 5 | RUN curl -sL https://github.com/rancher/compose-templates/raw/master/utils/containers/confd/confd-0.11.0-dev-rancher-linux-amd64 > /usr/bin/confd 6 | RUN chmod +x /usr/bin/confd 7 | 8 | VOLUME /var/www/config 9 | VOLUME /var/www/play 10 | VOLUME /var/www/rest 11 | VOLUME /var/lib/mysql 12 | 13 | COPY ./var /etc/confd/templates/var/ 14 | COPY setup.sh / 15 | 16 | ENTRYPOINT ["/setup.sh"] 17 | CMD ["confd", "--backend", "rancher", "--prefix", "/2015-07-25"] 18 | -------------------------------------------------------------------------------- /ampache/ampache-cfg/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BASE=/etc/confd/templates 3 | 4 | cd / 5 | mkdir -p /etc/confd/conf.d 6 | 7 | i=0 8 | for SRC in $(find $BASE -type f); do 9 | SRC=${SRC##$BASE} 10 | FILENAME=${i}-$(basename $SRC).toml 11 | cat > /etc/confd/conf.d/${FILENAME} << EOF 12 | [template] 13 | src = "${SRC}" 14 | dest = "${SRC}" 15 | keys = [ 16 | "/", 17 | ] 18 | EOF 19 | i=$((i+1)) 20 | done 21 | 22 | exec "$@" 23 | -------------------------------------------------------------------------------- /ampache/ampache-cfg/var/www/config/.htaccess: -------------------------------------------------------------------------------- 1 | Order deny,allow 2 | Deny from all -------------------------------------------------------------------------------- /ampache/ampache-cfg/var/www/config/ampache.cfg.php: -------------------------------------------------------------------------------- 1 | ;### 2 | ;################### 3 | ; General Config # 4 | ;################### 5 | 6 | ; This value is used to detect quickly 7 | ; if this config file is up to date 8 | ; this is compared against a value hard-coded 9 | ; into the init script 10 | config_version = 16 11 | 12 | ;################### 13 | ; Path Vars # 14 | ;################### 15 | 16 | ; The http host of your server. 17 | ; If not set, retrieved automatically from client request. 18 | ; This setting is required for WebSocket server 19 | ; DEFAULT: "" 20 | ;http_host = "localhost" 21 | 22 | ; The path to your ampache install 23 | ; Do not put a trailing / on this path 24 | ; For example if your site is located at http://localhost 25 | ; than you do not need to enter anything for the web_path 26 | ; if it is located at http://localhost/music you need to 27 | ; set web_path to /music 28 | ; DEFAULT: "" 29 | web_path = "" 30 | 31 | ;############################## 32 | ; Session and Login Variables # 33 | ;############################## 34 | 35 | ; Hostname of your database 36 | ; DEFAULT: localhost 37 | database_hostname = "mysql" 38 | 39 | ; Port to use when connecting to your database 40 | ; DEFAULT: none 41 | database_port = "3306" 42 | 43 | ; Name of your ampache database 44 | ; DEFAULT: ampache 45 | database_name = "ampache" 46 | 47 | ; Username for your ampache database 48 | ; DEFAULT: "" 49 | database_username = "{{getv "/self/service/metadata/db_user"}}" 50 | 51 | ; Password for your ampache database, this can not be blank 52 | ; this is a 'forced' security precaution, the default value 53 | ; will not work 54 | ; DEFAULT: "" 55 | database_password = "{{getv "/self/service/metadata/db_pass"}}" 56 | 57 | ; Length that a session will last expressed in seconds. Default is 58 | ; one hour. 59 | ; DEFAULT: 3600 60 | session_length = 3600 61 | 62 | ; Length that the session for a single streaming instance will last 63 | ; the default is two hours. With some clients, and long songs this can 64 | ; cause playback to stop, increase this value if you experience that 65 | ; DEFAULT: 7200 66 | stream_length = 7200 67 | 68 | ; This length defines how long a 'remember me' session and cookie will 69 | ; last, the default is 7200, same as length. It is up to the administrator 70 | ; of the box to increase this, for reference 86400 = 1 day 71 | ; 604800 = 1 week and 2419200 = 1 month 72 | ; DEFAULT: 86400 73 | remember_length = 86400 74 | 75 | ; Name of the Session/Cookie that will sent to the browser 76 | ; default should be fine 77 | ; DEFAULT: ampache 78 | session_name = ampache 79 | 80 | ; Lifetime of the Cookie, 0 == Forever (until browser close) , otherwise in terms of seconds 81 | ; If you want cookies to last past a browser close set this to a value in seconds. 82 | ; DEFAULT: 0 83 | session_cookielife = 0 84 | 85 | ; Is the cookie a "secure" cookie? This should only be set to 1 (true) if you are 86 | ; running a secure site (HTTPS). 87 | ; DEFAULT: 0 88 | session_cookiesecure = 0 89 | 90 | ; Auth Methods 91 | ; This defines which auth methods Auth will attempt to use and in which order. 92 | ; If auto_create isn't enabled the user must exist locally. 93 | ; DEFAULT: mysql 94 | ; VALUES: mysql,ldap,http,pam,external,openid 95 | auth_methods = "mysql" 96 | 97 | ; External authentication 98 | ; This sets the helper used for external authentication. It should conform to 99 | ; the interface used by mod_authnz_external 100 | ; DEFAULT: none 101 | ;external_authenticator = "/usr/sbin/pwauth" 102 | 103 | ; Automatic local password updating 104 | ; Determines whether successful authentication against an external source 105 | ; will result in an update to the password stored in the database. 106 | ; A locally stored password is needed for API access. 107 | ; DEFAULT: false 108 | ;auth_password_save = "false" 109 | 110 | ; Logout redirection target 111 | ; Defaults to our own login.php, but we can override it here if, for instance, 112 | ; we want to redirect to an SSO provider instead. 113 | ; logout_redirect = "http://sso.example.com/logout" 114 | 115 | ;##################### 116 | ; Program Settings # 117 | ;##################### 118 | 119 | ; File Pattern 120 | ; This defines which file types Ampache will attempt to catalog 121 | ; You can specify any file extension you want in here separating them 122 | ; with a | 123 | ; DEFAULT: mp3|mpc|m4p|m4a|mp4|aac|ogg|rm|wma|asf|flac|spx|ra|ape|shn|wv 124 | catalog_file_pattern = "mp3|mpc|m4p|m4a|mp4|aac|ogg|rm|wma|asf|flac|spx|ra|ape|shn|wv" 125 | 126 | ; Video Pattern 127 | ; This defines which video file types Ampache will attempt to catalog 128 | ; You can specify any file extension you want in here seperating them with 129 | ; a | but ampache may not be able to parse them 130 | ; DEAFULT: avi|mpg|flv|m4v|webm 131 | catalog_video_pattern = "avi|mpg|flv|m4v|webm" 132 | 133 | ; Playlist Pattern 134 | ; This defines which playlist types Ampache will attempt to catalog 135 | ; You can specify any file extension you want in here seperating them with 136 | ; a | but ampache may not be able to parse them 137 | ; DEFAULT: m3u|pls|asx|xspf 138 | catalog_playlist_pattern = "m3u|pls|asx|xspf" 139 | 140 | ; Prefix Pattern 141 | ; This defines which prefix Ampache will ignore when importing tags from 142 | ; your music. You may add any prefix you want seperating them with a | 143 | ; DEFAULT: The|An|A|Die|Das|Ein|Eine|Les|Le|La 144 | catalog_prefix_pattern = "The|An|A|Die|Das|Ein|Eine|Les|Le|La" 145 | 146 | ; Catalog disable 147 | ; This defines if catalog can be disabled without removing database entries 148 | ; WARNING: this increase sensibly sql requests and slow down Ampache a lot 149 | ; DEFAULT: false 150 | ;catalog_disable = "false" 151 | 152 | ; Use Access List 153 | ; Toggle this on if you want ampache to pay attention to the access list 154 | ; and only allow streaming/downloading/api-rpc from known hosts api-rpc 155 | ; will not work without this on. 156 | ; NOTE: Default Behavior is DENY FROM ALL 157 | ; DEFAULT: true 158 | access_control = "true" 159 | 160 | ; Require Session 161 | ; If this is set to true ampache will make sure that the URL passed when 162 | ; attempting to retrieve a song contains a valid Session ID This prevents 163 | ; others from guessing URL's. This setting is ignored if you have use_auth 164 | ; disabled. 165 | ; DEFAULT: true 166 | require_session = "true" 167 | 168 | ; Require LocalNet Session 169 | ; If this is set to true then ampache will require that a valid session 170 | ; is passed even on hosts defined in the Local Network ACL. This setting 171 | ; has no effect if access_control is not enabled 172 | ; DEFAULT: true 173 | require_localnet_session = "true" 174 | 175 | ; Multiple Logins 176 | ; Added by Vlet 07/25/07 177 | ; When this setting is enabled a user may only be logged in from a single 178 | ; IP address at any one time, this is to prevent sharing of accounts 179 | ; DEFAULT: false 180 | ;prevent_multiple_logins = "false" 181 | 182 | ; Downsample Remote 183 | ; If this is set to true and access control is on any users who are not 184 | ; coming from a defined 'network' ACL will be automatically downsampled 185 | ; regardless of their preferences. Requires access_control to be enabled 186 | ; DEFAULT: false 187 | ;downsample_remote = "false" 188 | 189 | ; Track User IPs 190 | ; If this is enabled Ampache will log the IP of every completed login 191 | ; it will store user,ip,time at one row per login. The results are 192 | ; displayed in Admin --> Users 193 | ; DEFAULT: false 194 | ;track_user_ip = "false" 195 | 196 | ; User IP Cardinality 197 | ; This defines how many days worth of IP history Ampache will track 198 | ; As it is one row per login on high volume sites you will want to 199 | ; clear it every now and then. 200 | ; DEFAULT: 42 days 201 | ;user_ip_cardinality = "42" 202 | 203 | ; Allow Zip Download 204 | ; This setting allows/disallows using zlib to zip up an entire 205 | ; playlist/album for download. Even if this is turned on you will 206 | ; still need to enabled downloading for the specific user you 207 | ; want to be able to use this function 208 | ; DEFAULT: false 209 | ;allow_zip_download = "false" 210 | 211 | ; File Zip Download 212 | ; This settings tells Ampache to attempt to save the zip file 213 | ; to the filesystem instead of creating it in memory, you must 214 | ; also set tmp_dir_path in order for this to work 215 | ; DEFAULT: false 216 | ;file_zip_download = "false" 217 | 218 | ; File Zip Comment 219 | ; This is an optional configuration option that adds a comment 220 | ; to your zip files, this only applies if you've got allow_zip_downloads 221 | ; DEFAULT: Ampache - Zip Batch Download 222 | ;file_zip_comment = "Ampache - Zip Batch Download" 223 | 224 | ; Waveform 225 | ; This settings tells Ampache to attempt to generate a waveform 226 | ; for each song. It requires transcode and encode_args_wav settings. 227 | ; You must also set tmp_dir_path in order for this to work 228 | ; DEFAULT: false 229 | ;waveform = "false" 230 | 231 | ; Waveform color 232 | ; The waveform color. 233 | ; DEFAULT: #FF0000 234 | ;waveform_color = "#FF0000" 235 | 236 | ; Temporary Directory Path 237 | ; If File Zip Download or Waveform is enabled this must be set to tell 238 | ; Ampache which directory to save the temporary file to. Do not put a 239 | ; trailing slash or this will not work. 240 | ; DEFAULT: false 241 | ;tmp_dir_path = "false" 242 | 243 | ; This setting throttles a persons downloading to the specified 244 | ; bytes per second. This is not a 100% guaranteed function, and 245 | ; you should really use a server based rate limiter if you want 246 | ; to do this correctly. 247 | ; DEFAULT: off 248 | ; VALUES: any whole number (in bytes per second) 249 | ;throttle_download = 10 250 | 251 | ; This determines the tag order for all cataloged 252 | ; music. If none of the listed tags are found then 253 | ; ampache will randomly use whatever was found. 254 | ; POSSIBLE VALUES: ape asf avi id3v1 id3v2 lyrics3 matroska mpeg quicktime riff 255 | ; vorbiscomment 256 | ; DEFAULT: id3v2 id3v1 vorbiscomment quicktime matroska ape asf avi mpeg riff 257 | getid3_tag_order = "id3v2,id3v1,vorbiscomment,quicktime,matroska,ape,asf,avi,mpeg,riff" 258 | 259 | ; Determines whether we try to autodetect the encoding for id3v2 tags. 260 | ; May break valid tags. 261 | ; DEFAULT: false 262 | ;getid3_detect_id3v2_encoding = "false" 263 | 264 | ; This determines the order in which metadata sources are used (and in the 265 | ; case of plugins, checked) 266 | ; POSSIBLE VALUES (builtins): filename and getID3 267 | ; POSSIBLE VALUES (plugins): MusicBrainz, plus any others you've installed. 268 | ; DEFAULT: getID3 filename 269 | metadata_order = "getID3,filename" 270 | 271 | ; Un comment if don't want ampache to follow symlinks 272 | ; DEFAULT: false 273 | ;no_symlinks = "false" 274 | 275 | ; Use auth? 276 | ; If this is set to "Yes" ampache will require a valid 277 | ; Username and password. If this is set to false then ampache 278 | ; will not ask you for a username and password. false is only 279 | ; recommended for internal only instances 280 | ; DEFAULT true 281 | use_auth = "false" 282 | 283 | ; Default Auth Level 284 | ; If use_auth is set to false then this option is used 285 | ; to determine the permission level of the 'default' users 286 | ; default is administrator. This setting only takes affect 287 | ; if use_auth if false 288 | ; POSSIBLE VALUES: user, admin, manager, guest 289 | ; DEFAULT: admin 290 | default_auth_level = "admin" 291 | 292 | ; 5 Star Ratings 293 | ; This allows ratings for almost any object in ampache 294 | ; POSSIBLE VALUES: false true 295 | ; DEFAULT: true 296 | ratings = "true" 297 | 298 | ; User flags/favorites 299 | ; This allows user flags for almost any object in ampache as favorite 300 | ; POSSIBLE VALUES: false true 301 | ; DEFAULT: true 302 | userflags = "true" 303 | 304 | ; Direct play 305 | ; This allows user to play directly a song or album 306 | ; POSSIBLE VALUES: false true 307 | ; DEFAULT: true 308 | directplay = "true" 309 | 310 | ; Sociable 311 | ; This turns on / off all of the "social" features of ampache 312 | ; default is on, but if you don't care and just want music 313 | ; turn this off to disable all social features. 314 | ; DEFAULT: true 315 | sociable = "true" 316 | 317 | ; Notify 318 | ; This turns on / off all Ampache notifications 319 | ; DEFAULT: true 320 | notify = "true" 321 | 322 | ; This options will turn on/off Demo Mode 323 | ; If Demo mode is on you can not play songs or update your catalog 324 | ; in other words.. leave this commented out 325 | ; DEFAULT: false 326 | ;demo_mode = "false" 327 | 328 | ; Caching 329 | ; This turns the caching mechanisms on or off, due to a large number of 330 | ; problems with people with very large catalogs and low memory settings 331 | ; this is off by default as it does significantly increase the memory 332 | ; requirments on larger catalogs. If you have the memory this can create 333 | ; a 2-3x speed improvement. 334 | ; DEFAULT: false 335 | ;memory_cache = false 336 | 337 | ; Memory Limit 338 | ; This defines the "Min" memory limit for PHP if your php.ini 339 | ; has a lower value set Ampache will set it up to this. If you 340 | ; set it below 16MB getid3() will not work! 341 | ; DEFAULT: 32 342 | ;memory_limit = 32 343 | 344 | ; Album Art Preferred Filename 345 | ; Specify a filename to look for if you always give the same filename 346 | ; i.e. "folder.jpg" Ampache currently only supports jpg/gif and png 347 | ; Especially useful if you have a front and a back image in a folder 348 | ; comment out if ampache should search for any jpg,gif or png 349 | ; DEFAULT: folder.jpg 350 | ;album_art_preferred_filename = "folder.jpg" 351 | 352 | ; Resize Images * Requires PHP-GD * 353 | ; Set this to true if you want Ampache to resize the Album 354 | ; art on the fly, this increases load time and CPU usage 355 | ; and also requires the PHP-GD library. This is very useful 356 | ; If you have high-quality album art and a small upload cap 357 | ; DEFAULT: false 358 | ;resize_images = "false" 359 | 360 | ; Art Gather Order 361 | ; Simply arrange the following in the order you would like 362 | ; ampache to search. If you want to disable one of the search 363 | ; methods simply leave it out. DB should be left as the first 364 | ; method unless you want it to overwrite what's already in the 365 | ; database 366 | ; POSSIBLE VALUES: db tags folder amazon lastfm musicbrainz google 367 | ; DEFAULT: db,tags,folder,musicbrainz,lastfm,google 368 | art_order = "db,tags,folder,musicbrainz,lastfm,google" 369 | 370 | ; Amazon Developer Key 371 | ; These are needed in order to actually use the amazon album art 372 | ; Your public key is your 'Access Key ID' 373 | ; Your private key is your 'Secret Access Key' 374 | ; DEFAULT: false 375 | ;amazon_developer_public_key = "" 376 | ;amazon_developer_private_key = "" 377 | ;amazon_developer_associate_tag = "" 378 | 379 | ; Recommendations 380 | ; Set this to true to enable display of similar artists or albums 381 | ; while browsing. Requires Last.FM. 382 | ; DEFAULT: false 383 | ;show_similar = "false" 384 | 385 | ; Concerts 386 | ; Set this to true to enable display of artist concerts 387 | ; Requires Last.FM. 388 | ; DEFAULT: false 389 | ;show_concerts = "false" 390 | 391 | ; Last.FM API Key 392 | ; Set this to your Last.FM api key to actually use Last.FM for 393 | ; recommendations. 394 | ;lastfm_api_key = "" 395 | 396 | ; Wanted 397 | ; Set this to true to enable display missing albums and the 398 | ; possibility for users to mark it as wanted. 399 | ; DEFAULT: false 400 | ;wanted = "false" 401 | 402 | ; Wanted types 403 | ; Set the allowed types of wanted releases (album,compilation,single,ep,live,remix,promotion,official) 404 | ; DEFAULT: album,official 405 | wanted_types = "album,official" 406 | 407 | ; Wanted Auto Accept 408 | ; Mark wanted requests as accepted by default (no content manager agreement required) 409 | ; DEFAULT: false 410 | ;wanted_auto_accept = "false" 411 | 412 | ; EchoNest API key 413 | ; EchoNest provides several music services. Currently used for missing song 30 seconds preview. 414 | ;echonest_api_key = "" 415 | 416 | ; Broadcasts 417 | ; Allow users to broadcast music. 418 | ; This feature requires advanced server configuration, please take a look on the wiki for more information. 419 | ; DEFAULT: false 420 | ;broadcast = "false" 421 | 422 | ; Web Socket address 423 | ; Declare the web socket server address 424 | ; DEFAULT: determined automatically 425 | ;websocket_address = "ws://localhost:8100" 426 | 427 | ; Amazon base urls 428 | ; An array of Amazon sites to search. 429 | ; NOTE: This will search each of these sites in turn so don't expect it 430 | ; to be lightning fast! 431 | ; It is strongly recommended that only one of these is selected at any 432 | ; one time 433 | ; POSSIBLE VALUES: 434 | ; http://webservices.amazon.com 435 | ; http://webservices.amazon.co.uk 436 | ; http://webservices.amazon.de 437 | ; http://webservices.amazon.co.jp 438 | ; http://webservices.amazon.fr 439 | ; http://webservices.amazon.ca 440 | ; Default: http://webservices.amazon.com 441 | amazon_base_urls = "http://webservices.amazon.com" 442 | 443 | ; max_amazon_results_pages 444 | ; The maximum number of results pages to pull from EACH amazon site 445 | ; NOTE: The art search pages through the results returned by your search 446 | ; up to this number of pages. As with the base_urls above, this is going 447 | ; to take more time, the more pages you ask it to process. 448 | ; Of course a good search will return only a few matches anyway. 449 | ; It is strongly recommended that you do _not_ change this value 450 | ; DEFAULT: 1 page (10 items) 451 | max_amazon_results_pages = 1 452 | 453 | ; Debug 454 | ; If this is enabled Ampache will write debugging information to the log file 455 | ; DEFAULT: false 456 | ;debug = "false" 457 | 458 | ; Debug Level 459 | ; This should always be set in conjunction with the 460 | ; debug option, it defines how prolific you want the 461 | ; debugging in ampache to be. values are 1-5. 462 | ; 1 == Errors only 463 | ; 2 == Error + Failures (login attempts etc.) 464 | ; 3 == ?? 465 | ; 4 == ?? (Profit!) 466 | ; 5 == Information (cataloging progress etc.) 467 | ; DEFAULT: 5 468 | debug_level = 5 469 | 470 | ; Path to Log File 471 | ; This defines where you want ampache to log events to 472 | ; this will only happen if debug is turned on. Do not 473 | ; include trailing slash. You will need to make sure that 474 | ; the specified directory exists and your HTTP server has 475 | ; write access. 476 | ; DEFAULT: NULL 477 | ;log_path = "/var/log/ampache" 478 | 479 | ; Log filename pattern 480 | ; This defines where the log file name pattern. 481 | ; %name.%Y%m%d.log will create a different log file every day. 482 | ; DEFAULT: %name.%Y%m%d.log 483 | log_filename = "%name.%Y%m%d.log" 484 | 485 | ; Charset of generated HTML pages 486 | ; Default of UTF-8 should work for most people 487 | ; DEFAULT: UTF-8 488 | site_charset = "UTF-8" 489 | 490 | ; Locale Charset 491 | ; Local charset (mainly for file operations) if different 492 | ; from site_charset. 493 | ; This is disabled by default, enable only if needed 494 | ; (for Windows please set lc_charset to ISO8859-1) 495 | ; DEFAULT: ISO8859-1 496 | ;lc_charset = "ISO8859-1" 497 | 498 | ; Refresh Limit 499 | ; This defines the default refresh limit in seconds for 500 | ; pages with dynamic content, such as now playing 501 | ; DEFAULT: 60 502 | ; Possible Values: Int > 5 503 | refresh_limit = "60" 504 | 505 | ;######################################################### 506 | ; Custom actions (optional) # 507 | ;######################################################### 508 | 509 | ; Your custom play action title 510 | ;custom_play_action_title_0 = "" 511 | ; Your custom play action icon name (stored as /images/icon_[your_image].png) 512 | ;custom_play_action_icon_0 = "" 513 | ; Your custom action script, where: 514 | ; - %f: the media file path 515 | ; - %c: the excepted codec target (mp3, ogg, ...) 516 | ; - %a: the artist name 517 | ; - %A: the album name 518 | ; - %t: the song title 519 | ;custom_play_action_run_0 = "" 520 | 521 | ; Example for Karaoke playing 522 | ;custom_play_action_title_0 = "Karaoke" 523 | ;custom_play_action_icon_0 = "microphone" 524 | ;custom_play_action_run_0 = "sox \"%f\" -p oops | ffmpeg -i pipe:0 -f %c pipe:1" 525 | 526 | ;######################################################### 527 | ; LDAP login info (optional) # 528 | ;######################################################### 529 | 530 | ; LDAP filter string to use (required) 531 | ; For OpenLDAP use "uid" 532 | ; For Microsoft Active Directory (MAD) use "sAMAccountName" 533 | ; DEFAULT: null 534 | ; ldap_filter = "sAMAccountName" 535 | 536 | ; LDAP objectclass (required) 537 | ; OpanLDAP objectclass = "*" 538 | ; MAD objectclass = "organizationalPerson" 539 | ; DEFAULT null 540 | ;ldap_objectclass = "organizationalPerson" 541 | 542 | ; Initial credentials to bind with for searching (optional) 543 | ; DEFAULT: null 544 | ;ldap_username = "" 545 | ;ldap_password = "" 546 | 547 | ; Require that the user is in a specific group (optional) 548 | ; DEFAULT: null 549 | ;ldap_require_group = "cn=yourgroup,ou=yourorg,dc=yoursubdomain,dc=yourdomain,dc=yourtld" 550 | 551 | ; This is the search dn used to find users (required) 552 | ; DEFAULT: null 553 | ;ldap_search_dn = "ou=People,dc=yoursubdomain,dc=yourdomain,dc=yourtld" 554 | 555 | ; This is the address of your ldap server (required) 556 | ; DEFAULT: null 557 | ;ldap_url = "" 558 | 559 | ; Attributes where additional user information is stored (optional) 560 | ; OpenLDAP ldap_name_field = "cn" 561 | ; MAD ldap_name_field = "displayname" 562 | ; DEFAULT: null 563 | ;ldap_email_field = "mail" 564 | ;ldap_name_field = "cn" 565 | 566 | ;######################################################### 567 | ; OpenID login info (optional) # 568 | ;######################################################### 569 | 570 | ; Requires specific OpenID Provider Authentication Policy 571 | ; DEFAULT: null 572 | ; VALUES: PAPE_AUTH_MULTI_FACTOR_PHYSICAL,PAPE_AUTH_MULTI_FACTOR,PAPE_AUTH_PHISHING_RESISTANT 573 | ;openid_required_pape = "" 574 | 575 | ;######################################################### 576 | ; Public Registration settings, defaults to disabled # 577 | ;######################################################### 578 | 579 | ; This setting will silently create an ampache account 580 | ; for anyone who can login using ldap (or any other login 581 | ; extension). The default is to create new users as guests 582 | ; see auto_user config option if you would like to change this 583 | ; DEFAULT: false 584 | ;auto_create = "false" 585 | 586 | ; This setting turns on/off public registration. It is 587 | ; recommended you leave this off, as it will allow anyone to 588 | ; sign up for an account on your server. 589 | ; REMEMBER: don't forget to set the mail from address further down in the config. 590 | ; DEFAULT: false 591 | ;allow_public_registration = "false" 592 | 593 | ; Require Captcha Text on Image confirmation 594 | ; Turning this on requires the user to correctly 595 | ; type in the letters in the image created by Captcha 596 | ; Default is off because its very hard to detect if it failed 597 | ; to draw, or they failed to enter it. 598 | ; DEFAULT: false 599 | ;captcha_public_reg = "false" 600 | 601 | ; This setting turns on/off admin notification of registration. 602 | ; DEFAULT: false 603 | ;admin_notify_reg = "false" 604 | 605 | ; This setting determines whether the user will be created as a disabled user. 606 | ; If this is on, an administrator will need to manually enable the account 607 | ; before it's usable. 608 | ; DEFAULT: false 609 | ;admin_enable_required = "false" 610 | 611 | ; This setting will allow all registrants/ldap/http users 612 | ; to be auto-approved as a user. By default, they will be 613 | ; added as a guest and must be promoted by the admin. 614 | ; POSSIBLE VALUES: guest, user, admin 615 | ; DEFAULT: guest 616 | ;auto_user = "guest" 617 | 618 | ; This will display the user agreement when registering 619 | ; For agreement text, edit templates/user_agreement.php 620 | ; User will need to accept the agreement before they can register 621 | ; DEFAULT: false 622 | ;user_agreement = "false" 623 | 624 | ; This disable email confirmation when registering. 625 | ; DEFAULT: false 626 | ;user_no_email_confirm = "false" 627 | 628 | ;######################################################## 629 | ; These options control the dynamic downsampling based # 630 | ; on current usage # 631 | ; *Note* Transcoding must be enabled and working # 632 | ;######################################################## 633 | 634 | ; Attempt to optimize bandwidth by dynamically lowering the bit rate of new 635 | ; streams. Since the bit rate is only adjusted at the beginning of a song, the 636 | ; actual cumulative bitrate for concurrent streams can be up to around 637 | ; double the configured value. It also only applies to streams that are 638 | ; transcoded. 639 | ; DEFAULT: none 640 | ;max_bit_rate = 576 641 | 642 | ; New dynamically downsampled streams will be denied if they are forced below 643 | ; this value. 644 | ; DEFAULT: 8 645 | ;min_bit_rate = 48 646 | 647 | ;###################################################### 648 | ; These are commands used to transcode non-streaming 649 | ; formats to the target file type for streaming. 650 | ; This can be useful in re-encoding file types that don't stream 651 | ; very well, or if your player doesn't support some file types. 652 | ; 653 | ; 'Downsampling' will also use these commands. 654 | ; 655 | ; To state the bleeding obvious, any programs referenced in the transcode 656 | ; commands must be installed, in the web server's search path (or referenced 657 | ; by their full path), and executable by the web server. 658 | 659 | ; Input type selection 660 | ; TYPE is the extension. 'allowed' certifies that transcoding works properly for 661 | ; this input format. 'required' further forbids the direct streaming of a format 662 | ; (e.g. if you store everything in FLAC, but don't want to ever stream that.) 663 | ; transcode_TYPE = {allowed|required|false} 664 | ; DEFAULT: false 665 | ;transcode_m4a = allowed 666 | ;transcode_flac = required 667 | ;transcode_mpc = required 668 | ;transcode_ogg = required 669 | ;transcode_wav = required 670 | ;transcode_mp3 = allowed 671 | 672 | ; Default output format 673 | ; DEFAULT: none 674 | ;encode_target = mp3 675 | 676 | ; Override the default output format on a per-type basis 677 | ; encode_target_TYPE = TYPE 678 | ; DEFAULT: none 679 | ;encode_target_flac = ogg 680 | 681 | ; Allow clients to override transcode settings (output type, bitrate, codec ...) 682 | ; DEFAULT: true 683 | transcode_player_customize = true 684 | 685 | ; Command configuration. Substitutions will be made as follows: 686 | ; %FILE% => filename 687 | ; %SAMPLE% => target sample rate 688 | ; You can do fancy things like VBR, but consider whether the consequences are 689 | ; acceptable in your environment. 690 | 691 | ; Master transcode command 692 | ; transcode_cmd should be a single command that supports multiple file types, 693 | ; such as ffmpeg or avconv. It's still possible to make a configuration that's 694 | ; equivalent to the old default, but if you find that necessary you should be 695 | ; clever enough to figure out how on your own. 696 | ; DEFAULT: none 697 | ;transcode_cmd = "ffmpeg -i %FILE%" 698 | ;transcode_cmd = "avconv -i %FILE%" 699 | ;transcode_cmd = "/usr/bin/neatokeen %FILE%" 700 | 701 | ; Specific transcode commands 702 | ; It shouldn't be necessary in most cases, but you can override the transcode 703 | ; command for specific source formats. It still needs to accept the 704 | ; encoding arguments, so the easiest approach is to use your normal command as 705 | ; a clearing-house. 706 | ; transcode_cmd_TYPE = TRANSCODE_CMD 707 | ;transcode_cmd_mid = "timidity -Or -o – %FILE% | ffmpeg -f s16le -i pipe:0" 708 | 709 | ; Encoding arguments 710 | ; For each output format, you should provide the necessary arguments for 711 | ; your transcode_cmd. 712 | ; encode_args_TYPE = TRANSCODE_CMD_ARGS 713 | ;encode_args_mp3 = "-vn -b:a %SAMPLE%K -c:a libmp3lame -f mp3 pipe:1" 714 | ;encode_args_ogg = "-vn -b:a %SAMPLE%K -c:a libvorbis -f ogg pipe:1" 715 | ;encode_args_m4a = "-vn -b:a %SAMPLE%K -c:a libfdk_aac -f adts pipe:1" 716 | ;encode_args_wav = "-vn -b:a %SAMPLE%K -c:a pcm_s16le -f wav pipe:1" 717 | 718 | ;###################################################### 719 | ; these options allow you to configure your rss-feed 720 | ; layout. rss exists of two parts, main and song main is the information about the feed 721 | ; song is the information in the feed. can be multiple items. 722 | ; use_rss = false (values true | false) 723 | ;DEFAULT: use_rss = false 724 | ;use_rss = false 725 | ;##################################################### 726 | 727 | ;############################# 728 | ; Proxy Settings (optional) # 729 | ;############################# 730 | ; If Ampache is behind an http proxy, specifiy the hostname or IP address 731 | ; port, proxyusername, and proxypassword here. 732 | ;DEFAULT: not in use 733 | ;proxy_host = "192.168.0.1" 734 | ;proxy_port = "8080" 735 | ;proxy_user = "" 736 | ;proxy_pass = "" 737 | 738 | ; If Ampache is behind an https reverse proxy, force use HTTPS protocol. 739 | ;Default: false 740 | ;force_ssl = true 741 | 742 | ;############################# 743 | ; Mail Settings # 744 | ;############################# 745 | 746 | ;Method used to send mail 747 | ;POSSIBLE VALUES: smtp sendmail php 748 | ;DEFAULT: php 749 | ;mail_type = "php" 750 | 751 | ;Mail domain. 752 | ;DEFAULT: example.com 753 | ;mail_domain = "example.com" 754 | 755 | ;This will be combined with mail_domain and used as the source address for 756 | ;emails generated by Ampache. For example, setting this to 'me' will set the 757 | ;sender to 'me@example.com'. 758 | ;DEFAULT: info 759 | ;mail_user = "info" 760 | 761 | ;A name to go with the email address. 762 | ;DEFAULT: Ampache 763 | ;mail_name = "Ampache" 764 | 765 | ;How strictly email addresses should be checked. 766 | ;easy does a regex match, strict actually performs some SMTP transactions 767 | ;to see if we can send to this address. 768 | ;POSSIBLE VALUES: strict easy none 769 | ; DEFAULT: strict 770 | ;mail_check = "strict" 771 | 772 | 773 | ;############################ 774 | ; sendmail Settings # 775 | ;############################ 776 | 777 | ;DEFAULT: /usr/sbin/sendmail 778 | ;sendmail_path = "/usr/sbin/sendmail" 779 | 780 | ;############################# 781 | ; SMTP Settings # 782 | ;############################# 783 | 784 | ;Mail server (hostname or IP address) 785 | ;DEFAULT: localhost 786 | ;mail_host = "localhost" 787 | 788 | ; SMTP port 789 | ;DEFAULT: 25 790 | ;mail_port = 25 791 | 792 | ;Secure SMTP 793 | ;POSSIBLE VALUES: ssl tls 794 | ;DEFAULT: none 795 | ;mail_secure_smtp = tls 796 | 797 | ;Enable SMTP authentication 798 | ;DEFAULT: false 799 | ;mail_auth = true 800 | 801 | ;SMTP Username 802 | ;your mail auth username. 803 | ;mail_auth_user = "" 804 | 805 | ; SMTP Password 806 | ; your mail auth password. 807 | ;mail_auth_pass = "" 808 | 809 | ;############################# 810 | ; Multibyte Settings # 811 | ;############################# 812 | ; See http://php.net/manual/mbstring.supported-encodings.php 813 | ; If you want ID3v1 encoding detection to work, you should uncomment this line 814 | ; so that the ordering is sane. 815 | ; DEFAULT: auto 816 | ;mb_detect_order = "ASCII,UTF-8,EUC-JP,ISO-2022-JP,SJIS,JIS" 817 | 818 | -------------------------------------------------------------------------------- /ampache/ampache-cfg/var/www/play/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | RewriteEngine On 3 | RewriteCond %{REQUEST_FILENAME} !-d 4 | RewriteCond %{REQUEST_FILENAME} !-s 5 | RewriteRule ^([^/]+)/([^/]+)(/.*)?$ /play/$3?$1=$2 [N,QSA] 6 | RewriteRule ^(/[^/]+|[^/]+/|/?)$ /play/index.php [L,QSA] 7 | -------------------------------------------------------------------------------- /ampache/ampache-cfg/var/www/play/index.php: -------------------------------------------------------------------------------- 1 | disabled)) { 93 | debug_event('UI::access_denied', "$user->username is currently disabled, stream access denied",'3'); 94 | header('HTTP/1.1 403 User Disabled'); 95 | exit; 96 | } 97 | 98 | // If require session is set then we need to make sure we're legit 99 | if (AmpConfig::get('require_session')) { 100 | if (!AmpConfig::get('require_localnet_session') AND Access::check_network('network',$GLOBALS['user']->id,'5')) { 101 | debug_event('play', 'Streaming access allowed for local network IP ' . $_SERVER['REMOTE_ADDR'],'5'); 102 | } else if (!Session::exists('stream', $sid)) { 103 | // No valid session id given, try with cookie session from web interface 104 | $sid = $_COOKIE[AmpConfig::get('session_name')]; 105 | if (!Session::exists('interface', $sid)) { 106 | debug_event('UI::access_denied', 'Streaming access denied: ' . $GLOBALS['user']->username . "'s session has expired", 3); 107 | header('HTTP/1.1 403 Session Expired'); 108 | exit; 109 | } 110 | } 111 | 112 | // Now that we've confirmed the session is valid 113 | // extend it 114 | Session::extend($sid, 'stream'); 115 | } 116 | 117 | /* Update the users last seen information */ 118 | $GLOBALS['user']->update_last_seen(); 119 | } else { 120 | $secret = $_REQUEST['share_secret']; 121 | $share = new Share($share_id); 122 | 123 | if (!$share->is_valid($secret, 'stream')) { 124 | header('HTTP/1.1 403 Access Unauthorized'); 125 | exit; 126 | } 127 | 128 | if ($type != 'song' || !$share->is_shared_song($oid)) { 129 | header('HTTP/1.1 403 Access Unauthorized'); 130 | exit; 131 | } 132 | 133 | $GLOBALS['user'] = new User($share->user); 134 | Preference::init(); 135 | } 136 | 137 | /* If we are in demo mode.. die here */ 138 | if (AmpConfig::get('demo_mode') || (!Access::check('interface','25') )) { 139 | debug_event('UI::access_denied', "Streaming Access Denied:" .AmpConfig::get('demo_mode') . "is the value of demo_mode. Current user level is " . $GLOBALS['user']->access,'3'); 140 | UI::access_denied(); 141 | exit; 142 | } 143 | 144 | /* 145 | If they are using access lists let's make sure 146 | that they have enough access to play this mojo 147 | */ 148 | if (AmpConfig::get('access_control')) { 149 | if (!Access::check_network('stream',$GLOBALS['user']->id,'25') AND 150 | !Access::check_network('network',$GLOBALS['user']->id,'25')) { 151 | debug_event('UI::access_denied', "Streaming Access Denied: " . $_SERVER['REMOTE_ADDR'] . " does not have stream level access",'3'); 152 | UI::access_denied(); 153 | exit; 154 | } 155 | } // access_control is enabled 156 | 157 | // Handle playlist downloads 158 | if ($type == 'playlist' && isset($playlist_type)) { 159 | $playlist = new Stream_Playlist($oid); 160 | // Some rudimentary security 161 | if ($uid != $playlist->user) { 162 | UI::access_denied(); 163 | exit; 164 | } 165 | $playlist->generate_playlist($playlist_type, false); 166 | exit; 167 | } 168 | 169 | /** 170 | * If we've got a tmp playlist then get the 171 | * current song, and do any other crazyness 172 | * we need to 173 | */ 174 | if ($demo_id) { 175 | $democratic = new Democratic($demo_id); 176 | $democratic->set_parent(); 177 | 178 | // If there is a cooldown we need to make sure this song isn't a repeat 179 | if (!$democratic->cooldown) { 180 | /* This takes into account votes etc and removes the */ 181 | $oid = $democratic->get_next_object(); 182 | } else { 183 | // Pull history 184 | $song_cool_check = 0; 185 | $oid = $democratic->get_next_object($song_cool_check); 186 | $oids = $democratic->get_cool_songs(); 187 | while (in_array($oid,$oids)) { 188 | $song_cool_check++; 189 | $oid = $democratic->get_next_object($song_cool_check); 190 | if ($song_cool_check >= '5') { break; } 191 | } // while we've got the 'new' song in old the array 192 | 193 | } // end if we've got a cooldown 194 | } // if democratic ID passed 195 | 196 | /** 197 | * if we are doing random let's pull the random object 198 | */ 199 | if ($random) { 200 | if ($_REQUEST['start'] < 1) { 201 | $oid = Random::get_single_song($_REQUEST['random_type']); 202 | // Save this one in case we do a seek 203 | $_SESSION['random']['last'] = $oid; 204 | } else { 205 | $oid = $_SESSION['random']['last']; 206 | } 207 | } // if random 208 | 209 | if ($type == 'song') { 210 | /* Base Checks passed create the song object */ 211 | $media = new Song($oid); 212 | $media->format(); 213 | } else if ($type == 'song_preview') { 214 | $media = new Song_Preview($oid); 215 | $media->format(); 216 | } else { 217 | $media = new Video($oid); 218 | $media->format(); 219 | } 220 | 221 | if ($media->catalog) { 222 | // Build up the catalog for our current object 223 | $catalog = Catalog::create_from_id($media->catalog); 224 | 225 | /* If the song is disabled */ 226 | if (!make_bool($media->enabled)) { 227 | debug_event('Play', "Error: $media->file is currently disabled, song skipped", '5'); 228 | // Check to see if this is a democratic playlist, if so remove it completely 229 | if ($demo_id && isset($democratic)) { $democratic->delete_from_oid($oid, 'song'); } 230 | header('HTTP/1.1 404 File Disabled'); 231 | exit; 232 | } 233 | 234 | // If we are running in Legalize mode, don't play songs already playing 235 | if (AmpConfig::get('lock_songs')) { 236 | if (!Stream::check_lock_media($media->id,get_class($media))) { 237 | exit; 238 | } 239 | } 240 | 241 | $media = $catalog->prepare_media($media); 242 | } else { 243 | // No catalog, must be song preview or something like that => just redirect to file 244 | header('Location: ' . $media->file); 245 | $media = null; 246 | } 247 | if ($media == null) { 248 | // Handle democratic removal 249 | if ($demo_id && isset($democratic)) { 250 | $democratic->delete_from_oid($oid, 'song'); 251 | } 252 | exit; 253 | } 254 | 255 | /* If we don't have a file, or the file is not readable */ 256 | if (!$media->file || !Core::is_readable(Core::conv_lc_file($media->file))) { 257 | 258 | // We need to make sure this isn't democratic play, if it is then remove 259 | // the song from the vote list 260 | if (is_object($tmp_playlist)) { 261 | $tmp_playlist->delete_track($oid); 262 | } 263 | // FIXME: why are these separate? 264 | // Remove the song votes if this is a democratic song 265 | if ($demo_id && isset($democratic)) { $democratic->delete_from_oid($oid, 'song'); } 266 | 267 | debug_event('play', "Song $media->file ($media->title) does not have a valid filename specified", 2); 268 | header('HTTP/1.1 404 Invalid song, file not found or file unreadable'); 269 | exit; 270 | } 271 | 272 | // don't abort the script if user skips this song because we need to update now_playing 273 | ignore_user_abort(true); 274 | 275 | // Format the song name 276 | $media_name = $media->f_artist_full . " - " . $media->title . "." . $media->type; 277 | 278 | header('Access-Control-Allow-Origin: *'); 279 | 280 | // Generate browser class for sending headers 281 | $browser = new Horde_Browser(); 282 | 283 | /* If they are just trying to download make sure they have rights 284 | * and then present them with the download file 285 | */ 286 | if ($_GET['action'] == 'download' AND AmpConfig::get('download')) { 287 | 288 | debug_event('play', 'Downloading file...', 5); 289 | // STUPID IE 290 | $media->format_pattern(); 291 | $media_name = str_replace(array('?','/','\\'),"_",$media->f_file); 292 | 293 | $browser->downloadHeaders($media_name,$media->mime,false,$media->size); 294 | $fp = fopen($media->file,'rb'); 295 | $bytesStreamed = 0; 296 | 297 | if (!is_resource($fp)) { 298 | debug_event('Play',"Error: Unable to open $media->file for downloading",'2'); 299 | exit(); 300 | } 301 | 302 | // Check to see if we should be throttling because we can get away with it 303 | if (AmpConfig::get('rate_limit') > 0) { 304 | while (!feof($fp)) { 305 | echo fread($fp,round(AmpConfig::get('rate_limit')*1024)); 306 | $bytesStreamed += round(AmpConfig::get('rate_limit')*1024); 307 | flush(); 308 | sleep(1); 309 | } 310 | } else { 311 | fpassthru($fp); 312 | } 313 | 314 | fclose($fp); 315 | exit(); 316 | 317 | } // if they are trying to download and they can 318 | 319 | // Prevent the script from timing out 320 | set_time_limit(0); 321 | 322 | // We're about to start. Record this user's IP. 323 | if (AmpConfig::get('track_user_ip')) { 324 | $GLOBALS['user']->insert_ip_history(); 325 | } 326 | 327 | $force_downsample = false; 328 | if (AmpConfig::get('downsample_remote')) { 329 | if (!Access::check_network('network', $GLOBALS['user']->id, '0')) { 330 | debug_event('play', 'Downsampling enabled for non-local address ' . $_SERVER['REMOTE_ADDR'], 5); 331 | $force_downsample = true; 332 | } 333 | } 334 | 335 | debug_event('play', 'Playing file ('.$media->file.'}...', 5); 336 | debug_event('play', 'Media type {'.$media->type.'}', 5); 337 | 338 | $cpaction = $_REQUEST['custom_play_action']; 339 | // Determine whether to transcode 340 | $transcode = false; 341 | // transcode_to should only have an effect if the song is the wrong format 342 | $transcode_to = $transcode_to == $media->type ? null : $transcode_to; 343 | 344 | debug_event('play', 'Custom play action {'.$cpaction.'}', 5); 345 | debug_event('play', 'Transcode to {'.$transcode_to.'}', 5); 346 | 347 | // If custom play action, do not try to transcode 348 | if (!$cpaction) { 349 | $transcode_cfg = AmpConfig::get('transcode'); 350 | $valid_types = $media->get_stream_types(); 351 | if ($transcode_cfg != 'never' && in_array('transcode', $valid_types)) { 352 | if ($transcode_to) { 353 | $transcode = true; 354 | debug_event('play', 'Transcoding due to explicit request for ' . $transcode_to, 5); 355 | } else if ($transcode_cfg == 'always') { 356 | $transcode = true; 357 | debug_event('play', 'Transcoding due to always', 5); 358 | } else if ($force_downsample) { 359 | $transcode = true; 360 | debug_event('play', 'Transcoding due to downsample_remote', 5); 361 | } else if (!in_array('native', $valid_types)) { 362 | $transcode = true; 363 | debug_event('play', 'Transcoding because native streaming is unavailable', 5); 364 | } else { 365 | debug_event('play', 'Decided not to transcode', 5); 366 | } 367 | } else if ($transcode_cfg != 'never') { 368 | debug_event('play', 'Transcoding is not enabled for this media type. Valid types: {'.json_encode($valid_types).'}', 5); 369 | } else { 370 | debug_event('play', 'Transcode disabled in user settings.', 5); 371 | } 372 | } 373 | 374 | if ($transcode) { 375 | $transcoder = Stream::start_transcode($media, $transcode_to, $bitrate); 376 | $fp = $transcoder['handle']; 377 | $media_name = $media->f_artist_full . " - " . $media->title . "." . $transcoder['format']; 378 | } else if ($cpaction) { 379 | $transcoder = $media->run_custom_play_action($cpaction, $transcode_to); 380 | $fp = $transcoder['handle']; 381 | $transcode = true; 382 | } else { 383 | $fp = fopen(Core::conv_lc_file($media->file), 'rb'); 384 | } 385 | 386 | if ($transcode) { 387 | // Content-length guessing if required by the player. 388 | // Otherwise it shouldn't be used as we are not really sure about final length when transcoding 389 | // Should also support video, but video implementation as to be reviewed first! 390 | if (get_class($media) == 'Song' && $_REQUEST['content_length'] == 'required') { 391 | $max_bitrate = Stream::get_allowed_bitrate($media); 392 | if ($media->time > 0 && $max_bitrate > 0) { 393 | $stream_size = ($media->time * $max_bitrate * 1000) / 8; 394 | } else { 395 | debug_event('play', 'Bad media duration / Max bitrate. Content-length calculation skipped.', 5); 396 | $stream_size = null; 397 | } 398 | } else { 399 | $stream_size = null; 400 | } 401 | } else { 402 | $stream_size = $media->size; 403 | } 404 | 405 | if (!is_resource($fp)) { 406 | debug_event('play', "Failed to open $media->file for streaming", 2); 407 | exit(); 408 | } 409 | 410 | header('ETag: ' . $media->id); 411 | // Put this song in the now_playing table only if it's a song for now... 412 | if (get_class($media) == 'Song') { 413 | Stream::insert_now_playing($media->id, $uid, $media->time, $sid, get_class($media)); 414 | } 415 | 416 | // Handle Content-Range 417 | 418 | $start = 0; 419 | $end = 0; 420 | sscanf($_SERVER['HTTP_RANGE'], "bytes=%d-%d", $start, $end); 421 | 422 | if ($start > 0 || $end > 0) { 423 | // Calculate stream size from byte range 424 | if (isset($end)) { 425 | $end = min($end, $media->size - 1); 426 | $stream_size = ($end - $start) + 1; 427 | } else { 428 | $stream_size = $media->size - $start; 429 | } 430 | 431 | if ($stream_size == null) { 432 | debug_event('play', 'Content-Range header received, which we cannot fulfill due to unknown final length (transcoding?)', 2); 433 | } else { 434 | if ($transcode) { 435 | debug_event('play', 'We should transcode only for a calculated frame range, but not yet supported here.', 2); 436 | $stream_size = null; 437 | } else { 438 | debug_event('play', 'Content-Range header received, skipping ' . $start . ' bytes out of ' . $media->size, 5); 439 | fseek($fp, $start); 440 | 441 | $range = $start . '-' . $end . '/' . $media->size; 442 | header('HTTP/1.1 206 Partial Content'); 443 | header('Content-Range: bytes ' . $range); 444 | } 445 | } 446 | } else { 447 | debug_event('play','Starting stream of ' . $media->file . ' with size ' . $media->size, 5); 448 | } 449 | 450 | if ($transcode) { 451 | header('Accept-Ranges: none'); 452 | } else { 453 | header('Accept-Ranges: bytes'); 454 | } 455 | 456 | $mime = ($transcode && isset($transcoder)) 457 | ? $media->type_to_mime($transcoder['format']) 458 | : $media->mime; 459 | 460 | $browser->downloadHeaders($media_name, $mime, false, $stream_size); 461 | 462 | $bytes_streamed = 0; 463 | 464 | // Actually do the streaming 465 | do { 466 | $read_size = $transcode 467 | ? 2048 468 | : min(2048, $stream_size - $bytes_streamed); 469 | $buf = fread($fp, $read_size); 470 | print($buf); 471 | ob_flush(); 472 | $bytes_streamed += strlen($buf); 473 | } while (!feof($fp) && (connection_status() == 0) && ($transcode || $bytes_streamed < $stream_size)); 474 | 475 | $real_bytes_streamed = $bytes_streamed; 476 | // Need to make sure enough bytes were sent. 477 | if ($bytes_streamed < $stream_size && (connection_status() == 0)) { 478 | print(str_repeat(' ', $stream_size - $bytes_streamed)); 479 | $bytes_streamed = $stream_size; 480 | } 481 | 482 | if ($start > 0) { 483 | debug_event('play', 'Content-Range doesn\'t start from 0, stats should already be registered previously; not collecting stats', 5); 484 | } else if ($real_bytes_streamed > 0) { 485 | // FIXME: support other media types 486 | if (get_class($media) == 'Song' && empty($share_id)) { 487 | if ($_SERVER['REQUEST_METHOD'] != 'HEAD') { 488 | debug_event('play', 'Registering stats for {'.$media->title.'}...', '5'); 489 | $sessionkey = Stream::$session; 490 | //debug_event('play', 'Current session key {'.$sessionkey.'}', '5'); 491 | $agent = Session::agent($sessionkey); 492 | //debug_event('play', 'Current session agent {'.$agent.'}', '5'); 493 | $GLOBALS['user']->update_stats($media->id, $agent); 494 | $media->set_played(); 495 | } 496 | } 497 | } 498 | 499 | // If this is a democratic playlist remove the entry. 500 | // We do this regardless of play amount. 501 | if ($demo_id && isset($democratic)) { $democratic->delete_from_oid($oid,'song'); } 502 | 503 | if ($transcode && isset($transcoder)) { 504 | if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { 505 | fread($transcoder['stderr'], 8192); 506 | fclose($transcoder['stderr']); 507 | } 508 | fclose($fp); 509 | proc_close($transcoder['process']); 510 | debug_event('transcode_cmd', $stderr, 5); 511 | } else { 512 | fclose($fp); 513 | } 514 | 515 | debug_event('play', 'Stream ended at ' . $bytes_streamed . ' (' . $real_bytes_streamed . ') bytes out of ' . $stream_size, 5); 516 | -------------------------------------------------------------------------------- /ampache/ampache-cfg/var/www/rest/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | RewriteEngine On 3 | RewriteCond %{REQUEST_FILENAME} !-d 4 | RewriteCond %{REQUEST_FILENAME} !-s 5 | RewriteRule ^(.+)\.view$ /rest/index.php?action=$1 [PT,L,QSA] 6 | RewriteRule ^fake/(.+)$ /play/$1 [PT,L,QSA] 7 | -------------------------------------------------------------------------------- /ampache/ampache-cfg/var/www/rest/index.php: -------------------------------------------------------------------------------- 1 | asXml(); 152 | -------------------------------------------------------------------------------- /ampache/ampache/docker-compose.yml: -------------------------------------------------------------------------------- 1 | ampache: 2 | labels: 3 | io.rancher.scheduler.affinity:host_label: web=true 4 | io.rancher.sidekicks: ampache-data,ampache-cfg 5 | image: ampache/ampache 6 | external_links: 7 | - db/mysql:mysql 8 | volumes_from: 9 | - ampache-data 10 | volume_driver: convoy-gluster 11 | volumes: 12 | - media-1:/media 13 | 14 | ampache-data: 15 | image: tianon/true 16 | labels: 17 | io.rancher.container.start_once: true 18 | net: none 19 | volumes: 20 | - /var/www/config 21 | - /var/www/play 22 | - /var/www/rest 23 | 24 | ampache-cfg: 25 | image: ibuildthecloud/ampache-cfg:v0 26 | net: container:ampache 27 | volumes_from: 28 | - ampache-data 29 | -------------------------------------------------------------------------------- /ampache/ampache/rancher-compose.yml: -------------------------------------------------------------------------------- 1 | ampache: 2 | metadata: 3 | db_user: ampache 4 | db_pass: ampache 5 | -------------------------------------------------------------------------------- /ampache/db/docker-compose.yml: -------------------------------------------------------------------------------- 1 | mysql: 2 | labels: 3 | io.rancher.scheduler.affinity:host_label: web=true 4 | image: mysql 5 | environment: 6 | MYSQL_DATABASE: ampache 7 | MYSQL_USER: ampache 8 | MYSQL_PASSWORD: ampache 9 | MYSQL_ALLOW_EMPTY_PASSWORD: yes 10 | -------------------------------------------------------------------------------- /ampache/lb/docker-compose.yml: -------------------------------------------------------------------------------- 1 | lb: 2 | ports: 3 | - 443:80 4 | - 80:80 5 | external_links: 6 | - ampache/ampache:ampache 7 | labels: 8 | io.rancher.loadbalancer.ssl.ports: '443' 9 | io.rancher.scheduler.affinity:host_label: web=true 10 | tty: true 11 | image: rancher/load-balancer-service 12 | stdin_open: true 13 | -------------------------------------------------------------------------------- /ampache/lb/rancher-compose.yml: -------------------------------------------------------------------------------- 1 | lb: 2 | default_cert: wildcard-space 3 | load_balancer_config: 4 | lb_cookie_stickiness_policy: 5 | cookie: session 6 | -------------------------------------------------------------------------------- /droneio/README.md: -------------------------------------------------------------------------------- 1 | ## Drone CI environment with Distributed workers. 2 | 3 | ### What is this? 4 | 5 | ------ 6 | 7 | This is the compose file that was used in the 10/13 Rancher Meetup to deploy a Drone CI environment. It deploys a Drone Server, MySQL database and workers that expose a hosts Docker daemon over Ranchers private network. 8 | 9 | This makes it easy to distribute builds across multipe build slaves using Drone. 10 | 11 | 12 | ### Usage 13 | 14 | * Pre-requisites. 15 | * Rancher environment with at least one node tagged 16 | * drone.role=leader 17 | * drone.role=follower 18 | * GitHub OAuth application for Drone. 19 | 20 | * Settings 21 | * Edit docker-compose.yml. Add DRONE_GITHUB_CLIENT and DRONE_GITHUB_SECRET values. 22 | 23 | * Bring up with rancher-compose CLI. 24 | * `rancher-compose -p drone up` 25 | 26 | -------------------------------------------------------------------------------- /droneio/docker-compose.yml: -------------------------------------------------------------------------------- 1 | drone-followers: 2 | tty: true 3 | image: rancher/socat-docker:v0.2.0 4 | volumes: 5 | - /var/run/docker.sock:/var/run/docker.sock 6 | - /var/lib/docker:/var/lib/docker 7 | stdin_open: true 8 | labels: 9 | role: follower 10 | io.rancher.scheduler.global: 'true' 11 | io.rancher.scheduler.affinity:host_label: drone.role=follower 12 | io.rancher.scheduler.affinity:container_label_ne: role=follower 13 | drone-leader: 14 | ports: 15 | - 80:80/tcp 16 | restart: 'no' 17 | environment: 18 | WORKER_DNS: followers 19 | WORKERS: 2 20 | DRONE_GITHUB_CLIENT: '' 21 | DRONE_GITHUB_SECRET: '' 22 | DRONE_DATABASE_DRIVER: 'mysql' 23 | DRONE_DATABASE_DATASOURCE: 'drone:drone@tcp(mysql:3306)/drone?timeout=120s' 24 | DRONE_GITHUB_OPEN: 'false' 25 | tty: true 26 | image: rancher/drone-sd:v0.3.0 27 | links: 28 | - drone-followers:followers 29 | - mysql-drone:mysql 30 | stdin_open: true 31 | labels: 32 | role: leader 33 | io.rancher.scheduler.affinity:host_label: drone.role=leader 34 | mysql-drone: 35 | image: mysql:5.6 36 | restart: always 37 | environment: 38 | MYSQL_ROOT_PASSWORD: supersecret 39 | MYSQL_DATABASE: drone 40 | MYSQL_USER: drone 41 | MYSQL_PASSWORD: drone 42 | volumes: 43 | - /data/mysql:/var/lib/mysql 44 | labels: 45 | io.rancher.scheduler.affinity:host_label: drone.role=leader 46 | volume-cleanup: 47 | image: cloudnautique/vol-cleanup:v0.1.0 48 | volumes: 49 | - /var/lib/docker:/var/lib/docker 50 | - /var/run/docker.sock:/var/run/docker.sock 51 | command: "-i 10" 52 | labels: 53 | role: volume-cleanup 54 | io.rancher.scheduler.global: 'true' 55 | io.rancher.scheduler.affinity:container_label_ne: role=volume-cleanup 56 | -------------------------------------------------------------------------------- /droneio/rancher-compose.yml: -------------------------------------------------------------------------------- 1 | volume-cleanup: 2 | scale: 1 3 | labels: 4 | io.rancher.scheduler.global: 'true' 5 | drone-army-01: 6 | scale: 1 7 | labels: 8 | io.rancher.scheduler.affinity:host_label: io.rancher.drone.role=follower 9 | drone-master: 10 | scale: 1 11 | labels: 12 | io.rancher.scheduler.affinity:host_label: io.rancher.drone.role=master 13 | -------------------------------------------------------------------------------- /lychee-docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Based on a work at https://github.com/docker/docker. 3 | # ------------------------------------------------------------------------------ 4 | # Pull base image. 5 | FROM kdelfour/supervisor-docker 6 | MAINTAINER Kevin Delfour 7 | 8 | # ------------------------------------------------------------------------------ 9 | # Install base 10 | RUN apt-get update 11 | RUN apt-get install -yq wget git unzip nginx fontconfig-config fonts-dejavu-core \ 12 | php5-fpm php5-common php5-json php5-cli php5-common php5-mysql\ 13 | php5-gd php5-json php5-mcrypt php5-readline psmisc ssl-cert \ 14 | ufw php-pear libgd-tools libmcrypt-dev mcrypt mysql-server mysql-client 15 | 16 | # ------------------------------------------------------------------------------ 17 | # Configure mysql 18 | RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf 19 | RUN service mysql start && \ 20 | mysql -uroot -e "CREATE DATABASE IF NOT EXISTS lychee;" && \ 21 | mysql -uroot -e "CREATE USER 'lychee'@'localhost' IDENTIFIED BY 'lychee';" && \ 22 | mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO 'lychee'@'localhost' WITH GRANT OPTION;" && \ 23 | mysql -uroot -e "FLUSH PRIVILEGES;" 24 | 25 | # ------------------------------------------------------------------------------ 26 | # Configure php-fpm 27 | RUN sed -i -e "s/output_buffering\s*=\s*4096/output_buffering = Off/g" /etc/php5/fpm/php.ini 28 | RUN sed -i -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php5/fpm/php.ini 29 | RUN sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 1G/g" /etc/php5/fpm/php.ini 30 | RUN sed -i -e "s/post_max_size\s*=\s*8M/post_max_size = 1G/g" /etc/php5/fpm/php.ini 31 | RUN sed -i -e "s:;\s*session.save_path\s*=\s*\"N;/path\":session.save_path = /tmp:g" /etc/php5/fpm/php.ini 32 | RUN chown -R www-data:www-data /tmp 33 | RUN php5enmod mcrypt 34 | 35 | # ------------------------------------------------------------------------------ 36 | # Configure nginx 37 | RUN mkdir /var/www 38 | RUN chown www-data:www-data /var/www 39 | RUN rm /etc/nginx/sites-enabled/* 40 | RUN rm /etc/nginx/sites-available/* 41 | RUN sed -i -e"s/keepalive_timeout\s*65/keepalive_timeout 2/" /etc/nginx/nginx.conf 42 | RUN sed -i -e"s/keepalive_timeout 2/keepalive_timeout 2;\n\tclient_max_body_size 100m/" /etc/nginx/nginx.conf 43 | RUN echo "daemon off;" >> /etc/nginx/nginx.conf 44 | ADD conf/php.conf /etc/nginx/ 45 | ADD conf/lychee /etc/nginx/sites-enabled/ 46 | 47 | # ------------------------------------------------------------------------------ 48 | # Install Lychee 49 | WORKDIR /var/www 50 | RUN git clone https://github.com/electerious/Lychee.git lychee 51 | RUN chown -R www-data:www-data /var/www/lychee 52 | RUN chmod -R 770 /var/www/lychee 53 | RUN chmod -R 777 /var/www/lychee/uploads/ 54 | RUN chmod -R 777 /var/www/lychee/data/ 55 | 56 | # ------------------------------------------------------------------------------ 57 | # Expose ports. 58 | EXPOSE 80 59 | 60 | # ------------------------------------------------------------------------------ 61 | # Expose volumes 62 | WORKDIR / 63 | RUN ln -s /var/www/lychee/uploads uploads 64 | RUN ln -s /var/www/lychee/data data 65 | 66 | VOLUME /uploads 67 | VOLUME /data 68 | 69 | # ------------------------------------------------------------------------------ 70 | # Add supervisord conf 71 | ADD conf/startup.conf /etc/supervisor/conf.d/ 72 | 73 | # Start supervisor, define default command. 74 | CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"] 75 | 76 | # Fixup data folder on start 77 | COPY startup.sh / 78 | ENTRYPOINT ["/startup.sh"] 79 | 80 | RUN echo 'session.save_handler = redis' >> /etc/php5/fpm/php.ini 81 | RUN echo 'session.save_path = "tcp://redis:6379"' >> /etc/php5/fpm/php.ini 82 | 83 | RUN apt-get install php5-redis 84 | -------------------------------------------------------------------------------- /lychee-docker/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Kevin Delfour 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /lychee-docker/README.md: -------------------------------------------------------------------------------- 1 | Lychee Dockerfile 2 | ============= 3 | 4 | This repository contains Dockerfile of Lychee for Docker's automated build published to the public Docker Hub Registry. 5 | 6 | # Base Docker Image 7 | [kdelfour/supervisor-docker](https://registry.hub.docker.com/u/kdelfour/supervisor-docker/) 8 | 9 | # Installation 10 | 11 | ## Install Docker. 12 | 13 | Download automated build from public Docker Hub Registry: docker pull kdelfour/lychee-docker 14 | 15 | (alternatively, you can build an image from Dockerfile: docker build -t="kdelfour/lychee-docker" github.com/kdelfour/lychee-docker) 16 | 17 | ## Usage 18 | 19 | docker run -it -d -p 80:80 kdelfour/lychee-docker 20 | 21 | You can add a shared directory as a volume directory with the argument *-v /your-path/uploads/:/uploads/ -v /your-path/data/:/data/* like this : 22 | 23 | docker run -it -d -p 80:80 -v /your-path/uploads/:/uploads/ -v /your-path/data/:/data/ kdelfour/lychee-docker 24 | 25 | A mysql server with a database is ready, you can use it with this parameters : 26 | 27 | - url : localhost 28 | - database name : lychee 29 | - user name : lychee 30 | - user password : lychee 31 | 32 | ## Build and run with custom config directory 33 | 34 | Get the latest version from github 35 | 36 | git clone https://github.com/kdelfour/lychee-docker 37 | cd lychee-docker/ 38 | 39 | Build it 40 | 41 | sudo docker build --force-rm=true --tag="$USER/lychee-docker:latest" . 42 | 43 | And run 44 | 45 | sudo docker run -d -p 80:80 -v /your-path/uploads/:/uploads/ -v /your-path/data/:/data/ $USER/lychee-docker:latest 46 | 47 | Enjoy !! -------------------------------------------------------------------------------- /lychee-docker/additional-files/cloud-config.yml: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | rancher: 3 | services: 4 | register: 5 | privileged: true 6 | volumes: 7 | - /var/run/docker.sock:/var/run/docker.sock 8 | image: rancher/agent:v0.8.2 9 | command: 10 | - https://rancher.itsgoingto.space/v1/scripts/B7D7E336A18AF8AACB87:1450375200000:9FkhtNtOzHT7ZikCutqE0Kb7Hk 11 | -------------------------------------------------------------------------------- /lychee-docker/additional-files/elb-config: -------------------------------------------------------------------------------- 1 | # From http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/enable-proxy-protocol.html 2 | 3 | aws elb create-load-balancer-policy --load-balancer-name demo-lb --policy-name my-ProxyProtocol-policy --policy-type-name ProxyProtocolPolicyType --policy-attributes AttributeName=ProxyProtocol,AttributeValue=true 4 | aws elb set-load-balancer-policies-for-backend-server --load-balancer-name demo-lb --instance-port 8080 --policy-names my-ProxyProtocol-policy 5 | -------------------------------------------------------------------------------- /lychee-docker/conf/lychee: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name localhost; 4 | 5 | root /var/www/lychee; 6 | index index.php; 7 | client_max_body_size 20G; 8 | access_log /var/log/nginx/lychee.access.log; 9 | error_log /var/log/nginx/lychee.error.log; 10 | 11 | location / { 12 | index index.php index.html index.htm; 13 | } 14 | 15 | location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { 16 | expires max; 17 | add_header Pragma public; 18 | add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 19 | } 20 | 21 | location ~ \.php$ { 22 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 23 | fastcgi_pass unix:/var/run/php5-fpm.sock; 24 | fastcgi_index index.php; 25 | include fastcgi_params; 26 | } 27 | 28 | include php.conf; 29 | } 30 | -------------------------------------------------------------------------------- /lychee-docker/conf/php.conf: -------------------------------------------------------------------------------- 1 | location ~ \.php { 2 | try_files $uri =404; 3 | fastcgi_param QUERY_STRING $query_string; 4 | fastcgi_param REQUEST_METHOD $request_method; 5 | fastcgi_param CONTENT_TYPE $content_type; 6 | fastcgi_param CONTENT_LENGTH $content_length; 7 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 8 | fastcgi_param SCRIPT_FILENAME $request_filename; 9 | fastcgi_param REQUEST_URI $request_uri; 10 | fastcgi_param DOCUMENT_URI $document_uri; 11 | fastcgi_param DOCUMENT_ROOT $document_root; 12 | fastcgi_param SERVER_PROTOCOL $server_protocol; 13 | fastcgi_param GATEWAY_INTERFACE CGI/1.1; 14 | fastcgi_param SERVER_SOFTWARE nginx; 15 | fastcgi_param REMOTE_ADDR $remote_addr; 16 | fastcgi_param REMOTE_PORT $remote_port; 17 | fastcgi_param SERVER_ADDR $server_addr; 18 | fastcgi_param SERVER_PORT $server_port; 19 | fastcgi_param SERVER_NAME $server_name; 20 | } -------------------------------------------------------------------------------- /lychee-docker/conf/startup.conf: -------------------------------------------------------------------------------- 1 | [program:nginx] 2 | command=/usr/sbin/nginx 3 | 4 | [program:php5-fpm] 5 | command=/usr/sbin/php5-fpm -c /etc/php5/fpm 6 | -------------------------------------------------------------------------------- /lychee-docker/docker-compose.yml: -------------------------------------------------------------------------------- 1 | mysql: 2 | environment: 3 | MYSQL_RANDOM_ROOT_PASSWORD: yes 4 | MYSQL_USER: lychee 5 | MYSQL_PASSWORD: lychee 6 | MYSQL_DATABASE: lychee 7 | image: mysql 8 | 9 | lychee: 10 | image: ibuildthecloud/lychee 11 | links: 12 | - mysql 13 | - redis 14 | volume_driver: convoy-nfs 15 | volumes: 16 | - myuploads-nfs2:/uploads 17 | - mydata-nfs2:/data 18 | 19 | redis: 20 | image: redis 21 | 22 | lb: 23 | labels: 24 | io.rancher.scheduler.global: 'true' 25 | io.rancher.loadbalancer.ssl.ports: '443' 26 | image: rancher/load-balancer-service 27 | links: 28 | - lychee 29 | ports: 30 | - 443:80 31 | - 80:80 32 | -------------------------------------------------------------------------------- /lychee-docker/env: -------------------------------------------------------------------------------- 1 | export RANCHER_URL=https://rancher.itsgoingto.space 2 | export RANCHER_ACCESS_KEY=0D3C1E558028DCD196CD 3 | export RANCHER_SECRET_KEY=g9G6eo9J3K4EkKVkvxPpMWtWjcNP55cmqjGWAM6g 4 | 5 | -------------------------------------------------------------------------------- /lychee-docker/nfs/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | RUN apt-get install -y nfs-kernel-server 3 | VOLUME ["/export"] 4 | -------------------------------------------------------------------------------- /lychee-docker/nfs/docker-compose.yml: -------------------------------------------------------------------------------- 1 | nfs: 2 | image: cpuguy83/nfs-server 3 | privileged: true 4 | volumes: 5 | - /exports 6 | command: 7 | - /exports 8 | -------------------------------------------------------------------------------- /lychee-docker/rancher-compose.yml: -------------------------------------------------------------------------------- 1 | mysql: 2 | hostname: rancherdb-2.cw8dvqlpov6v.us-west-2.rds.amazonaws.com 3 | 4 | lb: 5 | default_cert: space 6 | -------------------------------------------------------------------------------- /lychee-docker/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for i in big import medium thumb; do 4 | mkdir -p /uploads/$i 5 | done 6 | 7 | chown -R www-data:www-data /uploads 8 | chmod -R 777 /uploads 9 | 10 | chown -R www-data:www-data /data 11 | chmod -R 777 /data 12 | 13 | exec "$@" 14 | --------------------------------------------------------------------------------