├── .gitignore ├── .travis.yml ├── LICENSE ├── Makefile ├── README.md ├── UPGRADE.md ├── bin ├── acceptance_test ├── apply_defaults ├── attach_tmux ├── backup_db ├── build_nzedb ├── build_virtualenv ├── mysql ├── mysqltuner ├── nzedb_lib ├── nzedb_logs ├── nzedb_shell ├── reset_nzedb ├── restore_db ├── setup_data_dir ├── start_nzedb ├── stop_nzedb ├── tail_logs ├── update_binaries ├── update_releases └── web_setup ├── common.yml ├── dev.yml ├── docker-compose.yml ├── etc ├── config.php.example ├── defaults.sql ├── ircscraper_settings_example.php ├── mytop.example ├── nginx.conf.example ├── proxychains.conf.example ├── requirements.txt ├── settings.php.example └── simply_nzedb.conf.example ├── mariadb ├── Dockerfile └── moduser-entrypoint.sh └── nzedb ├── Dockerfile ├── php.proxy └── s6 ├── nginx └── run ├── php-fpm └── run └── tmux └── run /.gitignore: -------------------------------------------------------------------------------- 1 | venv* 2 | docker-compose 3 | data 4 | config.php 5 | etc/simply_nzedb.conf 6 | etc/private.sql 7 | simply_nzedb.conf 8 | web_setup.log 9 | /.idea 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | 3 | services: 4 | - docker 5 | 6 | script: 7 | - bin/acceptance_test 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: attach backup build help logs mysql restore shell start status stop test 2 | 3 | COMPOSE="venv/bin/docker-compose" 4 | 5 | help: 6 | @echo "Welcome to simply-nzedb!" 7 | @echo "" 8 | @echo "Core commands:" 9 | @echo "" 10 | @echo " attach - attach to nzedb's tmux session" 11 | @echo " backup - backup database. nzedb must be running" 12 | @echo " help - print this help" 13 | @echo " logs - print container logs" 14 | @echo " mysql - mysql client" 15 | @echo " mysqltuner - run mysql tuner" 16 | @echo " pull - pull the latest version" 17 | @echo " restore - restore last database backup. nzedb must be running" 18 | @echo " shell - shell into the nzedb container" 19 | @echo " start - start nzedb (restarts if it is already running)" 20 | @echo " status - shows running containers" 21 | @echo " stop - stops nzedb" 22 | @echo "" 23 | @echo "Developer commands:" 24 | @echo "" 25 | @echo " build - build docker images locally instead of downloading from docker hub" 26 | @echo " test - run acceptance tests" 27 | @echo "" 28 | 29 | attach: 30 | @bin/attach_tmux 31 | 32 | backup: 33 | @bin/backup_db 34 | 35 | build: 36 | @bin/build_nzedb 37 | 38 | logs: 39 | @$(COMPOSE) logs 40 | 41 | mysql: 42 | @bin/mysql 43 | 44 | mysqltuner: 45 | @bin/mysqltuner 46 | 47 | pull: 48 | @$(COMPOSE) pull 49 | 50 | restore: 51 | @bin/restore_db 52 | 53 | shell: 54 | @bin/nzedb_shell 55 | 56 | start: 57 | @bin/start_nzedb 58 | 59 | status: 60 | @$(COMPOSE) ps 61 | 62 | stop: 63 | @bin/stop_nzedb 64 | 65 | test: 66 | @bin/acceptance_test 67 | 68 | venv: 69 | @bin/build_virtualenv 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/slydetector/simply-nzedb.svg?branch=master)](https://travis-ci.org/slydetector/simply-nzedb) 2 | [![](https://img.shields.io/docker/pulls/slydetector/simply-nzedb.svg)](https://hub.docker.com/r/slydetector/simply-nzedb 'DockerHub') 3 | [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/simply-nzedb/Lobby) 4 | 5 | # Simply nZEDb 6 | 7 | Set up your own nZEDb usenet indexer in no time at all. 8 | This is a docker based installation based on the super-slim alpine linux distro. 9 | 10 | ## Requirements 11 | - Linux (64-bit x86 based distro - Debian, Ubuntu, whatever) or macOS 10+ 12 | - [docker 1.11+](https://docs.docker.com/engine/installation/) 13 | - git 14 | - [make](http://stackoverflow.com/questions/11934997/how-to-install-make-in-ubuntu) 15 | - python 2.7 16 | - [virtualenv](https://virtualenv.pypa.io/en/stable/installation/) 17 | 18 | ## Installation 19 | ### Step 1 - Command line setup 20 | 21 | **ProTip:** Setup docker to run [without having to use sudo](http://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo) unless you like typing in your password again and again. 22 | 23 | ```sh 24 | $ git clone https://github.com/slydetector/simply-nzedb.git nzedb 25 | $ cd nzedb 26 | 27 | # Create a python virtualenv for docker-compose 28 | $ make venv 29 | 30 | # Create a copy of the *single* config file 31 | $ cp etc/simply_nzedb.conf.example etc/simply_nzedb.conf 32 | 33 | # Update config file with usenet, irc, socks, etc settings 34 | $ vim etc/simply_nzedb.conf 35 | 36 | # Setup the ./data dir which contains nzedb config, nzbs, mysql data, log files, etc 37 | $ bin/setup_data_dir 38 | 39 | # Start up nzedb to do initial setup 40 | $ [sudo] make start 41 | ``` 42 | 43 | ### Step 2 - Automated web setup 44 | ```sh 45 | # This will run through the web setup for you using settings from simply_nzedb.conf. 46 | # Logs are in web_setup.log 47 | $ bin/web_setup 48 | ``` 49 | 50 | ### Step 3 - Sane defaults 51 | ```sh 52 | # Update settings db table with locations of various executables like ffmpeg, mediainfo, etc 53 | # and subscribe to alt.binaries.teevee for verification 54 | $ [sudo] bin/apply_defaults 55 | 56 | # Restart to pick up changes 57 | $ [sudo] make start 58 | ``` 59 | 60 | ### Step 4 - Verification 61 | ```sh 62 | # Attach to tmux and verify things are working by 63 | # next'ing through the windows. 64 | # 65 | # Cheat sheet for getting around in tmux: 66 | # 67 | # Key Action 68 | # -------------------------------------- 69 | # Ctrl-a n Next window 70 | # Ctrl-a c Create new window 71 | # Ctrl-a d Detach from tmux 72 | # 73 | $ [sudo] make attach 74 | ``` 75 | Go to ```http://:8800/browse?t=5000``` and you should see some TV releases soon. 76 | 77 | Congratulations, you've just accomplished the hardest part of running nZEDb, setting it up! 78 | 79 | ## Commands 80 | Run ``make`` to see what else you can do. 81 | 82 | ``` 83 | $ make 84 | Welcome to simply-nzedb! 85 | 86 | Core commands: 87 | 88 | attach - attach to nzedb's tmux session 89 | backup - backup database. nzedb must be running 90 | help - print this help 91 | logs - print container logs 92 | mysql - mysql client 93 | mysqltuner - run mysql tuner 94 | pull - pull the latest version 95 | restore - restore last database backup. nzedb must be running 96 | shell - shell into the nzedb container 97 | start - start nzedb (restarts if it is already running) 98 | status - shows running containers 99 | stop - stops nzedb 100 | 101 | Developer commands: 102 | 103 | build - build docker images locally instead of downloading from docker hub 104 | test - run acceptance tests 105 | ``` 106 | 107 | ## Upgrading to a newer version of nZEDb 108 | See [UPGRADE.md](https://github.com/slydetector/simply-nzedb/blob/master/UPGRADE.md) for version specific upgrade instructions. 109 | 110 | - Run ```make backup``` or you'll probably regret things if things go horribly wrong 111 | - Run ```git pull``` to update to the latest docker files 112 | - Run ```make pull``` to pull the latest docker images 113 | - Run ```make start``` to restart nZEDb. The database schema is updated if necessary when starting up. 114 | 115 | If after an upgrade, ```make attach``` fails, it is usually an indication that the database is getting updated or running migration steps. Use ```make logs | less -R``` to check on the progress and try again in a few minutes. 116 | 117 | ## Customizing MySQL 118 | You can customize mysql settings by creating ```data/etc_mysql_conf.d/nzedb.cnf```. e.g. 119 | ``` 120 | [mysqld] 121 | key_buffer_size = 2G 122 | innodb_buffer_pool_size = 8G 123 | group_concat_max_len = 32768 124 | ``` 125 | 126 | ## TODO 127 | - PreDB auto-population 128 | 129 | ## Acknowledgements 130 | - Based on work from [alp-nzedb](https://github.com/MichaelLindsey/alp-nzedb) 131 | - Hats off to the guys moving [nZEDb](https://nzedb.github.io/) forward. 132 | 133 | ## Help! 134 | Try the [Gitter chat room](https://gitter.im/simply-nzedb/Lobby) 135 | -------------------------------------------------------------------------------- /UPGRADE.md: -------------------------------------------------------------------------------- 1 | # nzedb 0.6.9.0 to 0.7.0.0 2 | 3 | This upgrade requires some manual steps to fix: 4 | ``` 5 | $ docker inspect slydetector/simply-nzedb | grep NZEDB_VERSION 6 | $ mkdir data/configuration 7 | $ mv data/config.php data/configuration/ 8 | $ mv data/ircscraper_settings.php data/configuration/ 9 | $ mv data/settings.php data/configuration/ 10 | $ touch data/configuration/install.lock 11 | $ touch data/log/php_errors_web.log 12 | $ chmod -R 777 data/configuration 13 | ``` 14 | 15 | # nzedb 0.8.1.0 to 0.8.2.1 16 | 17 | Add new maintenance settings to the bottom of data/configuration/settings.php 18 | ``` 19 | //////////////////////////////////////////////////////////////////////////////////////////////////// 20 | /////////////////////////////////// Maintenance Mode Settings ////////////////////////////////////// 21 | //////////////////////////////////////////////////////////////////////////////////////////////////// 22 | /** 23 | * Should the site be in maintenance mode. 24 | * If enabled, it will output the selected HTML file added below to front-end pages as well as 25 | * outputting a properly formatted API error response with the error text "Maintenance Mode" and 26 | * status code 503. 27 | * This will prevent nZEDb from making any MySQL/Sphinx/Cache calls so it's good to use this if you 28 | * need to stop/restart those services. 29 | * 30 | * @note If your site uses some form of webserver-level caching, the cache may need to be cleared 31 | * when coming out of maintenance mode. Otherwise you'll have to wait until it expires to see 32 | * your proper site again. 33 | * @default false 34 | */ 35 | define('MAINTENANCE_MODE_ENABLED', false); 36 | 37 | /** 38 | * The fully qualified absolute path to the maintenance mode HTML file. 39 | * This should be a fully complete HTML file and NOT a smarty template. The idea of a maintenance 40 | * file is it should be static HTML with no dependencies on other systems. 41 | * That way it can safely be displayed without the database running or any other services (except 42 | * PHP and the webserver of course). 43 | * 44 | * @note On my site I ripped the rendered HTML content of my home page and swapped out the center 45 | * container for a maintenance message. This is a good process. Be sure to remove all 46 | * references to user data. Links to other site pages can remain intact. 47 | * @default '' 48 | */ 49 | define('MAINTENANCE_MODE_HTML_PATH', ''); 50 | 51 | /** 52 | * What IP addresses should be excluded from maintenance mode. 53 | * 54 | * Useful if you want to allow admins to access the site while everyone else sees the maintenance 55 | * message. 56 | * 57 | * @note Keep in mind, if your site uses ipv6 you may need to enter your ipv6 address here as well. 58 | * @default [] 59 | */ 60 | define('MAINTENANCE_MODE_IP_EXCEPTIONS', []); 61 | ``` 62 | -------------------------------------------------------------------------------- /bin/acceptance_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xv 2 | set -e 3 | 4 | pre_test_setup() { 5 | rm -rf venv data 6 | } 7 | 8 | create_simply_nzedb_conf() { 9 | cat << EOF > etc/simply_nzedb.conf 10 | NNTP_USERNAME="" 11 | NNTP_PASSWORD="" 12 | NNTP_SERVER=freenews.netfront.net 13 | NNTP_PORT=119 14 | NNTP_SSLENABLED=false 15 | 16 | DB_SYSTEM=mysql 17 | DB_HOST=database 18 | DB_PORT=3306 19 | DB_SOCKET="" 20 | DB_USER=nzedb 21 | DB_PASSWORD=nzedb 22 | DB_NAME=nzedb 23 | 24 | IRC_USERNAME=simply_nzedb_test 25 | IRC_SERVER=irc.idontexist.com 26 | IRC_PORT=6667 27 | IRC_TLS=false 28 | IRC_PASSWORD="" 29 | 30 | NZEDB_ADMIN_USERNAME=nzedb 31 | NZEDB_ADMIN_PASSWORD=nzedb 32 | NZEDB_ADMIN_EMAIL=nzedb@localhost.com 33 | EOF 34 | } 35 | 36 | step1_cli_setup() { 37 | bin/build_virtualenv 38 | bin/build_nzedb 39 | create_simply_nzedb_conf 40 | bin/setup_data_dir 41 | bin/start_nzedb 42 | } 43 | 44 | step1_test() { 45 | # nzedb is up 46 | venv/bin/http --session test --check-status :8800/install/ 47 | 48 | # adminer is up - needs to be poked twice to pass 49 | # TODO: Figure out why it always fails on the first poke 50 | # venv/bin/http :8880/ 51 | # venv/bin/http --check-status :8880/ 52 | } 53 | 54 | step2_web_setup() { 55 | source etc/simply_nzedb.conf 56 | source bin/nzedb_lib 57 | web_setup 58 | } 59 | 60 | step3_sane_defaults() { 61 | bin/apply_defaults 62 | } 63 | 64 | step4_verification() { 65 | # TODO: -T needed until https://github.com/docker/compose/issues/3379 is fixed 66 | venv/bin/docker-compose exec -T nzedb php update_binaries.php 67 | #venv/bin/docker-compose exec -T nzedb php update_releases.php 1 true 68 | venv/bin/docker-compose exec -T nzedb php nix/multiprocessing/releases.php 69 | } 70 | 71 | post_test_cleanup() { 72 | bin/stop_nzedb 73 | } 74 | 75 | # Main 76 | pre_test_setup 77 | 78 | step1_cli_setup 79 | step1_test 80 | 81 | step2_web_setup 82 | 83 | step3_sane_defaults 84 | 85 | step4_verification 86 | 87 | post_test_cleanup 88 | 89 | -------------------------------------------------------------------------------- /bin/apply_defaults: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Applying sane defaults to settings database table" 3 | 4 | # docker-compose removes dashes from the container name prefix for some reason 5 | prefix=$(basename $PWD | sed "s/-//g") 6 | 7 | # piping stdin to docker-compose is broken - https://github.com/docker/compose/issues/3352 8 | # so use this hack to get the container name prefix based on the current working dir. 9 | cat etc/defaults.sql | \ 10 | docker exec -i ${prefix}_database_1 mysql --user=nzedb --password=nzedb nzedb 11 | 12 | if [ -f "etc/private.sql" ]; then 13 | cat etc/private.sql | \ 14 | docker exec -i ${prefix}_database_1 mysql --user=nzedb --password=nzedb nzedb 15 | fi 16 | -------------------------------------------------------------------------------- /bin/attach_tmux: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Fucking docker! https://github.com/moby/moby/issues/30421 3 | venv/bin/docker-compose exec nzedb script -c "tmux -u attach -t nZEDb" /dev/null 4 | -------------------------------------------------------------------------------- /bin/backup_db: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Dumping database to ./data/db_backups" 3 | ./venv/bin/docker-compose exec nzedb /bin/bash -c "cd /var/www/nZEDb/misc/testing/DB; php mysqldump_tables.php db dump /db_backups" 4 | ls -l data/db_backups 5 | -------------------------------------------------------------------------------- /bin/build_nzedb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This file has to exist even if it hasn't been setup by the user yet 3 | # since it is referenced in docker-compose.yml. 4 | touch etc/simply_nzedb.conf 5 | # Use dev.yml instead of docker-compose.yml so the images are built 6 | # locally instead of pulled from hub.docker.com 7 | venv/bin/docker-compose --file dev.yml build --pull --force-rm "$@" 8 | -------------------------------------------------------------------------------- /bin/build_virtualenv: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | virtualenv -p python2.7 venv 3 | ./venv/bin/pip install -r etc/requirements.txt 4 | -------------------------------------------------------------------------------- /bin/mysql: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source etc/simply_nzedb.conf 3 | venv/bin/docker-compose exec database mysql \ 4 | --user=${DB_USER} \ 5 | --password=${DB_PASSWORD} \ 6 | "$@" ${DB_NAME} 7 | -------------------------------------------------------------------------------- /bin/mysqltuner: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source etc/simply_nzedb.conf 3 | venv/bin/docker-compose exec database /mysqltuner/mysqltuner.pl \ 4 | --user ${DB_USER} \ 5 | --pass ${DB_PASSWORD} \ 6 | "$@" 7 | -------------------------------------------------------------------------------- /bin/nzedb_lib: -------------------------------------------------------------------------------- 1 | DELAY=1 2 | FLAGS="--session test --check-status --follow --verbose --debug" 3 | TEE="tee -a web_setup.log" 4 | HTTP="venv/bin/http $FLAGS" 5 | 6 | web_setup() { 7 | echo "Step 0" 8 | $HTTP :8800/install/ 2>&1 | $TEE | grep "Pre flight check" 9 | 10 | echo "Step 1" 11 | $HTTP :8800/install/step1.php 2>&1 | $TEE | grep "No problems were found and you are ready to install" 12 | sleep $DELAY 13 | 14 | echo "Step 2" 15 | $HTTP :8800/install/step2.php 2>&1 | $TEE | grep "Database Setup" 16 | sleep $DELAY 17 | 18 | echo "Connecting to db.." 19 | for i in {1..9}; do 20 | $HTTP \ 21 | --form \ 22 | --all :8800/install/step2.php \ 23 | db_system=${DB_SYSTEM} \ 24 | host=${DB_HOST} \ 25 | sql_port=${DB_PORT} \ 26 | sql_socket=${DB_SOCKET} \ 27 | user=${DB_USER} \ 28 | pass=${DB_PASSWORD} \ 29 | db=${DB_NAME} 2>&1 | $TEE | \ 30 | grep "The database setup is correct" && break || sleep 10; 31 | 32 | if [[ $i == 9 ]]; then 33 | echo "Database setup failed. Check web_setup.log" 34 | exit 1 35 | else 36 | echo "Retrying.." 37 | fi 38 | done 39 | 40 | 41 | echo "Step 3" 42 | $HTTP :8800/install/step3.php 2>&1 | $TEE | grep "OpenSSL Setup" 43 | 44 | $HTTP \ 45 | --form \ 46 | --all :8800/install/step3.php \ 47 | cafile="" \ 48 | capath="" 2>&1 | $TEE | \ 49 | grep "The openssl setup looks correct" 50 | sleep $DELAY 51 | 52 | echo "Step 4" 53 | $HTTP :8800/install/step4.php 2>&1 | $TEE | grep "News Server Setup" 54 | 55 | NNTP_SSL=0 56 | if [ ${NNTP_SSLENABLED} = "true" ]; then 57 | NNTP_SSL=1 58 | fi 59 | 60 | $HTTP \ 61 | --form \ 62 | --all :8800/install/step4.php \ 63 | server=${NNTP_SERVER} \ 64 | user=${NNTP_USERNAME} \ 65 | pass=${NNTP_PASSWORD} \ 66 | port=${NNTP_PORT} \ 67 | ssl=${NNTP_SSL} \ 68 | socket_timeout=120 \ 69 | servera="" \ 70 | usera="" \ 71 | passa="" \ 72 | porta=119 \ 73 | socket_timeouta=120 2>&1 | $TEE | \ 74 | grep "The news server setup is correct" 75 | sleep $DELAY 76 | 77 | echo "Step 5" 78 | $HTTP :8800/install/step5.php 2>&1 | $TEE | grep "Save Settings" 79 | sleep $DELAY 80 | 81 | echo "Step 6" 82 | $HTTP :8800/install/step6.php 2>&1 | $TEE | grep "Setup Admin User" 83 | 84 | $HTTP \ 85 | --form \ 86 | --all :8800/install/step6.php \ 87 | user=${NZEDB_ADMIN_USERNAME} \ 88 | fname="" \ 89 | lname="" \ 90 | pass=${NZEDB_ADMIN_PASSWORD} \ 91 | email=${NZEDB_ADMIN_EMAIL} 2>&1 | $TEE | \ 92 | grep "The admin user has been setup" 93 | sleep $DELAY 94 | 95 | echo "Step 7" 96 | $HTTP :8800/install/step7.php 2>&1 | $TEE | grep "File Paths" 97 | 98 | $HTTP \ 99 | --form \ 100 | --all :8800/install/step7.php \ 101 | coverspath="/var/www/nZEDb/resources/covers/" \ 102 | nzbpath="/var/www/nZEDb/resources/nzb/" \ 103 | tmpunrarpath="/var/www/nZEDb/resources/tmp/unrar/" 2>&1 | $TEE | \ 104 | grep "Install Complete" 105 | } 106 | -------------------------------------------------------------------------------- /bin/nzedb_logs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | venv/bin/docker-compose logs 3 | -------------------------------------------------------------------------------- /bin/nzedb_shell: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./venv/bin/docker-compose exec nzedb /bin/bash 3 | -------------------------------------------------------------------------------- /bin/reset_nzedb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | bin/stop_nzedb 3 | sudo rm -rf data 4 | -------------------------------------------------------------------------------- /bin/restore_db: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Restoring data/db_backups/nzedb.tgz" 3 | ./venv/bin/docker-compose exec nzedb /bin/bash -c "cd /var/www/nZEDb/misc/testing/DB; php mysqldump_tables.php db restore /db_backups" 4 | -------------------------------------------------------------------------------- /bin/setup_data_dir: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Creating data directory..." 3 | mkdir -p data/configuration 4 | 5 | # Read in all custom settings as env vars 6 | source etc/simply_nzedb.conf 7 | 8 | cp etc/settings.php.example data/configuration/settings.php 9 | 10 | cp etc/config.php.example data/configuration/config.php 11 | target="data/configuration/config.php" 12 | 13 | # Ripped from http://stackoverflow.com/questions/3466166/how-to-check-if-running-in-cygwin-mac-or-linux 14 | if [ "$(uname)" == "Darwin" ]; then 15 | sed="sed -i '' -E" 16 | id_user="id -u" 17 | id_group="id -g" 18 | elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then 19 | sed="sed -i -r" 20 | id_user="id --user" 21 | id_group="id --group" 22 | elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then 23 | echo "Windows not supported. Submit a pull request :)" 24 | exit 1 25 | fi 26 | 27 | $sed "s/changeme_nntp_username/${NNTP_USERNAME}/g" $target 28 | $sed "s/changeme_nntp_password/${NNTP_PASSWORD}/g" $target 29 | $sed "s/changeme_nntp_server/${NNTP_SERVER}/g" $target 30 | $sed "s/changeme_nntp_port/${NNTP_PORT}/g" $target 31 | $sed "s/changeme_nntp_sslenabled/${NNTP_SSLENABLED}/g" $target 32 | 33 | $sed "s/changeme_db_system/${DB_SYSTEM}/g" $target 34 | $sed "s/changeme_db_host/${DB_HOST}/g" $target 35 | $sed "s/changeme_db_port/${DB_PORT}/g" $target 36 | $sed "s/changeme_db_socket/${DB_SOCKET}/g" $target 37 | $sed "s/changeme_db_user/${DB_USER}/g" $target 38 | $sed "s/changeme_db_password/${DB_PASSWORD}/g" $target 39 | $sed "s/changeme_db_name/${DB_NAME}/g" $target 40 | 41 | cp etc/nginx.conf.example data/nginx.conf 42 | $sed "s/changeme_server_name/$(hostname)/g" data/nginx.conf 43 | 44 | # Will end up mounted to /root/.mytop 45 | cp etc/mytop.example data/mytop 46 | target="data/mytop" 47 | $sed "s/changeme_db_system/${DB_SYSTEM}/g" $target 48 | $sed "s/changeme_db_host/${DB_HOST}/g" $target 49 | $sed "s/changeme_db_port/${DB_PORT}/g" $target 50 | $sed "s/changeme_db_user/${DB_USER}/g" $target 51 | $sed "s/changeme_db_password/${DB_PASSWORD}/g" $target 52 | $sed "s/changeme_db_name/${DB_NAME}/g" $target 53 | 54 | mkdir -p data/covers/anime 55 | mkdir -p data/covers/audio 56 | mkdir -p data/covers/audiosample 57 | mkdir -p data/covers/book 58 | mkdir -p data/covers/console 59 | mkdir -p data/covers/movies 60 | mkdir -p data/covers/music 61 | mkdir -p data/covers/preview 62 | mkdir -p data/covers/sample 63 | mkdir -p data/covers/tvshows 64 | mkdir -p data/covers/video 65 | mkdir -p data/nzb 66 | mkdir -p data/tmp/unrar 67 | mkdir -p data/etc_mysql_conf.d 68 | mkdir -p data/var_lib_mysql 69 | mkdir -p data/log 70 | mkdir -p data/import/inbox 71 | mkdir -p data/db_backups 72 | 73 | # Create as files otherwise docker will mount as directories 74 | touch data/log/nginx-access.log 75 | touch data/log/nginx-error.log 76 | touch data/log/php_errors.log 77 | touch data/log/php_errors_web.log 78 | touch data/log/php-fpm.log 79 | 80 | # File that lets mysql container know user id/gid on host 81 | cat << EOF > data/mysql_user 82 | PUID=$($id_user) 83 | PGID=$($id_group) 84 | EOF 85 | 86 | # Save predb import progress across container start/stop. 87 | # Written by predb_import_daily_batch.php 88 | touch data/predb_progress.txt 89 | 90 | # irc scraper 91 | target="data/configuration/ircscraper_settings.php" 92 | cp etc/ircscraper_settings_example.php $target 93 | $sed "s/changeme_irc_username/${IRC_USERNAME}/g" $target 94 | $sed "s/changeme_irc_server/${IRC_SERVER}/g" $target 95 | $sed "s/changeme_irc_port/${IRC_PORT}/g" $target 96 | $sed "s/changeme_irc_tls/false/g" $target 97 | $sed "s/changeme_irc_password/${IRC_PASSWORD}/g" $target 98 | 99 | # proxychains for socks proxy 100 | cp etc/proxychains.conf.example data/proxychains.conf 101 | $sed "s/changeme_socks_type/${SOCKS_TYPE}/g" data/proxychains.conf 102 | $sed "s/changeme_socks_host/${SOCKS_HOST}/g" data/proxychains.conf 103 | $sed "s/changeme_socks_port/${SOCKS_PORT}/g" data/proxychains.conf 104 | 105 | chmod -R 777 data 106 | echo Done 107 | -------------------------------------------------------------------------------- /bin/start_nzedb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | bin/stop_nzedb 3 | venv/bin/docker-compose up -d 4 | -------------------------------------------------------------------------------- /bin/stop_nzedb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./venv/bin/docker-compose stop --timeout 60 3 | ./venv/bin/docker-compose rm --force 4 | -------------------------------------------------------------------------------- /bin/tail_logs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | while true; do ./venv/bin/docker-compose logs -f && sleep 1; done 4 | -------------------------------------------------------------------------------- /bin/update_binaries: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./venv/bin/docker-compose exec nzedb /bin/bash -c "while true; do php update_binaries.php; sleep 10; done" 3 | -------------------------------------------------------------------------------- /bin/update_releases: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./venv/bin/docker-compose exec nzedb /bin/bash -c "while true; do php update_releases.php 1 true; sleep 10; done" 3 | -------------------------------------------------------------------------------- /bin/web_setup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | rm web_setup.log 3 | set -e 4 | set +o pipefail 5 | source etc/simply_nzedb.conf 6 | source bin/nzedb_lib 7 | web_setup 8 | -------------------------------------------------------------------------------- /common.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | 4 | database: 5 | image: slydetector/simply-nzedb-mariadb 6 | restart: unless-stopped 7 | volumes: 8 | - $PWD/data/var_lib_mysql:/var/lib/mysql 9 | - $PWD/data/etc_mysql_conf.d:/etc/mysql/conf.d 10 | - $PWD/data/mysql_user:/mysql_user 11 | environment: 12 | - MYSQL_ROOT_PASSWORD=nzedb 13 | - MYSQL_DATABASE=nzedb 14 | - MYSQL_USER=nzedb 15 | - MYSQL_PASSWORD=nzedb 16 | expose: 17 | - "3306" 18 | 19 | nzedb: 20 | image: slydetector/simply-nzedb 21 | restart: unless-stopped 22 | ports: 23 | - 8800:8800 24 | env_file: 25 | - $PWD/etc/simply_nzedb.conf 26 | volumes: 27 | - $PWD/data/covers:/var/www/nZEDb/resources/covers/ 28 | - $PWD/data/nzb:/var/www/nZEDb/resources/nzb/ 29 | - $PWD/data/tmp:/var/www/nZEDb/resources/tmp/unrar/ 30 | # configuration/ is expected to contain 31 | # - config.php 32 | # - ircscraper_settings.php 33 | # - settings.php 34 | # - install.lock (only after setup has completed) 35 | - $PWD/data/configuration:/var/www/nZEDb/configuration/ 36 | - $PWD/data/log/nginx-error.log:/var/log/nginx/nginx-error.log 37 | - $PWD/data/log/nginx-access.log:/var/log/nginx/access.log 38 | - $PWD/data/log/php-fpm.log:/var/log/php-fpm.log 39 | - $PWD/data/log/php_errors.log:/var/www/nZEDb/resources/logs/php_errors.log 40 | - $PWD/data/log/php_errors_web.log:/var/www/nZEDb/resources/logs/php_errors_web.log 41 | - $PWD/data/nginx.conf:/etc/nginx/nginx.conf 42 | - $PWD/data/mytop:/root/.mytop 43 | - $PWD/data/predb_progress.txt:/var/www/nZEDb/cli/data/predb_progress.txt 44 | - $PWD/data/import:/var/www/nZEDb/resources/import/ 45 | - $PWD/data/proxychains.conf:/etc/proxychains/proxychains.conf 46 | - $PWD/data/db_backups:/db_backups 47 | 48 | adminer: 49 | image: clue/adminer 50 | restart: unless-stopped 51 | ports: 52 | - 8880:80 53 | 54 | redis: 55 | image: redis:3.2.6-alpine 56 | restart: unless-stopped 57 | -------------------------------------------------------------------------------- /dev.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | 4 | database: 5 | extends: 6 | file: common.yml 7 | service: database 8 | build: mariadb 9 | 10 | nzedb: 11 | extends: 12 | file: common.yml 13 | service: nzedb 14 | build: nzedb 15 | links: 16 | - database 17 | - redis 18 | depends_on: 19 | - database 20 | - redis 21 | 22 | adminer: 23 | extends: 24 | file: common.yml 25 | service: adminer 26 | links: 27 | - database:db 28 | depends_on: 29 | - database 30 | 31 | redis: 32 | extends: 33 | file: common.yml 34 | service: redis 35 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | 4 | database: 5 | extends: 6 | file: common.yml 7 | service: database 8 | 9 | nzedb: 10 | extends: 11 | file: common.yml 12 | service: nzedb 13 | links: 14 | - database 15 | - redis 16 | depends_on: 17 | - database 18 | - redis 19 | 20 | adminer: 21 | extends: 22 | file: common.yml 23 | service: adminer 24 | links: 25 | - database:db 26 | depends_on: 27 | - database 28 | 29 | redis: 30 | extends: 31 | file: common.yml 32 | service: redis 33 | 34 | -------------------------------------------------------------------------------- /etc/config.php.example: -------------------------------------------------------------------------------- 1 | ' 48 | **********************************************************************************************************************/ 49 | define('SCRAPE_IRC_PASSWORD', 'changeme_irc_password'); 50 | 51 | /*********************************************************************************************************************** 52 | * This is an optional field you can use for ignoring categories. 53 | * @note If you do not wish to exclude any categories, leave it a empty string: '' 54 | * @examples Case sensitive: '/^(XXX|PDA|EBOOK|MP3)$/' 55 | * Case insensitive: '/^(X264|TV)$/i' 56 | **********************************************************************************************************************/ 57 | define('SCRAPE_IRC_CATEGORY_IGNORE', ''); 58 | 59 | /*********************************************************************************************************************** 60 | * This is an optional field you can use for ignoring PRE titles. 61 | * @note If you do not wish to exclude any PRE titles, leave it a empty string: '' 62 | * @examples Case insensitive ignore German or XXX in the title: '/\.(German|XXX)\./i' 63 | * This would ignore titles like: 64 | * Yanks.14.06.30.Bianca.Travelman.Is.A.Nudist.XXX.MP4-FUNKY 65 | * Blancanieves.Ein.Maerchen.von.Schwarz.und.Weiss.2012.German.1080p.BluRay.x264-CONTRiBUTiON 66 | **********************************************************************************************************************/ 67 | define('SCRAPE_IRC_TITLE_IGNORE', ''); 68 | 69 | /*********************************************************************************************************************** 70 | * This is a list of all the channels we fetch PRE's from. 71 | **********************************************************************************************************************/ 72 | define('SCRAPE_IRC_CHANNELS', 73 | serialize( 74 | array( 75 | //'#Channel' => 'Password', 76 | '#nZEDbPRE' => null, 77 | '#nZEDbPRE2' => null, 78 | '#PreNNTmux' => null 79 | ) 80 | ) 81 | ); 82 | 83 | /*********************************************************************************************************************** 84 | * This is a list of all the sources we fetch PRE's from. 85 | * If you want to ignore a source, change it from false to true. 86 | **********************************************************************************************************************/ 87 | define('SCRAPE_IRC_SOURCE_IGNORE', 88 | serialize( 89 | array( 90 | '#a.b.cd.image' => false, 91 | '#a.b.console.ps3' => false, 92 | '#a.b.dvd' => false, 93 | '#a.b.erotica' => false, 94 | '#a.b.flac' => false, 95 | '#a.b.foreign' => false, 96 | '#a.b.games.nintendods' => false, 97 | '#a.b.inner-sanctum' => false, 98 | '#a.b.moovee' => false, 99 | '#a.b.movies.divx' => false, 100 | '#a.b.sony.psp' => false, 101 | '#a.b.sounds.mp3.complete_cd' => false, 102 | '#a.b.teevee' => false, 103 | '#a.b.games.wii' => false, 104 | '#a.b.warez' => false, 105 | '#a.b.games.xbox360' => false, 106 | '#pre@corrupt' => false, 107 | '#scnzb' => false, 108 | '#tvnzb' => false, 109 | 'srrdb' => false 110 | ) 111 | ) 112 | ); 113 | -------------------------------------------------------------------------------- /etc/mytop.example: -------------------------------------------------------------------------------- 1 | user=changeme_db_user 2 | pass=changeme_db_password 3 | host=changeme_db_host 4 | db=changeme_db_name 5 | delay=1 6 | port=changeme_db_port 7 | -------------------------------------------------------------------------------- /etc/nginx.conf.example: -------------------------------------------------------------------------------- 1 | # run nginx in foreground 2 | daemon off; 3 | 4 | error_log /var/log/nginx/nginx-error.log warn; 5 | pid /var/run/nginx.pid; 6 | worker_processes 5; 7 | events { 8 | worker_connections 4096; 9 | } 10 | 11 | http { 12 | sendfile on; 13 | include /etc/nginx/mime.types; 14 | include /etc/nginx/fastcgi.conf; 15 | default_type application/octet-stream; 16 | tcp_nopush on; 17 | client_body_temp_path /tmp/nginx/body 1 2; 18 | fastcgi_temp_path /tmp/nginx/fastcgi_temp 1 2; 19 | 20 | client_max_body_size 2G; 21 | 22 | server { 23 | server_name changeme_server_name localhost; 24 | #listen [::]:80; #uncomment for IPv6 support 25 | listen 8800; 26 | 27 | root /var/www/nZEDb/www/; 28 | index index.php index.html index.htm; 29 | 30 | disable_symlinks off; 31 | 32 | location ~* \.(?:css|eot|gif|gz|ico|inc|jpe?g|js|ogg|oga|ogv|mp4|m4a|mp3|png|svg|ttf|txt|woff|xml)$ { 33 | expires max; 34 | add_header Pragma public; 35 | add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 36 | } 37 | 38 | location / { 39 | try_files $uri $uri/ @rewrites; 40 | } 41 | 42 | location ^~ /covers/ { 43 | # This is where the nZEDb covers folder should be in. 44 | root /var/www/nZEDb/resources; 45 | } 46 | 47 | location @rewrites { 48 | rewrite ^/([^/\.]+)/([^/]+)/([^/]+)/? /index.php?page=$1&id=$2&subpage=$3 last; 49 | rewrite ^/([^/\.]+)/([^/]+)/?$ /index.php?page=$1&id=$2 last; 50 | rewrite ^/([^/\.]+)/?$ /index.php?page=$1 last; 51 | } 52 | 53 | location /admin { 54 | } 55 | 56 | location /install { 57 | } 58 | 59 | # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 60 | location ~ [^/]\.php(/|$) { 61 | fastcgi_split_path_info ^(.+?\.php)(/.*)$; 62 | if (!-f $document_root$fastcgi_script_name) { 63 | return 404; 64 | } 65 | fastcgi_pass 127.0.0.1:9000; 66 | fastcgi_index index.php; 67 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 68 | include fastcgi_params; 69 | } 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /etc/proxychains.conf.example: -------------------------------------------------------------------------------- 1 | # proxychains.conf VER 4.x 2 | # 3 | # HTTP, SOCKS4a, SOCKS5 tunneling proxifier with DNS. 4 | 5 | 6 | # The option below identifies how the ProxyList is treated. 7 | # only one option should be uncommented at time, 8 | # otherwise the last appearing option will be accepted 9 | # 10 | #dynamic_chain 11 | # 12 | # Dynamic - Each connection will be done via chained proxies 13 | # all proxies chained in the order as they appear in the list 14 | # at least one proxy must be online to play in chain 15 | # (dead proxies are skipped) 16 | # otherwise EINTR is returned to the app 17 | # 18 | strict_chain 19 | # 20 | # Strict - Each connection will be done via chained proxies 21 | # all proxies chained in the order as they appear in the list 22 | # all proxies must be online to play in chain 23 | # otherwise EINTR is returned to the app 24 | # 25 | #round_robin_chain 26 | # 27 | # Round Robin - Each connection will be done via chained proxies 28 | # of chain_len length 29 | # all proxies chained in the order as they appear in the list 30 | # at least one proxy must be online to play in chain 31 | # (dead proxies are skipped). 32 | # the start of the current proxy chain is the proxy after the last 33 | # proxy in the previously invoked proxy chain. 34 | # if the end of the proxy chain is reached while looking for proxies 35 | # start at the beginning again. 36 | # otherwise EINTR is returned to the app 37 | # These semantics are not guaranteed in a multithreaded environment. 38 | # 39 | #random_chain 40 | # 41 | # Random - Each connection will be done via random proxy 42 | # (or proxy chain, see chain_len) from the list. 43 | # this option is good to test your IDS :) 44 | 45 | # Make sense only if random_chain or round_robin_chain 46 | #chain_len = 2 47 | 48 | # Quiet mode (no output from library) 49 | #quiet_mode 50 | 51 | # Proxy DNS requests - no leak for DNS data 52 | proxy_dns 53 | 54 | # set the class A subnet number to use for the internal remote DNS mapping 55 | # we use the reserved 224.x.x.x range by default, 56 | # if the proxified app does a DNS request, we will return an IP from that range. 57 | # on further accesses to this ip we will send the saved DNS name to the proxy. 58 | # in case some control-freak app checks the returned ip, and denies to 59 | # connect, you can use another subnet, e.g. 10.x.x.x or 127.x.x.x. 60 | # of course you should make sure that the proxified app does not need 61 | # *real* access to this subnet. 62 | # i.e. dont use the same subnet then in the localnet section 63 | #remote_dns_subnet 127 64 | #remote_dns_subnet 10 65 | remote_dns_subnet 224 66 | 67 | # Some timeouts in milliseconds 68 | tcp_read_time_out 15000 69 | tcp_connect_time_out 8000 70 | 71 | ### Examples for localnet exclusion 72 | ## localnet ranges will *not* use a proxy to connect. 73 | ## Exclude connections to 192.168.1.0/24 with port 80 74 | # localnet 192.168.1.0:80/255.255.255.0 75 | 76 | ## Exclude connections to 192.168.100.0/24 77 | # localnet 192.168.100.0/255.255.255.0 78 | 79 | ## Exclude connections to ANYwhere with port 80 80 | # localnet 0.0.0.0:80/0.0.0.0 81 | 82 | ## RFC5735 Loopback address range 83 | ## if you enable this, you have to make sure remote_dns_subnet is not 127 84 | ## you'll need to enable it if you want to use an application that 85 | ## connects to localhost. 86 | # localnet 127.0.0.0/255.0.0.0 87 | 88 | ## RFC1918 Private Address Ranges 89 | # localnet 10.0.0.0/255.0.0.0 90 | # localnet 172.16.0.0/255.240.0.0 91 | # localnet 192.168.0.0/255.255.0.0 92 | 93 | # ProxyList format 94 | # type ip port [user pass] 95 | # (values separated by 'tab' or 'blank') 96 | # 97 | # only numeric ipv4 addresses are valid 98 | # 99 | # 100 | # Examples: 101 | # 102 | # socks5 192.168.67.78 1080 lamer secret 103 | # http 192.168.89.3 8080 justu hidden 104 | # socks4 192.168.1.49 1080 105 | # http 192.168.39.93 8080 106 | # 107 | # 108 | # proxy types: http, socks4, socks5 109 | # ( auth types supported: "basic"-http "user/pass"-socks ) 110 | # 111 | [ProxyList] 112 | # add proxy here ... 113 | # meanwile 114 | # defaults set to "tor" 115 | changeme_socks_type changeme_socks_host changeme_socks_port 116 | 117 | -------------------------------------------------------------------------------- /etc/requirements.txt: -------------------------------------------------------------------------------- 1 | PyYAML==3.12 2 | Pygments==2.1.3 3 | argparse==1.2.1 4 | backports.shutil-get-terminal-size==1.0.0 5 | backports.ssl-match-hostname==3.5.0.1 6 | cached-property==1.3.0 7 | decorator==4.0.10 8 | docker-compose==1.8.1 9 | docker-py==1.10.4 10 | docker-pycreds==0.2.1 11 | dockerpty==0.4.1 12 | docopt==0.6.2 13 | enum34==1.1.6 14 | functools32==3.2.3-2 15 | httpie==0.9.6 16 | ipaddress==1.0.17 17 | ipython==5.1.0 18 | ipython-genutils==0.1.0 19 | jsonschema==2.5.1 20 | pathlib2==2.1.0 21 | pexpect==4.2.1 22 | pickleshare==0.7.4 23 | prompt-toolkit==1.0.9 24 | ptyprocess==0.5.1 25 | requests==2.7.0 26 | simplegeneric==0.8.1 27 | six==1.10.0 28 | texttable==0.8.6 29 | traitlets==4.3.1 30 | wcwidth==0.1.7 31 | websocket-client==0.37.0 32 | wsgiref==0.1.2 33 | -------------------------------------------------------------------------------- /etc/settings.php.example: -------------------------------------------------------------------------------- 1 | [ 189 | 'host' => '127.0.0.1', 190 | 'port' => 11211, 191 | 'weight' => 0 192 | ], 193 | ] 194 | )); 195 | 196 | /** 197 | * Optional path to unix socket file, leave '' if to not use. 198 | * If using a unix socket file, the server list is overridden. 199 | * This should be faster than using the host/port if your cache server is local. 200 | * 201 | * @example '/var/run/redis/redis.sock' 202 | * @note By default, redis and memcached do not have a socket file, you must configure them. 203 | * @note Read and write access is required to the socket file. 204 | * @default '' 205 | */ 206 | define('nZEDb_CACHE_SOCKET_FILE', ''); 207 | 208 | /** 209 | * Timeout for connecting to cache server(s). 210 | * 211 | * @default 10 212 | */ 213 | define('nZEDb_CACHE_TIMEOUT', 10); 214 | 215 | /** 216 | * Memcached allows to compress the data, saving RAM at the expense of CPU time. 217 | * 218 | * @note Does nothing on redis. 219 | * @default false 220 | */ 221 | define('nZEDb_CACHE_COMPRESSION', false); 222 | 223 | /** 224 | * Serialization is a way of converting data in PHP into strings of text which can be stored on the 225 | * cache server. 226 | * 0 - Use the PHP serializer. Recommended for most people. 227 | * 1 - [Requires igbinary] Use igbinary serializer which is faster and uses less memory, works 228 | * on Memcached / Redis / APC, read the notes below. 229 | * 2 - [Redis Only] Use no serializer. 230 | * 231 | * @note igbinary must be compiled and enabled in php.ini 232 | * @note APC/APCu: This setting is ignored, set this in php.ini with apc.serializer 233 | * @note Memcached/Redis must be compiled with igbinary support as well to use igbinary. 234 | * @note Read the igbinary page how to compile / enable. 235 | * @see https://github.com/phadej/igbinary 236 | * @default 0 237 | * @version 3 238 | */ 239 | define('nZEDb_CACHE_SERIALIZER', 0); 240 | 241 | /** 242 | * Amount of time in seconds to expire data from the cache server. 243 | * The developers of nZEDb decide what should be set as short/medium/long, depending on the type of data. 244 | * 245 | * @defaults 300/600/900 246 | */ 247 | define('nZEDb_CACHE_EXPIRY_SHORT', 300); 248 | define('nZEDb_CACHE_EXPIRY_MEDIUM', 600); 249 | define('nZEDb_CACHE_EXPIRY_LONG', 900); 250 | 251 | //////////////////////////////////////////////////////////////////////////////////////////////////// 252 | /////////////////////////////////////// Log Settings /////////////////////////////////////////////// 253 | //////////////////////////////////////////////////////////////////////////////////////////////////// 254 | /** 255 | * Display debug messages on console or web page. 256 | * 257 | * @default false 258 | */ 259 | define('nZEDb_DEBUG', false); 260 | 261 | /** 262 | * Log debug messages to nzedb/resources/debug.log 263 | * 264 | * @default false 265 | */ 266 | define('nZEDb_LOGGING', false); 267 | 268 | /** 269 | * var_dump missing autoloader files. 270 | * 271 | * @note Dev setting. 272 | * @default false 273 | */ 274 | define('nZEDb_LOGAUTOLOADER', false); 275 | 276 | /** 277 | * How many log files to keep in the log folder. 278 | * 279 | * @default 20 280 | */ 281 | define('nZEDb_LOGGING_MAX_LOGS', 20); 282 | 283 | /** 284 | * How large can the log files be in MegaBytes before we create a new one? The old files are 285 | * compressed. 286 | * 287 | * @default 30 288 | */ 289 | define('nZEDb_LOGGING_MAX_SIZE', 30); 290 | 291 | /** 292 | * The folder to put the log files in. Put quotes, example : '/var/log/nZEDb/' 293 | * The default is in the nZEDb root folder /resources/logs/ 294 | * 295 | * @example '/var/log/nZEDb/' 296 | * @default nZEDb_LOGS 297 | */ 298 | define('nZEDb_LOGGING_LOG_FOLDER', nZEDb_LOGS); 299 | 300 | /** 301 | * The name of the log file. 302 | * Must be alphanumeric (a-z 0-9) and contain no file extensions. 303 | * 304 | * @default 'nzedb' 305 | */ 306 | define('nZEDb_LOGGING_LOG_NAME', 'nzedb'); 307 | 308 | /** 309 | * Display memory usage in log file and debug message output? 310 | * 311 | * @default true 312 | */ 313 | define('nZEDb_LOGGING_LOG_MEMORY_USAGE', true); 314 | 315 | /** 316 | * Display CPU load in log file and debug message output? 317 | * 318 | * @default true 319 | */ 320 | define('nZEDb_LOGGING_LOG_CPU_LOAD', true); 321 | 322 | /** 323 | * Display running time in log file and debug message output? 324 | * 325 | * @default true 326 | */ 327 | define('nZEDb_LOGGING_LOG_RUNNING_TIME', true); 328 | 329 | /** 330 | * Display resource usage in log file and debug message output? 331 | * 332 | * @default false 333 | */ 334 | define('nZEDb_LOGGING_LOG_RESOURCE_USAGE', false); 335 | 336 | /********************************************************************************* 337 | * The following options require either nZEDb_DEBUG OR nZEDb_LOGGING to be true: * 338 | *********************************************************************************/ 339 | 340 | /** 341 | * Log and/or echo debug Info messages. 342 | * 343 | * @default false 344 | */ 345 | define('nZEDb_LOGINFO', false); 346 | 347 | /** 348 | * Log and/or echo debug Notice messages. 349 | * 350 | * @default false 351 | */ 352 | define('nZEDb_LOGNOTICE', false); 353 | 354 | /** 355 | * Log and/or echo debug Warning messages. 356 | * 357 | * @default false 358 | */ 359 | define('nZEDb_LOGWARNING', false); 360 | 361 | /** 362 | * Log and/or echo debug Error messages. 363 | * 364 | * @default false 365 | */ 366 | define('nZEDb_LOGERROR', false); 367 | 368 | /** 369 | * Log and/or echo debug Fatal messages. 370 | * 371 | * @default false 372 | */ 373 | define('nZEDb_LOGFATAL', false); 374 | 375 | /** 376 | * Log and/or echo debug failed SQL queries. 377 | * 378 | * @default false 379 | */ 380 | define('nZEDb_LOGQUERIES', false); 381 | 382 | //////////////////////////////////////////////////////////////////////////////////////////////////// 383 | //////////////////////////////////////// SQL Settings ////////////////////////////////////////////// 384 | //////////////////////////////////////////////////////////////////////////////////////////////////// 385 | /** 386 | * Strip white space (space, carriage return, new line, tab, etc) from queries before sending to 387 | * MySQL. This is useful if you use the MySQL slow query log. 388 | * 389 | * @note This slows down query processing, leave it false unless you turn on the MySQL slow query 390 | * log. 391 | * @default false 392 | */ 393 | define('nZEDb_QUERY_STRIP_WHITESPACE', false); 394 | 395 | /** 396 | * Use transactions when doing certain SQL jobs. 397 | * This has advantages and disadvantages. 398 | * If there's a problem during a transaction, MySQL can revert the row inserts which is beneficial. 399 | * Transactions can cause deadlocks however if you are trying to insert into the same table from another process. 400 | * 401 | * @note If all your tables are MyISAM you can set this to false, as MyISAM does not support transactions. 402 | * @default true 403 | */ 404 | define('nZEDb_USE_SQL_TRANSACTIONS', true); 405 | 406 | /** 407 | * Allows the use of LOW_PRIORITY in certain DELETE queries. 408 | * This prevents table locks by deleting only when no SELECT queries are active on the table. 409 | * This works on MyISAM/ARIA, not INNODB. 410 | * 411 | * @note Does not cause any errors or warnings if enabled on INNODB. 412 | * @link https://dev.mysql.com/doc/refman/5.7/en/delete.html 413 | * @default false 414 | * @version 1 415 | */ 416 | define('nZEDb_SQL_DELETE_LOW_PRIORITY', false); 417 | 418 | /** 419 | * Allows the use QUICK in certain DELETE queries. 420 | * This makes DELETE queries faster on MyISAM/ARIA tables by not merging index leaves. 421 | * Only supported on MyISAM/ARIA 422 | * 423 | * @note Does not cause any errors or warnings if enabled on INNODB. 424 | * @link https://dev.mysql.com/doc/refman/5.7/en/delete.html 425 | * @default false 426 | * @version 1 427 | */ 428 | define('nZEDb_SQL_DELETE_QUICK', false); 429 | 430 | //////////////////////////////////////////////////////////////////////////////////////////////////// 431 | //////////////////////////////////// PHPMailer Settings //////////////////////////////////////////// 432 | //////////////////////////////////////////////////////////////////////////////////////////////////// 433 | /** 434 | * Simple constant to let us know this file is included and we should use PHPMailer library. 435 | * Uncomment the line below after setting the other constants. 436 | */ 437 | define('PHPMAILER_ENABLED', false); 438 | 439 | /** 440 | * Global "From" Address. 441 | * This address will be set as the From: address on every email sent by nZEDb. 442 | * 443 | * @example 'noreply@example.com' 444 | * @note Depending on server configurations, it may not respect this value. 445 | * @default '' (uses the contact email configured in 'Edit Site' settings) 446 | */ 447 | define('PHPMAILER_FROM_EMAIL', ''); 448 | 449 | /** 450 | * Global "From" Name. 451 | * Along with the email above, this will display as the name. 452 | * 453 | * @example 'KingCat' 454 | * @note Depending on server configurations, it may not respect this value. 455 | * @default '' (uses the site title configured in 'Edit Site' settings) 456 | */ 457 | define('PHPMAILER_FROM_NAME', ''); 458 | 459 | /** 460 | * Global "Reply-to" Address. 461 | * This address will be set as the Reply-to: address on every email sent by nZEDb. 462 | * 463 | * @example 'support@example.com' 464 | * @note It's a good idea to set this to your support email account (if possible) 465 | * @default '' (uses the contact email configured in 'Edit Site' settings) 466 | */ 467 | define('PHPMAILER_REPLYTO', ''); 468 | 469 | /** 470 | * Always BCC. 471 | * This email address will be blind carbon copied on every email sent from this site. 472 | * 473 | * @note This has very specific uses, don't enable unless you're sure you want to get the deluge. 474 | * @default '' 475 | */ 476 | define('PHPMAILER_BCC', ''); 477 | 478 | /** 479 | * Should we use a SMTP server to send mail? 480 | * If false, it will use your default settings from php.ini. 481 | * 482 | * @note If set to true, be sure to set the server settings below. 483 | * @default false 484 | */ 485 | define('PHPMAILER_USE_SMTP', false); 486 | 487 | /********************************************************************************* 488 | * The following options require PHPMAILER_USE_SMTP to be true: * 489 | *********************************************************************************/ 490 | 491 | /** 492 | * This is the hostname to use if connecting to a SMTP server. 493 | * 494 | * @note You can specify main and backup hosts, delimit with a semicolon. (i.e. 'main.host.com;backup.host.com') 495 | * @default '' 496 | */ 497 | define('PHPMAILER_SMTP_HOST', ''); 498 | 499 | /** 500 | * TLS & SSL Support for your SMTP server. 501 | * 502 | * @note Possible values: false, 'tls', 'ssl' 503 | * @default 'tls' 504 | */ 505 | define('PHPMAILER_SMTP_SECURE', 'tls'); 506 | 507 | /** 508 | * SMTP Port 509 | * 510 | * @note Usually this is 25, 465, or 587 511 | * @default 587 512 | */ 513 | define('PHPMAILER_SMTP_PORT', 587); 514 | 515 | /** 516 | * Does your SMTP host require authentication? 517 | * 518 | * @note Be sure to set credentials below if changing to true. 519 | * @default false 520 | */ 521 | define('PHPMAILER_SMTP_AUTH', false); 522 | 523 | /********************************************************************************* 524 | * The following options require both PHPMAILER_USE_SMTP & PHPMAILER_SMTP_AUTH to be true: * 525 | *********************************************************************************/ 526 | 527 | /** 528 | * SMTP username for authentication. 529 | * 530 | * @default '' 531 | */ 532 | define('PHPMAILER_SMTP_USER', ''); 533 | 534 | /** 535 | * SMTP password for authentication. 536 | * 537 | * @default '' 538 | */ 539 | define('PHPMAILER_SMTP_PASSWORD', ''); 540 | 541 | //////////////////////////////////////////////////////////////////////////////////////////////////// 542 | ////////////////////////////////// PHP CLI Settings //////////////////////////////////////////////// 543 | //////////////////////////////////////////////////////////////////////////////////////////////////// 544 | if (Misc::isCLI()) { 545 | 546 | /** 547 | * Your server's local timezone. 548 | * 549 | * @note Uncomment to enable. 550 | * @see https://secure.php.net/manual/en/timezones.php 551 | * @version 4 552 | */ 553 | //ini_set('date.timezone', 'America/New_York'); 554 | 555 | /** 556 | * Maximum amount of memory a PHP script can consume before being terminated. 557 | * 558 | * @note Uncomment to enable. 559 | * @default '1024M' 560 | * @version 4 561 | */ 562 | //ini_set('memory_limit', '1024M'); 563 | 564 | /** 565 | * Show PHP errors on CLI output. 566 | * 567 | * @note Set to '1' for development. 568 | * @default '0' 569 | * @version 4 570 | */ 571 | ini_set('display_errors', '0'); 572 | 573 | /** 574 | * Show startup errors on CLI output. 575 | * 576 | * @note Set to '1' for development/debugging. 577 | * @default '0' 578 | * @version 4 579 | */ 580 | ini_set('display_startup_errors', '0'); 581 | 582 | /** 583 | * Type of errors to display. 584 | * nZEDb code should run clean with no errors, so there is no point to restricting the reported 585 | * output. Any notices or warnings should be dealt with. 586 | * It makes no difference to performance if reporting specific types (i.e. strict, warnings, etc.) 587 | * are disabled, as the error is still prepared just not displayed. 588 | * 589 | * @default E_ALL 590 | * @see https://secure.php.net/manual/en/errorfunc.constants.php 591 | * @version 4 592 | */ 593 | ini_set('error_reporting', E_ALL); 594 | 595 | /** 596 | * Turn off HTML tags in error messages. 597 | * 598 | * @default '0' 599 | * @version 4 600 | */ 601 | ini_set('html_errors', '0'); 602 | 603 | /** 604 | * Set the location to log PHP errors. 605 | * 606 | * @default nZEDb_LOGS . 'php_errors.log' 607 | * @note To log to syslog, put in 'syslog' 608 | * @version 4 609 | */ 610 | ini_set('error_log', nZEDb_LOGS . 'php_errors_cli.log'); 611 | 612 | /** 613 | * Log errors to error_log? 614 | * 615 | * @default '1' 616 | * @version 4 617 | */ 618 | ini_set('log_errors', '1'); 619 | 620 | /** 621 | * Max line length for a error. 622 | * 623 | * @default 1024 624 | * @version 4 625 | */ 626 | ini_set('log_errors_max_len', '1024'); 627 | 628 | /** 629 | * Store the last PHP error in $php_errormsg 630 | * 631 | * @default '0' 632 | * @note This is a development/debugging option. 633 | * @version 4 634 | */ 635 | ini_set('track_errors', '0'); 636 | 637 | //////////////////////////////////////////////////////////////////////////////////////////////////// 638 | ///////////////////////////////////// PHP Web Settings ///////////////////////////////////////////// 639 | //////////////////////////////////////////////////////////////////////////////////////////////////// 640 | } else { 641 | 642 | /** 643 | * Your server's local timezone. 644 | * 645 | * @note Uncomment to enable. 646 | * @see https://secure.php.net/manual/en/timezones.php 647 | * @version 4 648 | */ 649 | //ini_set('date.timezone', 'America/New_York'); 650 | 651 | /** 652 | * Maximum amount of seconds a script can run before being terminated. 653 | * 654 | * @default '120' 655 | * @version 4 656 | */ 657 | ini_set('max_execution_time', '120'); 658 | 659 | /** 660 | * Maximum amount of memory a PHP script can consume before being terminated. 661 | * 662 | * @note Uncomment to enable. 663 | * @default '1024M' 664 | * @version 4 665 | */ 666 | //ini_set('memory_limit', '1024M'); 667 | 668 | /** 669 | * Show PHP errors on web browser. 670 | * 671 | * @note Set to '1' for development. 672 | * @default '0' 673 | * @version 4 674 | */ 675 | ini_set('display_errors', '0'); 676 | 677 | /** 678 | * Show startup errors on web browser. 679 | * 680 | * @note Set to '1' for development/debugging. 681 | * @default '0' 682 | * @version 4 683 | */ 684 | ini_set('display_startup_errors', '0'); 685 | 686 | /** 687 | * Type of errors to display. 688 | * nZEDb code should run clean with no errors, so there is no point to restricting the reported 689 | * output. Any notices or warnings should be dealt with. 690 | * It makes no difference to performance if reporting specific types (i.e. strict, warnings, etc.) 691 | * are disabled, as the error is still prepared just not displayed. 692 | * 693 | * @default E_ALL 694 | * @see https://secure.php.net/manual/en/errorfunc.constants.php 695 | * @version 4 696 | */ 697 | ini_set('error_reporting', E_ALL); 698 | 699 | /** 700 | * Turn off HTML tags in error messages. 701 | * 702 | * @default '1' 703 | * @version 4 704 | */ 705 | ini_set('html_errors', '1'); 706 | 707 | /** 708 | * Set the location to log PHP errors. 709 | * 710 | * @default nZEDb_LOGS . 'php_errors.log' 711 | * @note To log to syslog, put in 'syslog' 712 | * @version 4 713 | */ 714 | ini_set('error_log', nZEDb_LOGS . 'php_errors_web.log'); 715 | 716 | /** 717 | * Log errors to error_log? 718 | * 719 | * @default '1' 720 | * @version 4 721 | */ 722 | ini_set('log_errors', '1'); 723 | 724 | /** 725 | * Max line length for a error. 726 | * 727 | * @default 1024 728 | * @version 4 729 | */ 730 | ini_set('log_errors_max_len', '1024'); 731 | 732 | /** 733 | * Store the last PHP error in $php_errormsg 734 | * 735 | * @default '0' 736 | * @note This is a development/debugging option. 737 | * @version 4 738 | */ 739 | ini_set('track_errors', '0'); 740 | } 741 | 742 | //////////////////////////////////////////////////////////////////////////////////////////////////// 743 | /////////////////////////////////// PHP Xdebug Settings //////////////////////////////////////////// 744 | //////////////////////////////////////////////////////////////////////////////////////////////////// 745 | if (extension_loaded('xdebug')) { 746 | 747 | /** 748 | * Display colors on xdebug CLI output? 749 | * 0 - off, 1 - on only if on a TTY with ansi support, 2 - on regardless of TTY or ansi support. 750 | * 751 | * @default 0 752 | * @version 4 753 | */ 754 | ini_set('xdebug.cli_color', '0'); 755 | 756 | /** 757 | * Replace PHP's var_dump with xdebug's own? 758 | * 759 | * @default '1' 760 | * @version 4 761 | */ 762 | ini_set('xdebug.overload_var_dump', '1'); 763 | 764 | /** 765 | * How many items in a array or object to display on var_dump. 766 | * 767 | * @note Set to '-1' for no limit. 768 | * @default '128' 769 | * @version 4 770 | */ 771 | ini_set('xdebug.var_display_max_children', '128'); 772 | 773 | /** 774 | * Maximum string length on var_dump. (anything over is truncated) 775 | * 776 | * @note Set to '-1' for no limit. 777 | * @default '512' 778 | * @version 4 779 | */ 780 | ini_set('xdebug.var_display_max_data', '512'); 781 | 782 | /** 783 | * How many nested arrays / objects deep to display on var_dump. 784 | * 785 | * @note Set to '-1' for no limit. 786 | * @note Maximum value is '1023' 787 | * @default '3' 788 | * @version 4 789 | */ 790 | ini_set('xdebug.var_display_max_depth', '3'); 791 | } 792 | 793 | //////////////////////////////////////////////////////////////////////////////////////////////////// 794 | /////////////////////////////////// Maintenance Mode Settings ////////////////////////////////////// 795 | //////////////////////////////////////////////////////////////////////////////////////////////////// 796 | /** 797 | * Should the site be in maintenance mode. 798 | * If enabled, it will output the selected HTML file added below to front-end pages as well as 799 | * outputting a properly formatted API error response with the error text "Maintenance Mode" and 800 | * status code 503. 801 | * This will prevent nZEDb from making any MySQL/Sphinx/Cache calls so it's good to use this if you 802 | * need to stop/restart those services. 803 | * 804 | * @note If your site uses some form of webserver-level caching, the cache may need to be cleared 805 | * when coming out of maintenance mode. Otherwise you'll have to wait until it expires to see 806 | * your proper site again. 807 | * @default false 808 | */ 809 | define('MAINTENANCE_MODE_ENABLED', false); 810 | 811 | /** 812 | * The fully qualified absolute path to the maintenance mode HTML file. 813 | * This should be a fully complete HTML file and NOT a smarty template. The idea of a maintenance 814 | * file is it should be static HTML with no dependencies on other systems. 815 | * That way it can safely be displayed without the database running or any other services (except 816 | * PHP and the webserver of course). 817 | * 818 | * @note On my site I ripped the rendered HTML content of my home page and swapped out the center 819 | * container for a maintenance message. This is a good process. Be sure to remove all 820 | * references to user data. Links to other site pages can remain intact. 821 | * @default '' 822 | */ 823 | define('MAINTENANCE_MODE_HTML_PATH', ''); 824 | 825 | /** 826 | * What IP addresses should be excluded from maintenance mode. 827 | * 828 | * Useful if you want to allow admins to access the site while everyone else sees the maintenance 829 | * message. 830 | * 831 | * @note Keep in mind, if your site uses ipv6 you may need to enter your ipv6 address here as well. 832 | * @default [] 833 | */ 834 | define('MAINTENANCE_MODE_IP_EXCEPTIONS', []); 835 | 836 | /*************************************************************************************************** 837 | * ///////////////////////////////////////////////////////////////////////////////////////////////// 838 | * ///////////////////////////////////// Change log //////////////////////////////////////////////// 839 | * ///////////////////////////////////////////////////////////////////////////////////////////////// 840 | * 2017-08-09 v5 Add maintainance mode. 841 | * 2015-10-14 v4 Change defaults html_errors default to 0 842 | * 2015-08-26 v4 Add settings for PHP web/CLI SAPI's. 843 | * Add settings for Xdebug. 844 | * All new settings start from the "PHP CLI Settings" up to the "Change log", 845 | * lines ~544 to ~768 846 | * 2015-06-11 v3 Add support for APC or APCu extensions for caching data. Search for @version 3 847 | * for the changes. 848 | * 2015-05-10 v2 Update path to find_password_hash_cost.php in comments. Search for @version 2 849 | * for the changes. 850 | * 2015-05-03 v1 Track settings.php.example changes. 851 | * Add support for quick and low_priority on MySQL DELETE queries. 852 | * Search for @version 1 in this file to quickly find these additions. 853 | * ///////////////////////////////////////////////////////////////////////////////////////////////*/ 854 | -------------------------------------------------------------------------------- /etc/simply_nzedb.conf.example: -------------------------------------------------------------------------------- 1 | # Settings file for simply-nzedb 2 | 3 | #-------------- 4 | # Usenet server 5 | #-------------- 6 | NNTP_USERNAME= 7 | NNTP_PASSWORD= 8 | NNTP_SERVER= 9 | NNTP_PORT= 10 | NNTP_SSLENABLED=false 11 | 12 | #------------ 13 | # Database - don't change 14 | #------------ 15 | DB_SYSTEM=mysql 16 | DB_HOST=database 17 | DB_PORT=3306 18 | DB_SOCKET="" 19 | DB_USER=nzedb 20 | DB_PASSWORD=nzedb 21 | DB_NAME=nzedb 22 | 23 | #------------ 24 | # IRC Scaper 25 | #------------ 26 | IRC_USERNAME= 27 | IRC_SERVER=irc.synirc.net 28 | IRC_PORT=6667 29 | IRC_TLS=false 30 | # Change only if you're using znc 31 | IRC_PASSWORD="" 32 | 33 | #----------------- 34 | # nZEDb Admin User 35 | #----------------- 36 | NZEDB_ADMIN_USERNAME=nzedb 37 | NZEDB_ADMIN_PASSWORD=nzedb 38 | NZEDB_ADMIN_EMAIL=nzedb@localhost.com 39 | 40 | #---------------- 41 | # Socks Proxy 42 | #---------------- 43 | # The proxy is only used for post-processing scripts 44 | # Valid types: socks4 socks4a socks5 45 | SOCKS_TYPE= 46 | SOCKS_HOST= 47 | SOCKS_PORT= 48 | -------------------------------------------------------------------------------- /mariadb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mariadb:10.1.23 2 | MAINTAINER theslydetector@gmail.com 3 | 4 | # MariaDB Configuration 5 | RUN sed -i -r 's/bind-address.*$/bind-address = 0.0.0.0/' /etc/mysql/my.cnf \ 6 | && sed -i -r 's/port.*$/port = 3306'/ /etc/mysql/my.cnf 7 | 8 | # To avoid mysql whining about this variable 9 | ENV TERM dumb 10 | 11 | RUN apt-get update \ 12 | && apt-get install -y wget \ 13 | && rm -rf /var/lib/apt/lists/* 14 | 15 | ENV MYSQL_TUNER_VERSION 1.7.2 16 | RUN wget -O /mysqltuner.tar.gz https://github.com/major/MySQLTuner-perl/archive/${MYSQL_TUNER_VERSION}.tar.gz \ 17 | && cd / \ 18 | && tar xzvf mysqltuner.tar.gz \ 19 | && mv MySQLTuner-perl-${MYSQL_TUNER_VERSION} mysqltuner \ 20 | && rm /mysqltuner.tar.gz \ 21 | && chmod +x /mysqltuner/mysqltuner.pl 22 | 23 | # Install hook to change mysql user id on startup 24 | COPY moduser-entrypoint.sh /usr/local/bin 25 | ENTRYPOINT ["moduser-entrypoint.sh"] 26 | CMD ["mysqld"] 27 | -------------------------------------------------------------------------------- /mariadb/moduser-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Allow changing id of mysql user and group because the hardcoded 4 | # id in the mysql image is a PITA with host volumes (having to use sudo 5 | # to remove files, etc). 6 | if [ -e "/mysql_user" ]; then 7 | source /mysql_user 8 | 9 | if ! id --user $PUID; then 10 | echo "Changing mysql user to uid $PUID" 11 | usermod --uid $PUID mysql 12 | fi 13 | 14 | if ! id --group $PGID; then 15 | echo "Changing mysql group to gid $PGID" 16 | groupmod --gid $PGID mysql 17 | fi 18 | 19 | fi 20 | 21 | source /docker-entrypoint.sh 22 | 23 | -------------------------------------------------------------------------------- /nzedb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.7 2 | MAINTAINER theslydetector@gmail.com 3 | 4 | # Configure Timezone 5 | ENV TIMEZONE "America/Chicago" 6 | RUN rm -f /etc/localtime && \ 7 | ln -s "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime && \ 8 | echo "${TIMEZONE}" > /etc/timezone 9 | 10 | RUN apk add --update \ 11 | bash bwm-ng \ 12 | coreutils curl \ 13 | ffmpeg file findutils \ 14 | git \ 15 | htop \ 16 | iproute2 \ 17 | lame less \ 18 | make mariadb-client memcached musl \ 19 | nginx \ 20 | p7zip php7-ctype php7-curl php7-dev php7-exif php7-fpm php7-gd php7-iconv \ 21 | php7-imagick php7-json php7-mcrypt php7-opcache php7-openssl php7-pcntl \ 22 | php7-pdo php7-pdo_mysql php7-pear php7-phar php7-posix php7-redis \ 23 | php7-session php7-simplexml php7-sockets php7-xmlwriter php7-zlib pigz \ 24 | proxychains-ng pstree py2-pip python \ 25 | s6 strace \ 26 | tar tig tree tzdata \ 27 | unrar unzip util-linux \ 28 | vim \ 29 | wget \ 30 | zendframework \ 31 | && \ 32 | rm -rf /var/cache/apk/* 33 | 34 | # vnstat in testing repo 35 | 36 | # mytop + deps 37 | RUN apk add --update \ 38 | mariadb \ 39 | perl \ 40 | perl-dbd-mysql \ 41 | perl-term-readkey \ 42 | && \ 43 | rm -rf /var/cache/apk/* 44 | 45 | # Install composer 46 | RUN curl https://getcomposer.org/installer | php7 -- --install-dir=/usr/bin --filename=composer 47 | 48 | # Build and install mediainfo 49 | ENV MEDIAINFO_VERSION 18.05 50 | RUN apk --update add gcc g++ && \ 51 | mkdir -p /tmp && \ 52 | cd /tmp && \ 53 | curl -s -o mediainfo.tar.gz \ 54 | https://mediaarea.net/download/binary/mediainfo/${MEDIAINFO_VERSION}/MediaInfo_CLI_${MEDIAINFO_VERSION}_GNU_FromSource.tar.gz && \ 55 | tar xzvf mediainfo.tar.gz && \ 56 | cd MediaInfo_CLI_GNU_FromSource && \ 57 | ./CLI_Compile.sh && \ 58 | cd MediaInfo/Project/GNU/CLI && \ 59 | make install && \ 60 | cd / && \ 61 | rm -rf /tmp && \ 62 | apk del --purge gcc g++ && \ 63 | rm -rf /var/cache/apk/* 64 | 65 | # Install Python MySQL Modules 66 | RUN pip install --upgrade pip && \ 67 | pip install --upgrade setuptools && \ 68 | pip install cymysql pynntp socketpool 69 | 70 | # Configure PHP 71 | RUN sed -ri 's/(max_execution_time =) ([0-9]+)/\1 120/' /etc/php7/php.ini && \ 72 | sed -ri "s/(memory_limit =) (.*$)/\1 -1/" /etc/php7/php.ini && \ 73 | sed -ri 's/;(date.timezone =)/\1 America\/Chicago/' /etc/php7/php.ini && \ 74 | sed -ri 's/listen\s*=\s*127.0.0.1:9000/listen = 9000/g' /etc/php7/php-fpm.d/www.conf && \ 75 | sed -ri 's|;include_path = ".:/php/includes"|include_path = ".:/usr/share/php7"|g' /etc/php7/php.ini && \ 76 | mkdir -p /var/log/php-fpm/ 77 | 78 | # Install and configure nginx. 79 | RUN mkdir -p /var/log/nginx && \ 80 | mkdir -p /etc/nginx && \ 81 | mkdir -p /tmp/nginx && \ 82 | chmod 755 /var/log/nginx && \ 83 | chmod 777 /tmp && \ 84 | touch /var/log/nginx/nginx-error.log 85 | 86 | # Clone nZEDb and set directory permissions 87 | ENV NZEDB_VERSION "v0.8.7.0" 88 | RUN mkdir -p /var/www && \ 89 | cd /var/www && \ 90 | git clone https://github.com/nZEDb/nZEDb.git && \ 91 | cd /var/www/nZEDb && \ 92 | git checkout --quiet --force $NZEDB_VERSION && \ 93 | composer install && \ 94 | chmod -R 777 /var/www/nZEDb/ && \ 95 | # nuke all git repos' .git dir except for nzedb's .git dir to save space 96 | find . -name ".git" -type d | grep -v "\.\/\.git" | xargs rm -rf && \ 97 | # nuke ~350MB of composer cache 98 | composer clear-cache 99 | 100 | # Build tmux 2.0 since tmux 2.2 has issues: https://github.com/nZEDb/nZEDb/issues/2182 101 | ENV TMUX_VERSION 2.0 102 | RUN apk --update add gcc g++ ncurses-dev libevent-dev bsd-compat-headers && \ 103 | mkdir -p /tmp/tmux && \ 104 | cd /tmp/tmux && \ 105 | curl --location -o tmux.tar.gz https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz && \ 106 | tar xzvf tmux.tar.gz && \ 107 | cd tmux-${TMUX_VERSION} && \ 108 | ./configure --prefix /usr && \ 109 | make && \ 110 | make install && \ 111 | cd / && \ 112 | rm -rf /tmp/tmux && \ 113 | apk del --purge gcc g++ ncurses-dev libevent-dev bsd-compat-headers && \ 114 | rm -rf /var/cache/apk/* 115 | 116 | # Build and install php-yenc 117 | ENV PHP_ZEPHIR_PARSER_VERSION v1.1.2 118 | RUN cd /tmp && \ 119 | apk --update add gcc re2c libc-dev sudo && \ 120 | mkdir -p /tmp/zephir && \ 121 | cd /tmp/zephir && \ 122 | composer require phalcon/zephir && \ 123 | cd /tmp && \ 124 | git clone git://github.com/phalcon/php-zephir-parser.git && \ 125 | cd php-zephir-parser && \ 126 | git checkout --quiet --force $PHP_ZEPHIR_PARSER_VERSION && \ 127 | ./install && \ 128 | echo "extension=zephir_parser.so" > /etc/php7/conf.d/98_zephir_parser.ini && \ 129 | cd /tmp && \ 130 | git clone https://github.com/niel/php-yenc.git && \ 131 | cd php-yenc && \ 132 | /tmp/zephir/vendor/bin/zephir install && \ 133 | echo "extension=yenc.so" > /etc/php7/conf.d/99_yenc.ini && \ 134 | composer clear-cache && \ 135 | cd /tmp && \ 136 | rm -rf zephir php-yenc php-zephir-parser && \ 137 | apk del --purge gcc re2c libc-dev sudo 138 | 139 | # Build and install par2 140 | ENV PAR2_VERSION "v0.8.0" 141 | RUN apk --update add gcc autoconf automake g++ python-dev openssl-dev libffi-dev && \ 142 | git clone https://github.com/Parchive/par2cmdline.git /tmp/par2 && \ 143 | cd /tmp/par2 && \ 144 | git checkout --quiet --force $PAR2_VERSION && \ 145 | ./automake.sh && \ 146 | ./configure --prefix=/usr && \ 147 | make && \ 148 | make install && \ 149 | cd / && \ 150 | rm -rf /tmp/par2 && \ 151 | apk del --purge automake gcc autoconf g++ python-dev openssl-dev libffi-dev && \ 152 | apk add libgomp 153 | 154 | # Create dir for importing nzbs 155 | RUN mkdir -p /var/www/nZEDb/resources/import 156 | 157 | # Switch out php executable to instrument invocations 158 | RUN mv /usr/bin/php /usr/bin/php.real 159 | COPY php.proxy /usr/bin/php 160 | 161 | # Use pigz (parallel gzip) instead of gzip to speed up db backups 162 | RUN mv /bin/gzip /bin/gzip.real && \ 163 | ln -s /usr/bin/pigz /bin/gzip 164 | 165 | # iconv has issues in musl which affects NFO conversion to include 166 | # cool ascii chars. Remove the problematic parts - TRANSLIT and IGNORE 167 | # See https://github.com/slydetector/simply-nzedb/issues/31 168 | RUN sed -i "s|UTF-8//IGNORE//TRANSLIT|UTF-8|g" /var/www/nZEDb/nzedb/utility/Text.php 169 | 170 | LABEL nzedb=$NZEDB_VERSION \ 171 | maintainer=theslydetector@gmail.com \ 172 | url=https://github.com/slydetector/simply-nzedb 173 | 174 | RUN mkdir -p /var/www/nZEDb/resources/tmp && chmod 777 /var/www/nZEDb/resources/tmp 175 | 176 | ENV TERM tmux 177 | EXPOSE 8800 178 | ADD s6 /etc/s6 179 | CMD ["/bin/s6-svscan","/etc/s6"] 180 | WORKDIR /var/www/nZEDb/misc/update 181 | -------------------------------------------------------------------------------- /nzedb/php.proxy: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Activate socks proxy on postprocessing only. 4 | if [[ "$1" =~ ^.*postprocess.php$ && -n $SOCKS_TYPE ]]; then 5 | SOCKS_URL="${SOCKS_TYPE}://${SOCKS_HOST}:${SOCKS_PORT}" 6 | export http_proxy="$SOCKS_URL" 7 | export https_proxy="$SOCKS_URL" 8 | fi 9 | exec /usr/bin/php.real "$@" 10 | -------------------------------------------------------------------------------- /nzedb/s6/nginx/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec nginx 3 | -------------------------------------------------------------------------------- /nzedb/s6/php-fpm/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec php-fpm7 --nodaemonize 3 | -------------------------------------------------------------------------------- /nzedb/s6/tmux/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # Upgrade db with latest patches if necessary 5 | cd /var/www/nZEDb 6 | ./zed update db 7 | 8 | # Start up tmux which runs pretty much everything 9 | cd /var/www/nZEDb/misc/update/nix/tmux 10 | php start.php 11 | 12 | # Block indefinitely 13 | sleep 10 14 | exec tail -f /proc/`pidof tmux`/fd/1 15 | --------------------------------------------------------------------------------