├── .gitignore ├── LICENSE ├── README.md ├── TODO.md ├── defaults └── main.yml ├── example ├── README.md ├── group_vars │ └── seafile.yml └── seafile.yml ├── handlers └── main.yml ├── meta └── main.yml ├── tasks ├── 1_prerequisites.yml ├── 2_provision.yml ├── 3_download.yml ├── 4_preconfigure.yml ├── 5_configure.yml ├── 6_customize.yml ├── 7_database.yml ├── 8_init_admin.yml ├── 9_init.yml └── main.yml ├── templates ├── bin │ ├── environment │ ├── garbage-collect │ └── init_admin.py ├── ccnet │ └── seafile.ini ├── conf │ ├── ccnet.conf │ ├── gunicorn.conf │ ├── seafdav.conf │ ├── seafile.conf │ └── seahub_settings.py ├── init │ ├── seafile.conf │ ├── seafile.initd.Debian │ ├── seafile.initd.RedHat │ ├── seafile.sysconfig │ └── seahub.initd.RedHat └── systemd │ ├── seafile.service │ └── seahub.service └── vars └── main.yml /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | #bin/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | 25 | # Installer logs 26 | pip-log.txt 27 | pip-delete-this-directory.txt 28 | 29 | # Unit test / coverage reports 30 | htmlcov/ 31 | .tox/ 32 | .coverage 33 | .cache 34 | nosetests.xml 35 | coverage.xml 36 | 37 | # Translations 38 | *.mo 39 | 40 | # Mr Developer 41 | .mr.developer.cfg 42 | .project 43 | .pydevproject 44 | 45 | # Rope 46 | .ropeproject 47 | 48 | # Django stuff: 49 | *.log 50 | *.pot 51 | 52 | # Sphinx documentation 53 | docs/_build/ 54 | 55 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ansible-role-seafile 2 | ==================== 3 | 4 | An ansible role to deploy Seafile, an Open Source Cloud Storage. http://seafile.com/ 5 | 6 | version tags 7 | ------------ 8 | 9 | Version tags (at least starting from 4.0) follow this scheme X.Y.Z scheme: 10 | 11 | X.Y points to the major.minor upstream version of seafile, this role supports, or was 12 | at least tested with. 13 | 14 | Z points to bugfix updates to this role itself, and does not depend on any bugfix 15 | release from upstream or any upstream version change. 16 | 17 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | * When upgrading to 4.2 from 4.1, if you deploy Seafile in a non-root domain, you need to add the following extra settings in seahub_settings.py: 2 | 3 | COMPRESS_URL = MEDIA_URL 4 | STATIC_URL = MEDIA_URL + '/assets/' 5 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # version to install 3 | seafile_install_version: '6.3.4' 4 | seafile_install_version_beta: False 5 | 6 | # distribution download info 7 | seafile_tarball_url_base: https://download.seadrive.org/ 8 | seafile_tarball_name: seafile-server_{{ seafile_install_version }}_{{ ansible_architecture|replace("_","-")}}.tar.gz 9 | seafile_tarball_url: '{{ seafile_tarball_url_base + seafile_tarball_name }}' 10 | 11 | # names, files and directory locations 12 | seafile_user: seafile 13 | seafile_user_home: /home/seafile 14 | # defining seafile_user_uid will explicitly set the given value 15 | # leaving it undefined will fallback on adduser picking the value 16 | #seafile_user_uid: 999 17 | seafile_org_name: Seafile 18 | seafile_org_dir: '{{ seafile_user_home +"/"+ seafile_org_name|lower }}' 19 | seafile_distrib_dir: '{{ seafile_org_dir + "/seafile-server-" + seafile_install_version }}' 20 | seafile_ccnet_dir: '{{ seafile_org_dir + "/ccnet" }}' 21 | seafile_conf_dir: '{{ seafile_org_dir + "/conf" }}' 22 | seafile_latest_dir: '{{ seafile_org_dir + "/seafile-server-latest" }}' 23 | seafile_latest2_dir: '{{ seafile_org_dir + "/latest" }}' 24 | seafile_data_dir: '{{ seafile_org_dir + "/seafile-data" }}' 25 | seafile_seahubdata_dir: '{{ seafile_org_dir + "/seahub-data" }}' 26 | seafile_mylib_dir: '{{ seafile_org_dir + "/lib" }}' 27 | seafile_server_name: '{{ seafile_org_name }}' 28 | seafile_ip_or_domain: seacloud.cc 29 | seafile_service_url: http://{{ seafile_ip_or_domain }}:{{ seafile_fastcgi_port }} 30 | 31 | # the path to a local directory relative to your playbook, that holds 32 | # customisation files to be copied to 33 | # seafile-server-latest/seahub/media/custom/ 34 | #seafile_custom_files_path: custom # see tasks/configure.yml 35 | 36 | # when using an ssl terminating reverse proxy, you'' want to set this to: 37 | #seafile_service_url: https://{{ seafile_ip_or_domain }} 38 | 39 | seafile_quota_enable: false 40 | seafile_quota_default: 2 41 | 42 | seafile_history_keepall: true # set to false to enable keep_days limit 43 | seafile_history_keep_days: 30 44 | 45 | seafile_max_upload_size_enable: false # set to true to enable max 46 | seafile_max_upload_size: 200 # MB 47 | seafile_max_download_dir_size_enable: false # set to true to enable max 48 | seafile_max_download_dir_size: 200 # MB 49 | 50 | seafile_email_enable: false 51 | seafile_email_use_tls: false 52 | seafile_email_host: localhost 53 | seafile_email_user: '{{ seafile_seahub_admin_email }}' 54 | seafile_email_password: '' 55 | seafile_email_port: 25 56 | seafile_default_from_email: '{{ seafile_email_user }}' 57 | seafile_server_email: '{{ seafile_email_user }}' 58 | 59 | seafile_time_zone: 'UTC' 60 | seafile_site_base: 'http://{{ seafile_ip_or_domain }}/' 61 | seafile_site_name: '{{ seafile_org_name }}' # used in email notifications 62 | seafile_site_title: '{{ seafile_org_name }}' 63 | seafile_site_root: '/' 64 | seafile_use_pdfjs: true 65 | seafile_enable_signup: false 66 | seafile_activate_after_registration: false 67 | seafile_send_email_on_adding_system_member: true 68 | seafile_send_email_on_resetting_user_passwd: true 69 | seafile_cloud_mode: true 70 | seafile_file_preview_max_size: 30 * 1024 * 1024 71 | seafile_session_cookie_age: 60 * 60 * 24 * 7 * 2 72 | seafile_session_save_every_request: false 73 | seafile_session_expire_at_browser_close: false 74 | seafile_force_server_crypto: true 75 | seafile_logo_path: # default none 76 | seafile_css_path: # default none 77 | seafile_allowed_hosts: # default none 78 | 79 | # network ports 80 | seafile_ccnet_port: 10001 81 | seafile_seafile_port: 12001 82 | seafile_httpserver_port: 8082 83 | seafile_webdav_port: 8080 84 | # fastcgi is no longer supported since version 6.3 85 | # see https://manual.seafile.com/changelog/server-changelog.html#63 86 | seafile_fastcgi_enabled: false 87 | seafile_fastcgi_port: 8000 88 | # seahub behind reverse proxy 89 | seafile_gunicorn_port: '{{ seafile_fastcgi_port }}' 90 | 91 | # webdav settings 92 | seafile_webdav_enabled: false 93 | seafile_webdav_fastcgi: false 94 | seafile_webdav_path: '/dav' 95 | 96 | # seahub settings 97 | seafile_seahub_admin_email: admin@{{ seafile_ip_or_domain }} 98 | 99 | # No default, this needs to be set explicitly. 100 | #seafile_seahub_admin_password: 101 | 102 | # database settings 103 | seafile_backend: 'sqlite' 104 | # the next settings are not used for sqlite 105 | seafile_db_host: '127.0.0.1' 106 | seafile_db_port: '3306' 107 | seafile_db_user: 'seafile' 108 | seafile_db_pass: 's3cr3t' 109 | seafile_db_name: 110 | ccnet: 'ccnet' 111 | seafile: 'seafile' 112 | seahub: 'seahub' 113 | 114 | ## cron jobs 115 | # a weekly job to perform garbage collection 116 | seafile_cron_gc_enabled: false 117 | 118 | ## ldap 119 | #seafile_ldap: 120 | # host: 'ldap://127.0.0.1' 121 | # base: 'ou=people,dc=example,dc=com' 122 | # user_dn: 'cn=seafile,ou=services,dc=example,dc=com' 123 | # password: 'cleartext-password' 124 | # login_attr: mail 125 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | dependencies 2 | ============ 3 | 4 | The seafile.yml example playbook deploys seafile with nginx as frontend reverse 5 | proxy and ssl terminator. 6 | 7 | It deploys the a mysql server (using the Galaxy role bennojoy.mysql) and also 8 | enables fastcgi and webdav. 9 | 10 | For nginx, it needs the Ginsys.nginx role, which is a fork of bennojoy's nginx 11 | role. 12 | 13 | -------------------------------------------------------------------------------- /example/group_vars/seafile.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # version to install 3 | seafile_install_version: '6.3.4' 4 | 5 | # names, files and directory locations 6 | seafile_user: seafile 7 | seafile_user_home: /home/seafile 8 | seafile_org_name: Ginsys 9 | seafile_server_name: '{{ seafile_org_name }}' 10 | seafile_ip_or_domain: seafile.ginsys.eu 11 | seafile_service_url: https://{{ seafile_ip_or_domain }} 12 | 13 | seafile_quota_enable: false 14 | seafile_quota_default: 2 15 | 16 | seafile_history_keepall: true # set to false to enable keep_days limit 17 | seafile_history_keep_days: 30 18 | 19 | seafile_max_upload_size_enable: false # set to true to enable max 20 | seafile_max_upload_size: 200 # MB 21 | seafile_max_download_dir_size_enable: false # set to true to enable max 22 | seafile_max_download_dir_size: 200 # MB 23 | 24 | seafile_email_enable: enable 25 | seafile_email_use_tls: false 26 | #seafile_email_host: smtp.myisp.example 27 | seafile_email_user: '{{ seafile_seahub_admin_email }}' 28 | seafile_email_password: '' 29 | seafile_email_port: 25 30 | seafile_default_from_email: '{{ seafile_email_user }}' 31 | seafile_server_email: '{{ seafile_email_user }}' 32 | 33 | seafile_time_zone: 'Europe/Brussels' 34 | seafile_site_base: 'http://{{ seafile_ip_or_domain }}/' 35 | seafile_site_name: '{{ seafile_org_name }}' # used in email notifications 36 | seafile_site_title: '{{ seafile_org_name }}' 37 | seafile_site_root: '/' 38 | seafile_cloud_mode: true 39 | seafile_logo_path: 'custom/ginsys_seafile_logo.png' 40 | 41 | seafile_fastcgi_enabled: false 42 | 43 | # webdav settings 44 | seafile_webdav_enabled: true 45 | seafile_webdav_fastcgi: true 46 | seafile_webdav_path: /dav 47 | 48 | # seahub settings 49 | seafile_seahub_admin_email: admon@ginsys.eu 50 | seafile_seahub_admin_password: myDarkS3cr3T 51 | 52 | # database settings 53 | seafile_backend: mysql 54 | 55 | #mysql configuration 56 | # 57 | seafile_db_user: 'seafile' 58 | mysql_bind_address: '{{ seafile_db_host }}' 59 | mysql_db: 60 | - name: '{{ seafile_db_name.ccnet }}' 61 | replicate: no 62 | - name: '{{ seafile_db_name.seafile }}' 63 | replicate: no 64 | - name: '{{ seafile_db_name.seahub }}' 65 | replicate: no 66 | mysql_users: 67 | - name: '{{ seafile_db_user }}' 68 | pass: '{{ seafile_db_pass }}' 69 | priv: > 70 | {{ seafile_db_name.ccnet ~ ".*:ALL/" ~ 71 | seafile_db_name.seafile ~ ".*:ALL/" ~ 72 | seafile_db_name.seahub ~ ".*:ALL" }} 73 | 74 | mysql_root_db_pass: dark 75 | seafile_db_pass: secret 76 | 77 | #nginx configuration 78 | # 79 | nginx_max_clients: 128 80 | nginx_http_params: 81 | sendfile: "on" 82 | tcp_nopush: "on" 83 | tcp_nodelay: "on" 84 | keepalive_timeout: "65" 85 | access_log: "/var/log/nginx/access.log" 86 | error_log: "/var/log/nginx/error.log" 87 | types_hash_max_size: 2048 88 | 89 | nginx_sites: 90 | - server: 91 | file_name: '{{ seafile_ip_or_domain }}' 92 | server_name: '{{ seafile_ip_or_domain }}' 93 | listen: 80 94 | rewrite: ^ https://$http_host$request_uri? permanent 95 | - server: 96 | file_name: '{{ seafile_ip_or_domain }}-ssl' 97 | server_name: '{{ seafile_ip_or_domain }}' 98 | listen: 443 99 | ssl: "on" 100 | ssl_certificate_key: /etc/ssl/private/server.key.pem 101 | ssl_certificate: /etc/ssl/private/server.crt.pem 102 | location: 103 | - name: / 104 | proxy_pass: 127.0.0.1:{{ seafile_gunicorn_port }} 105 | "proxy_set_header": "Host $host" 106 | "proxy_set_header": "X-Real-IP $remote_addr" 107 | "proxy_set_header": "X-Forwarded-For $proxy_add_x_forwarded_for" 108 | "proxy_set_header": "X-Forwarded-Host $server_name" 109 | "proxy_read_timeout": "1200s" 110 | client_max_body_size: 0 111 | access_log: /var/log/nginx/seahub.access.log 112 | error_log: /var/log/nginx/seahub.error.log 113 | - name: /seafhttp 114 | rewrite: ^/seafhttp(.*)$ $1 break 115 | proxy_pass: http://127.0.0.1:{{ seafile_httpserver_port }} 116 | client_max_body_size: 0 117 | - name: /media 118 | root: '{{ seafile_latest_dir }}/seahub' 119 | - name: '{{ seafile_webdav_path }}' 120 | fastcgi_pass: 127.0.0.1:{{ seafile_webdav_port }} 121 | "fastcgi_param SCRIPT_FILENAME": $document_root$fastcgi_script_name 122 | "fastcgi_param PATH_INFO": $fastcgi_script_name 123 | "fastcgi_param SERVER_PROTOCOL": $server_protocol 124 | "fastcgi_param QUERY_STRING": $query_string 125 | "fastcgi_param REQUEST_METHOD": $request_method 126 | "fastcgi_param CONTENT_TYPE": $content_type 127 | "fastcgi_param CONTENT_LENGTH": $content_length 128 | "fastcgi_param SERVER_ADDR": $server_addr 129 | "fastcgi_param SERVER_PORT": $server_port 130 | "fastcgi_param SERVER_NAME": $server_name 131 | "fastcgi_param HTTPS": on 132 | "fastcgi_param HTTP_SCHEME": https 133 | client_max_body_size: 50m 134 | access_log: /var/log/nginx/seafdav.access.log 135 | error_log: /var/log/nginx/seafdav.error.log 136 | 137 | 138 | -------------------------------------------------------------------------------- /example/seafile.yml: -------------------------------------------------------------------------------- 1 | - hosts: seafile 2 | gather_facts: true 3 | remote_user: root 4 | pre_tasks: 5 | - name: provision ssl dir 6 | file: 7 | dest: /etc/ssl/private 8 | state: directory 9 | owner: root 10 | group: root 11 | mode: 0700 12 | 13 | - name: copy ssl certificates 14 | copy: 15 | src: files/ssl/{{ item }} 16 | dest: /etc/ssl/private/{{ item }} 17 | owner: root 18 | group: root 19 | mode: 0600 20 | with_items: 21 | - server.key.pem 22 | - server.crt.pem 23 | 24 | 25 | roles: 26 | - role: bennojoy.mysql 27 | - role: Ginsys.seafile 28 | - role: Ginsys.nginx 29 | 30 | 31 | post_tasks: 32 | - name: allow web server access to seafile data 33 | user: 34 | name: 'www-data' 35 | groups: '{{ seafile_user }}' 36 | append: yes 37 | 38 | -------------------------------------------------------------------------------- /handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: systemd_reload 3 | command: systemctl daemon-reload 4 | 5 | - name: restart_seafile 6 | service: 7 | name: '{{ item.name }}' 8 | state: restarted 9 | sleep: 5 10 | when: ansible_os_family in item.os_family 11 | with_items: '{{ SEAFILE_INIT_SCRIPTS }}' 12 | 13 | - name: start_seafile 14 | service: 15 | name: '{{ item.name }}' 16 | state: started 17 | sleep: 5 18 | when: ansible_os_family in item.os_family 19 | with_items: '{{ SEAFILE_INIT_SCRIPTS }}' 20 | 21 | - name: stop_seafile 22 | service: 23 | name: '{{ item.name }}' 24 | state: stopped 25 | sleep: 5 26 | when: ansible_os_family in item.os_family 27 | with_items: '{{ SEAFILE_INIT_SCRIPTS }}' 28 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | author: Serge van Ginderachter 4 | description: > 5 | Install and configure Seafile, an Open Source Cloud Storage. 6 | Homepage http://seafile.com 7 | company: ginsys.eu 8 | license: GPLv3 9 | min_ansible_version: 1.9 10 | platforms: 11 | - name: EL 12 | versions: 13 | - 6 14 | - name: Ubuntu 15 | versions: 16 | - trusty 17 | - name: Debian 18 | versions: 19 | - jessie 20 | categories: 21 | - web 22 | dependencies: [] 23 | 24 | -------------------------------------------------------------------------------- /tasks/1_prerequisites.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: check supported versions 3 | assert: 4 | that: 5 | - ansible_version is defined 6 | - ansible_version.full is version_compare(min_ansible_version, '>=') 7 | # For ansible 2.5 and up: 8 | #- ansible_version.full is version(min_ansible_version, '>=') 9 | - ansible_distribution in SEAFILE_SUPPORTED_DISTRIBUTIONS 10 | - '".".join(seafile_install_version.split(".")[0:2]) in SEAFILE_SUPPORTED_VERSIONS' 11 | - seafile_backend in SEAFILE_SUPPORTED_BACKENDS 12 | - ansible_python_version.startswith('2.6') or ansible_python_version.startswith('2.7') 13 | 14 | - name: install dependencies - deb 15 | apt: 16 | name: '{{ item }}' 17 | state: latest 18 | update_cache: true 19 | cache_valid_time: 300 20 | with_items: '{{ DEPENDENCY_PACKAGES_APT }}' 21 | when: ansible_pkg_mgr == 'apt' 22 | 23 | - name: install dependencies - rpm + python 2.6 24 | yum: 25 | name: '{{ item }}' 26 | state: latest 27 | with_items: '{{ DEPENDENCY_PACKAGES_RPM }}' 28 | when: ansible_pkg_mgr == 'yum' and ansible_python_version.startswith('2.6') 29 | 30 | - name: install dependencies - rpm + python 2.7 31 | yum: 32 | name: '{{ item }}' 33 | state: latest 34 | with_items: '{{ DEPENDENCY_PACKAGES_RPM }}' 35 | when: ansible_pkg_mgr == 'yum' and ansible_python_version.startswith('2.7') 36 | 37 | - name: check if deprecated features are in use 38 | assert: 39 | that: 40 | # For ansible 2.5 and up: 41 | #- 'not(seafile_fastcgi_enabled and seafile_install_version is version("6.3", ">="))' 42 | - 'not(seafile_fastcgi_enabled and seafile_install_version is version_compare("6.3", ">="))' 43 | msg: > 44 | seafile_fastcgi_enabled is not supported since seafile version 6.3. 45 | If you are using a reverse proxy, you will need to change fastcgi_pass to proxy_pass in your server configuration, 46 | have a look at the example in example/group_vars/seafile.yml. 47 | More information at https://manual.seafile.com/changelog/server-changelog.html#63 48 | and https://manual.seafile.com/deploy/deploy_with_nginx.html 49 | -------------------------------------------------------------------------------- /tasks/2_provision.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: provision seafile user 3 | user: 4 | name: '{{ seafile_user }}' 5 | state: present 6 | comment: Seafile 7 | createhome: yes 8 | generate_ssh_key: no 9 | home: '{{ seafile_user_home }}' 10 | move_home: yes 11 | system: yes 12 | uid: '{{ seafile_user_uid|default(omit) }}' 13 | 14 | - name: provision directories 15 | become: yes 16 | become_user: '{{ seafile_user }}' 17 | file: 18 | path: '{{ item }}' 19 | owner: '{{ seafile_user }}' 20 | group: '{{ seafile_user }}' 21 | mode: 0755 22 | state: directory 23 | with_items: 24 | - '{{ seafile_org_dir }}' 25 | - '{{ seafile_org_dir + "/bin" }}' 26 | - '{{ seafile_org_dir + "/installed" }}' 27 | - '{{ seafile_ccnet_dir }}' 28 | - '{{ seafile_conf_dir }}' 29 | - '{{ seafile_log_dir }}' 30 | - '{{ seafile_data_dir }}' 31 | - '{{ seafile_seahubdata_dir }}' 32 | - '{{ seafile_seahubdata_dir + "/avatars" }}' 33 | - '{{ seafile_seahubdata_dir + "/custom" }}' 34 | - '{{ seafile_mylib_dir }}' 35 | 36 | -------------------------------------------------------------------------------- /tasks/3_download.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install seafile beta 3 | set_fact: 4 | seafile_tarball_url: '{{ seafile_tarball_url|replace(".tar.gz", "-beta.tar.gz") }}' 5 | when: seafile_install_version_beta 6 | 7 | - name: download release tarball 8 | become: yes 9 | become_user: '{{ seafile_user }}' 10 | get_url: 11 | url: '{{ seafile_tarball_url }}' 12 | dest: '{{ seafile_org_dir + "/installed" }}' 13 | register: seafile_tarball_dl 14 | check_mode: no 15 | 16 | - name: untar tarball 17 | become: yes 18 | become_user: '{{ seafile_user }}' 19 | unarchive: 20 | copy: no 21 | src: '{{ seafile_tarball_dl.dest }}' 22 | dest: '{{ seafile_org_dir }}' 23 | creates: '{{ seafile_distrib_dir }}' 24 | register: seafile_tarball_ex 25 | 26 | - name: check if we already have init scripts 27 | stat: 28 | path: /etc/init.d/{{ item.name }} 29 | with_items: '{{ SEAFILE_INIT_SCRIPTS }}' 30 | when: ansible_os_family in item.os_family 31 | register: _seafile_init_script_present 32 | 33 | - name: stop_seafile 34 | service: 35 | name: '{{ item.0.name }}' 36 | state: stopped 37 | sleep: 5 38 | with_nested: 39 | - '{{ SEAFILE_INIT_SCRIPTS }}' 40 | - '{{ _seafile_init_script_present.results }}' 41 | when: 42 | - ansible_os_family in item.0.os_family 43 | - not item.1 is skipped 44 | - item.1.stat.exists 45 | - seafile_tarball_dl is changed or seafile_tarball_ex is changed 46 | 47 | - name: link latest release 48 | become: yes 49 | become_user: '{{ seafile_user }}' 50 | file: 51 | src: '{{ seafile_distrib_dir }}' 52 | dest: '{{ item }}' 53 | owner: '{{ seafile_user }}' 54 | group: '{{ seafile_user }}' 55 | state: link 56 | notify: restart_seafile 57 | with_items: 58 | - '{{ seafile_latest_dir }}' 59 | - '{{ seafile_latest2_dir }}' 60 | register: seafile_new_release 61 | -------------------------------------------------------------------------------- /tasks/4_preconfigure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # prepare ccnet config 3 | - name: generate ccnet config 4 | become: yes 5 | become_user: '{{ seafile_user }}' 6 | command: > 7 | {{ SEAFILE_CCNET_INIT }} -c {{ seafile_mylib_dir }}/ccnet --name {{ seafile_user }} --port {{ seafile_ccnet_port }} --host {{ seafile_ip_or_domain }} 8 | creates={{ seafile_mylib_dir }}/ccnet/ 9 | environment: '{{ SEAFILE_ENVIRONMENT }}' 10 | 11 | - name: register ccnet key ID 12 | become: yes 13 | become_user: '{{ seafile_user }}' 14 | shell: grep ID {{ seafile_mylib_dir }}/ccnet/ccnet.conf | cut -d= -f2 15 | register: _seafile_ccnet_ID 16 | check_mode: no 17 | changed_when: false 18 | failed_when: _seafile_ccnet_ID.stdout == "" or _seafile_ccnet_ID.stderr != "" 19 | 20 | - name: link ccnet peer key 21 | become: yes 22 | become_user: '{{ seafile_user }}' 23 | file: 24 | src: '{{ seafile_mylib_dir }}/ccnet/mykey.peer' 25 | dest: '{{ seafile_ccnet_dir }}/mykey.peer' 26 | state: link 27 | force: yes 28 | owner: '{{ seafile_user }}' 29 | group: '{{ seafile_user }}' 30 | mode: 0640 31 | 32 | # prepare seahub_settings secret key 33 | - name: generate seahub_settings secret key 34 | become: yes 35 | become_user: '{{ seafile_user }}' 36 | shell: > 37 | {{ SEAFILE_SECRET_KEYGEN }} > {{ seafile_mylib_dir }}/seahub_settings_secret_key 38 | creates={{ seafile_mylib_dir }}/seahub_settings_secret_key 39 | environment: '{{ SEAFILE_ENVIRONMENT }}' 40 | 41 | - name: register seahub_settings secret key 42 | become: yes 43 | become_user: '{{ seafile_user }}' 44 | command: cat {{ seafile_mylib_dir }}/seahub_settings_secret_key 45 | register: _seafile_seahub_settings_secret_key 46 | check_mode: no 47 | changed_when: false 48 | failed_when: _seafile_seahub_settings_secret_key.stdout == "" or _seafile_seahub_settings_secret_key.stderr != "" 49 | 50 | -------------------------------------------------------------------------------- /tasks/5_configure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: provision configuration files and scripts 3 | become: yes 4 | become_user: '{{ seafile_user }}' 5 | template: 6 | src: '{{ item.src }}' 7 | dest: '{{ item.dest }}' 8 | owner: '{{ seafile_user }}' 9 | group: '{{ seafile_user }}' 10 | mode: '{{ item.exec | default(false) | ternary(0750,0640) }}' 11 | with_items: 12 | # configuration files 13 | - src: 'ccnet/seafile.ini' 14 | dest: '{{ seafile_ccnet_dir }}/' 15 | - src: 'conf/ccnet.conf' 16 | dest: '{{ seafile_conf_dir }}/' 17 | - src: 'conf/seafile.conf' 18 | dest: '{{ seafile_conf_dir }}/' 19 | - src: 'conf/seafdav.conf' 20 | dest: '{{ seafile_conf_dir }}/' 21 | - src: 'conf/seahub_settings.py' 22 | dest: '{{ seafile_conf_dir }}/' 23 | - src: 'conf/gunicorn.conf' 24 | dest: '{{ seafile_conf_dir }}/' 25 | # handy environment file to be sourced when doing things manually 26 | - src: 'bin/environment' 27 | dest: '{{ seafile_org_dir + "/bin/" }}' 28 | # perform a garbage collection maintenance 29 | - src: 'bin/garbage-collect' 30 | dest: '{{ seafile_org_dir + "/bin/" }}' 31 | exec: true 32 | notify: restart_seafile 33 | 34 | - name: provision crontabs 35 | cron: 36 | name: '{{ item.name }}' 37 | user: '{{ seafile_user }}' 38 | job: '{{ seafile_org_dir + "/bin/" + item.script }}' 39 | minute: '{{ item.min | default(omit) }}' 40 | hour: '{{ item.hou | default(omit) }}' 41 | day: '{{ item.dom | default(omit) }}' 42 | month: '{{ item.mon | default(omit) }}' 43 | weekday: '{{ item.dow | default(omit) }}' 44 | state: '{{ item.enabled | default(False) | ternary("present", "absent") }}' 45 | with_items: 46 | - name: Weekly Garbage Collection 47 | script: garbage-collect 48 | min: 0 49 | hou: 5 50 | dow: 7 51 | enabled: '{{ seafile_cron_gc_enabled }}' 52 | 53 | - name: move the default avatars directory out of the way 54 | become: yes 55 | become_user: '{{ seafile_user }}' 56 | shell: > 57 | ORI='{{ seafile_latest_dir }}/seahub/media/avatars'; 58 | test -e $ORI && (test -L $ORI || mv -v $ORI ${ORI}.ori) 59 | register: _shell 60 | changed_when: _shell.stdout_lines|length > 0 61 | 62 | - name: link media folders with local custom data 63 | become: yes 64 | become_user: '{{ seafile_user }}' 65 | file: 66 | src: '{{ seafile_seahubdata_dir +"/"+ item }}' 67 | dest: '{{ seafile_latest_dir +"/seahub/media/" + item }}' 68 | owner: '{{ seafile_user }}' 69 | group: '{{ seafile_user }}' 70 | mode: 0755 71 | state: link 72 | force: yes 73 | with_items: 74 | - avatars 75 | - custom 76 | 77 | - name: copy default avatars to custom data dir 78 | become: yes 79 | become_user: '{{ seafile_user }}' 80 | shell: | 81 | ORI='{{ seafile_latest_dir }}/seahub/media/avatars'; 82 | rsync -ai ${ORI}.ori/ $ORI/ 83 | register: _shell 84 | changed_when: _shell.stdout_lines|length > 0 85 | 86 | -------------------------------------------------------------------------------- /tasks/6_customize.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handle custom files outside the role upload 3 | 4 | - name: check for custom files folder 5 | become: false 6 | local_action: 7 | module: stat 8 | path: '{{ seafile_custom_files_path }}' 9 | follow: yes 10 | when: seafile_custom_files_path is defined 11 | register: seafile_custom_files_folder_found 12 | 13 | - name: list custom dirs 14 | become: false 15 | local_action: command chdir="{{ seafile_custom_files_path }}" find . -mindepth 1 -type d 16 | changed_when: false 17 | check_mode: no 18 | register: seafile_custom_files_path_dirs 19 | when: 20 | - not seafile_custom_files_folder_found is skipped 21 | - seafile_custom_files_folder_found.stat.exists 22 | - seafile_custom_files_folder_found.stat.isdir 23 | 24 | - name: list custom files 25 | become: false 26 | local_action: command chdir="{{ seafile_custom_files_path }}" find . -mindepth 1 -type f 27 | changed_when: false 28 | check_mode: no 29 | register: seafile_custom_files_path_files 30 | when: 31 | - not seafile_custom_files_folder_found is skipped 32 | - seafile_custom_files_folder_found.stat.exists 33 | - seafile_custom_files_folder_found.stat.isdir 34 | 35 | - name: create custom files dirs 36 | file: 37 | dest: '{{ seafile_seahubdata_dir +"/custom/" + item }}' 38 | state: directory 39 | owner: '{{ seafile_user }}' 40 | group: '{{ seafile_user }}' 41 | mode: 0755 42 | with_items: '{{ seafile_custom_files_path_dirs.stdout_lines }}' 43 | when: 44 | - not seafile_custom_files_folder_found is skipped 45 | - seafile_custom_files_folder_found.stat.exists 46 | - seafile_custom_files_folder_found.stat.isdir 47 | 48 | - name: copy custom files 49 | copy: 50 | src: '{{ seafile_custom_files_path +"/"+ item }}' 51 | dest: '{{ seafile_seahubdata_dir +"/custom/" + item }}' 52 | owner: '{{ seafile_user }}' 53 | group: '{{ seafile_user }}' 54 | mode: 0644 55 | with_items: '{{ seafile_custom_files_path_files.stdout_lines }}' 56 | when: 57 | - not seafile_custom_files_folder_found is skipped 58 | - seafile_custom_files_folder_found.stat.exists 59 | - seafile_custom_files_folder_found.stat.isdir 60 | 61 | -------------------------------------------------------------------------------- /tasks/7_database.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: provision database 3 | become: yes 4 | become_user: '{{ seafile_user }}' 5 | shell: '{{ SEAFILE_MANAGEPY }} migrate --no-input' 6 | environment: '{{ SEAFILE_ENVIRONMENT }}' 7 | register: seafile_syncdb 8 | changed_when: seafile_syncdb.stdout.find( "Creating table ") != -1 9 | 10 | -------------------------------------------------------------------------------- /tasks/8_init_admin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: provision admin user creation script 3 | become: yes 4 | become_user: '{{ seafile_user }}' 5 | template: 6 | src: bin/init_admin.py 7 | dest: '{{ seafile_latest_dir }}/init_admin.py' 8 | mode: 0700 9 | 10 | - name: provision admin user 11 | become: yes 12 | become_user: '{{ seafile_user }}' 13 | command: /usr/bin/env python {{ seafile_latest_dir }}/init_admin.py 14 | environment: '{{ SEAFILE_ENVIRONMENT }}' 15 | register: seafile_init_admin 16 | changed_when: seafile_init_admin.stdout.find("changed=false") == -1 17 | 18 | -------------------------------------------------------------------------------- /tasks/9_init.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: provision sysconfig 3 | template: 4 | src: init/seafile.sysconfig 5 | dest: /etc/sysconfig/seafile 6 | owner: root 7 | group: root 8 | mode: 0644 9 | when: ansible_os_family == "RedHat" 10 | notify: restart_seafile 11 | 12 | - name: provision sysvinit script 13 | template: 14 | src: 'init/{{ item.name }}.initd.{{ ansible_os_family }}' 15 | dest: '/etc/init.d/{{ item.name }}' 16 | owner: root 17 | group: root 18 | mode: 0750 19 | when: ansible_os_family in item.os_family and ansible_service_mgr == "sysvinit" 20 | with_items: '{{ SEAFILE_INIT_SCRIPTS }}' 21 | notify: restart_seafile 22 | 23 | - name: provision systemd services 24 | template: 25 | src: 'systemd/{{ item.name }}.service' 26 | dest: '/lib/systemd/system/' 27 | when: ansible_service_mgr == "systemd" 28 | with_items: '{{ SEAFILE_INIT_SCRIPTS }}' 29 | notify: 30 | - systemd_reload 31 | - restart_seafile 32 | 33 | - name: provision upstart script 34 | template: 35 | src: init/seafile.conf 36 | dest: /etc/init/seafile.conf 37 | owner: root 38 | group: root 39 | mode: 0644 40 | when: ansible_service_mgr == "upstart" 41 | notify: restart_seafile 42 | 43 | - name: enable init services 44 | service: 45 | name: '{{ item.name }}' 46 | enabled: yes 47 | when: ansible_os_family in item.os_family 48 | with_items: '{{ SEAFILE_INIT_SCRIPTS }}' 49 | notify: restart_seafile 50 | 51 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include: 1_prerequisites.yml 3 | tags: 4 | - seafile_prerequisites 5 | 6 | - include: 2_provision.yml 7 | tags: 8 | - seafile_provision 9 | 10 | - include: 3_download.yml 11 | tags: 12 | - seafile_download 13 | 14 | - include: 4_preconfigure.yml 15 | tags: 16 | - seafile_preconfigure 17 | - seafile_configure 18 | 19 | - include: 5_configure.yml 20 | tags: 21 | - seafile_configure 22 | 23 | - include: 6_customize.yml 24 | tags: 25 | - seafile_customize 26 | 27 | - include: 7_database.yml 28 | tags: 29 | - seafile_database 30 | 31 | - include: 8_init_admin.yml 32 | tags: 33 | - seafile_init_admin 34 | 35 | - include: 9_init.yml 36 | tags: 37 | - seafile_init 38 | 39 | - debug: 40 | msg: > 41 | If you upgraded seafile, please verify if you need to run some upgrade scripts manually. 42 | Have a look at the scripts in {{ seafile_latest_dir }}/upgrade 43 | and see http://manual.seafile.com/deploy/upgrade.html 44 | tags: 45 | - seafile 46 | -------------------------------------------------------------------------------- /templates/bin/environment: -------------------------------------------------------------------------------- 1 | ## {{ansible_managed}} 2 | 3 | {% for var in SEAFILE_ENVIRONMENT|dictsort %} 4 | export {{ var[0] }}="{{ var[1] }}" 5 | {% endfor %} 6 | 7 | ## {{ansible_managed}} 8 | -------------------------------------------------------------------------------- /templates/bin/garbage-collect: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | on_exit() { 4 | sleep 5 5 | {{ seafile_latest_dir }}/seafile.sh start 6 | } 7 | trap on_exit TERM KILL EXIT 8 | 9 | {{ seafile_latest_dir }}/seafile.sh stop 10 | if [ $? -eq 0 ] 11 | then 12 | sleep 30 13 | {{ seafile_latest_dir }}/seaf-gc.sh 14 | fi 15 | 16 | -------------------------------------------------------------------------------- /templates/bin/init_admin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #coding: UTF-8 4 | 5 | # {{ ansible_managed }} 6 | 7 | import check_init_admin 8 | import os 9 | import sys 10 | import subprocess 11 | 12 | def main(): 13 | subprocess.call(["{{ seafile_latest_dir }}/seafile.sh", "start"]) 14 | if check_init_admin.need_create_admin(): 15 | check_init_admin.create_admin('{{ seafile_seahub_admin_email }}', '{{ seafile_seahub_admin_password }}') 16 | else: 17 | print "changed=false" 18 | subprocess.call(["{{ seafile_latest_dir }}/seafile.sh", "stop"]) 19 | 20 | if __name__ == '__main__': 21 | try: 22 | main() 23 | except KeyboardInterrupt: 24 | print '\n\n\n' 25 | print 'Aborted.' 26 | print 27 | sys.exit(1) 28 | except Exception, e: 29 | print 30 | print 'Error happened during creating seafile admin:' 31 | print e 32 | print 33 | sys.exit(1) 34 | -------------------------------------------------------------------------------- /templates/ccnet/seafile.ini: -------------------------------------------------------------------------------- 1 | {{ seafile_data_dir }} 2 | -------------------------------------------------------------------------------- /templates/conf/ccnet.conf: -------------------------------------------------------------------------------- 1 | [General] 2 | USER_NAME = {{ seafile_user }} 3 | ID = {{ _seafile_ccnet_ID.stdout }} 4 | NAME = {{ seafile_org_name }} 5 | SERVICE_URL = {{ seafile_service_url }} 6 | 7 | [Network] 8 | PORT = {{ seafile_ccnet_port }} 9 | 10 | [Client] 11 | PORT = 13418 12 | 13 | {% if seafile_backend in SEAFILE_EXTERNAL_BACKENDS %} 14 | [Database] 15 | ENGINE = {{ seafile_backend }} 16 | HOST = {{ seafile_db_host }} 17 | PORT = {{ seafile_db_port }} 18 | USER = {{ seafile_db_user }} 19 | PASSWD = {{ seafile_db_pass }} 20 | DB = {{ seafile_db_name.ccnet }} 21 | CONNECTION_CHARSET=utf8 22 | 23 | {% endif %} 24 | 25 | {% if seafile_ldap is defined %} 26 | [LDAP] 27 | HOST = {{ seafile_ldap.host }} 28 | BASE = {{ seafile_ldap.base }} 29 | USER_DN = {{ seafile_ldap.user_dn }} 30 | PASSWORD = {{ seafile_ldap.password }} 31 | LOGIN_ATTR = {{ seafile_ldap.login_attr }} 32 | 33 | {% endif %} 34 | -------------------------------------------------------------------------------- /templates/conf/gunicorn.conf: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | daemon = True 4 | workers = 5 5 | 6 | # default localhost:8000 7 | bind = "0.0.0.0:{{ seafile_gunicorn_port }}" 8 | 9 | # Pid 10 | pids_dir = '{{ seafile_org_dir + "/pids" }}' 11 | pidfile = os.path.join(pids_dir, 'seahub.pid') 12 | 13 | # Logging 14 | logs_dir = '{{ seafile_log_dir }}' 15 | errorlog = os.path.join(logs_dir, 'gunicorn_error.log') 16 | accesslog = os.path.join(logs_dir, 'gunicorn_access.log') 17 | 18 | # for file upload, we need a longer timeout value (default is only 30s, too short) 19 | timeout = 1200 20 | 21 | limit_request_line = 8190 22 | -------------------------------------------------------------------------------- /templates/conf/seafdav.conf: -------------------------------------------------------------------------------- 1 | [WEBDAV] 2 | enabled = {% if seafile_webdav_enabled %}true 3 | {% else %}false 4 | {% endif %} 5 | port = {{ seafile_webdav_port }} 6 | fastcgi = {% if seafile_webdav_fastcgi %}true 7 | {% else %}false 8 | {% endif %} 9 | share_name = {{ seafile_webdav_path }} 10 | -------------------------------------------------------------------------------- /templates/conf/seafile.conf: -------------------------------------------------------------------------------- 1 | [network] 2 | # tcp port for httpserver 3 | port = {{ seafile_seafile_port }} 4 | 5 | [fileserver] 6 | port = {{ seafile_httpserver_port }} 7 | 8 | # Set maximum upload file size in MB. 9 | {% if not seafile_max_upload_size_enable %}#{% endif %} 10 | max_upload_size = {{ seafile_max_upload_size }} 11 | 12 | # Set maximum download directory size in MB. 13 | {% if not seafile_max_download_dir_size_enable %}#{% endif %} 14 | max_download_dir_size = {{ seafile_max_download_dir_size }} 15 | 16 | [quota] 17 | # default user quota in GB, integer only 18 | {% if not seafile_quota_enable %}#{% endif %} 19 | default = {{ seafile_quota_default }} 20 | 21 | [history] 22 | # If you don't want to keep all file revision history, you may set a default 23 | # history length limit for all libraries. 24 | {% if seafile_history_keepall %}#{% endif %} 25 | keep_days = {{ seafile_history_keep_days }} 26 | 27 | {% if seafile_backend in SEAFILE_EXTERNAL_BACKENDS %} 28 | [database] 29 | type = {{ seafile_backend }} 30 | host = {{ seafile_db_host }} 31 | port = {{ seafile_db_port }} 32 | user = {{ seafile_db_user }} 33 | password = {{ seafile_db_pass }} 34 | db_name = {{ seafile_db_name.seafile }} 35 | CONNECTION_CHARSET=utf8 36 | 37 | {% endif %} 38 | 39 | -------------------------------------------------------------------------------- /templates/conf/seahub_settings.py: -------------------------------------------------------------------------------- 1 | # secret key 2 | SECRET_KEY = "{{ _seafile_seahub_settings_secret_key.stdout }}" 3 | 4 | ## email settings 5 | 6 | {% if not seafile_email_enable %}#{% endif %} 7 | EMAIL_USE_TLS = {{ seafile_email_use_tls }} 8 | {% if not seafile_email_enable %}#{% endif %} 9 | EMAIL_HOST = '{{ seafile_email_host }}' 10 | {% if not seafile_email_enable %}#{% endif %} 11 | EMAIL_HOST_USER = '{{ seafile_email_user }}' 12 | {% if not seafile_email_enable %}#{% endif %} 13 | EMAIL_HOST_PASSWORD = '{{ seafile_email_password }}' 14 | {% if not seafile_email_enable %}#{% endif %} 15 | EMAIL_PORT = {{ seafile_email_port }} 16 | {% if not seafile_email_enable %}#{% endif %} 17 | DEFAULT_FROM_EMAIL = '{{ seafile_default_from_email }}' 18 | {% if not seafile_email_enable %}#{% endif %} 19 | SERVER_EMAIL = '{{ seafile_server_email }}' 20 | 21 | 22 | HTTP_SERVER_ROOT = 'https://{{ seafile_ip_or_domain }}/seafhttp' 23 | 24 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name 25 | # although not all choices may be available on all operating systems. 26 | # If running in a Windows environment this must be set to the same as your 27 | # system time zone. 28 | TIME_ZONE = '{{ seafile_time_zone }}' 29 | 30 | # Set this to seahub website's URL. This URL is contained in email notifications. 31 | SITE_BASE = '{{ seafile_site_base }}' 32 | 33 | # Set this to your website's name. This is contained in email notifications. 34 | SITE_NAME = '{{ seafile_site_name }}' 35 | 36 | # Set seahub website's title 37 | SITE_TITLE = '{{ seafile_site_title }}' 38 | 39 | # If you don't want to run seahub website on your site's root path, set this 40 | # option to your preferred path. 41 | # e.g. setting it to '/seahub/' would run seahub on http://example.com/seahub/. 42 | SITE_ROOT = '{{ seafile_site_root }}' 43 | 44 | # Whether to use pdf.js to view pdf files online. Default is `True`, you can 45 | # turn it off. 46 | # NOTE: since version 1.4. 47 | USE_PDFJS = {{ seafile_use_pdfjs }} 48 | 49 | # Enalbe or disalbe registration on web. Default is `False`. 50 | # NOTE: since version 1.4. 51 | ENABLE_SIGNUP = {{ seafile_enable_signup }} 52 | 53 | # Activate or deactivate user when registration complete. Default is `True`. 54 | # If set to `False`, new users need to be activated by admin in admin panel. 55 | # NOTE: since version 1.8 56 | ACTIVATE_AFTER_REGISTRATION = {{ seafile_activate_after_registration }} 57 | 58 | # Whether to send email when a system admin adding a new member. Default is 59 | # `True`. 60 | # NOTE: since version 1.4. 61 | SEND_EMAIL_ON_ADDING_SYSTEM_MEMBER = {{ seafile_send_email_on_adding_system_member }} 62 | 63 | # Whether to send email when a system admin resetting a user's password. 64 | # Default is `True`. 65 | # NOTE: since version 1.4. 66 | SEND_EMAIL_ON_RESETTING_USER_PASSWD = {{ seafile_send_email_on_resetting_user_passwd }} 67 | 68 | # Hide `Organization` tab. 69 | # If you want your private seafile behave exactly like 70 | # https://cloud.seafile.com/, you can set this flag. 71 | CLOUD_MODE = {{ seafile_cloud_mode }} 72 | 73 | # Online preview maximum file size, defaults to 30M. 74 | FILE_PREVIEW_MAX_SIZE = {{ seafile_file_preview_max_size }} 75 | 76 | # Age of cookie, in seconds (default: 2 weeks). 77 | SESSION_COOKIE_AGE = {{ seafile_session_cookie_age }} 78 | 79 | # Whether to save the session data on every request. 80 | SESSION_SAVE_EVERY_REQUEST = {{ seafile_session_save_every_request }} 81 | 82 | # Whether a user's session cookie expires when the Web browser is closed. 83 | SESSION_EXPIRE_AT_BROWSER_CLOSE = {{ seafile_session_expire_at_browser_close }} 84 | 85 | # Using server side crypto by default, otherwise, let user choose crypto method. 86 | FORCE_SERVER_CRYPTO = {{ seafile_force_server_crypto }} 87 | 88 | # Custom logo path 89 | {% if not seafile_logo_path %}#{% endif %} 90 | LOGO_PATH = '{{ seafile_logo_path }}' 91 | 92 | # Custom css path 93 | {% if not seafile_css_path %}#{% endif %} 94 | BRANDING_CSS = '{{ seafile_css_path }}' 95 | 96 | {% if seafile_backend in SEAFILE_EXTERNAL_BACKENDS %} 97 | # External Database settings 98 | DATABASES = { 99 | 'default': { 100 | 'ENGINE': 'django.db.backends.{{ seafile_backend }}', 101 | 'NAME' : '{{ seafile_db_name.seahub }}', 102 | 'USER' : '{{ seafile_db_user }}', 103 | 'PASSWORD' : '{{ seafile_db_pass }}', 104 | 'HOST' : '{{ seafile_db_host }}', 105 | 'PORT' : '{{ seafile_db_port }}' 106 | } 107 | } 108 | 109 | {% endif %} 110 | # For security consideration, please set to match the host/domain of your site, 111 | # e.g., ALLOWED_HOSTS = ['.example.com']. 112 | # Please refer to 113 | # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts for 114 | # details. 115 | {% if not seafile_allowed_hosts %}#{% endif %} 116 | ALLOWED_HOSTS = {{ seafile_allowed_hosts }} 117 | 118 | -------------------------------------------------------------------------------- /templates/init/seafile.conf: -------------------------------------------------------------------------------- 1 | # {{ ansible_managed }} 2 | 3 | {% if seafile_backend == 'sqlite' %} 4 | start on (runlevel [2345]) 5 | {% elif seafile_backend == 'mysql' and (seafile_db_host == 'localhost' or seafile_db_host == '127.0.0.1' or seafile_db_host == '::1') %} 6 | start on (started mysql and runlevel [2345]) 7 | {% endif %} 8 | stop on (runlevel [016]) 9 | 10 | pre-start script 11 | /etc/init.d/seafile start 12 | end script 13 | 14 | post-stop script 15 | /etc/init.d/seafile stop 16 | end script 17 | -------------------------------------------------------------------------------- /templates/init/seafile.initd.Debian: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # {{ ansible_managed }} 4 | 5 | ### BEGIN INIT INFO 6 | # Provides: seafile-server 7 | # Required-Start: $local_fs $remote_fs $network{% if seafile_backend == 'mysql' and (seafile_db_host == 'localhost' or seafile_db_host == '127.0.0.1' or seafile_db_host == '::1') %} mysql{% endif %} 8 | 9 | # Required-Stop: $local_fs 10 | # Default-Start: 2 3 4 5 11 | # Default-Stop: 0 1 6 12 | # Short-Description: Starts Seafile Server 13 | # Description: starts Seafile Server 14 | ### END INIT INFO 15 | 16 | 17 | user={{ seafile_user }} 18 | seafile_dir={{ seafile_org_dir }} 19 | script_path={{ seafile_latest_dir }} 20 | seafile_init_log={{ seafile_log_dir }}/seafile.init.log 21 | seahub_init_log={{ seafile_log_dir }}/seahub.init.log 22 | fastcgi={% if seafile_fastcgi_enabled %}true 23 | {% else %}false 24 | {% endif %} 25 | fastcgi_port={{ seafile_fastcgi_port }} 26 | 27 | case "$1" in 28 | start) 29 | sudo -u ${user} ${script_path}/seafile.sh start >> ${seafile_init_log} 30 | if [ $fastcgi = true ]; 31 | then 32 | sudo -u ${user} ${script_path}/seahub.sh start-fastcgi ${fastcgi_port} >> ${seahub_init_log} 33 | else 34 | sudo -u ${user} ${script_path}/seahub.sh start >> ${seahub_init_log} 35 | fi 36 | ;; 37 | restart) 38 | sudo -u ${user} ${script_path}/seafile.sh restart >> ${seafile_init_log} 39 | if [ $fastcgi = true ]; 40 | then 41 | sudo -u ${user} ${script_path}/seahub.sh restart-fastcgi ${fastcgi_port} >> ${seahub_init_log} 42 | else 43 | sudo -u ${user} ${script_path}/seahub.sh restart >> ${seahub_init_log} 44 | fi 45 | ;; 46 | stop) 47 | sudo -u ${user} ${script_path}/seafile.sh $1 >> ${seafile_init_log} 48 | sudo -u ${user} ${script_path}/seahub.sh $1 >> ${seahub_init_log} 49 | ;; 50 | *) 51 | echo "Usage: /etc/init.d/seafile {start|stop|restart}" 52 | exit 1 53 | ;; 54 | esac 55 | -------------------------------------------------------------------------------- /templates/init/seafile.initd.RedHat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # seafile 4 | 5 | # {{ ansible_managed }} 6 | 7 | # 8 | # chkconfig: - 68 32 9 | # description: seafile 10 | 11 | # Source function library. 12 | . /etc/init.d/functions 13 | 14 | # Source networking configuration. 15 | . /etc/sysconfig/network 16 | 17 | if [ -f /etc/sysconfig/seafile ];then 18 | . /etc/sysconfig/seafile 19 | else 20 | echo "Config file /etc/sysconfig/seafile not found! Bye." 21 | exit 200 22 | fi 23 | 24 | RETVAL=0 25 | 26 | start() { 27 | # Start daemons. 28 | echo -n $"Starting seafile: " 29 | ulimit -n 30000 30 | su - ${user} -c"${script_path}/seafile.sh start >> ${seafile_init_log} 2>&1" 31 | RETVAL=$? 32 | echo 33 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/seafile 34 | return $RETVAL 35 | } 36 | 37 | stop() { 38 | echo -n $"Shutting down seafile: " 39 | su - ${user} -c"${script_path}/seafile.sh stop >> ${seafile_init_log} 2>&1" 40 | RETVAL=$? 41 | echo 42 | [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/seafile 43 | return $RETVAL 44 | } 45 | 46 | # See how we were called. 47 | case "$1" in 48 | start) 49 | start 50 | ;; 51 | stop) 52 | stop 53 | ;; 54 | restart|reload) 55 | stop 56 | start 57 | RETVAL=$? 58 | ;; 59 | *) 60 | echo $"Usage: $0 {start|stop|restart}" 61 | RETVAL=3 62 | esac 63 | 64 | exit $RETVAL 65 | -------------------------------------------------------------------------------- /templates/init/seafile.sysconfig: -------------------------------------------------------------------------------- 1 | # {{ ansible_managed }} 2 | 3 | user={{ seafile_user }} 4 | seafile_dir={{ seafile_org_dir }} 5 | script_path={{ seafile_latest_dir }} 6 | seafile_init_log={{ seafile_log_dir }}/seafile.init.log 7 | seahub_init_log={{ seafile_log_dir }}/seahub.init.log 8 | fastcgi={% if seafile_fastcgi_enabled %}true 9 | {% else %}false 10 | {% endif %} 11 | fastcgi_port={{ seafile_fastcgi_port }} 12 | 13 | -------------------------------------------------------------------------------- /templates/init/seahub.initd.RedHat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # seahub 4 | 5 | # {{ ansible_managed }} 6 | 7 | # 8 | # chkconfig: - 69 31 9 | # description: seahub 10 | 11 | # Source function library. 12 | . /etc/init.d/functions 13 | 14 | # Source networking configuration. 15 | . /etc/sysconfig/network 16 | 17 | if [ -f /etc/sysconfig/seafile ];then 18 | . /etc/sysconfig/seafile 19 | else 20 | echo "Config file /etc/sysconfig/seafile not found! Bye." 21 | exit 200 22 | fi 23 | 24 | RETVAL=0 25 | 26 | start() { 27 | # Start daemons. 28 | echo -n $"Starting seahub: " 29 | ulimit -n 30000 30 | if [ $fastcgi = true ]; 31 | then 32 | su - ${user} -c"${script_path}/seahub.sh start-fastcgi ${fastcgi_port} >> ${seahub_init_log} 2>&1" 33 | else 34 | su - ${user} -c"${script_path}/seahub.sh start >> ${seahub_init_log} 2>&1" 35 | fi 36 | RETVAL=$? 37 | echo 38 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/seahub 39 | return $RETVAL 40 | } 41 | 42 | stop() { 43 | echo -n $"Shutting down seahub: " 44 | su - ${user} -c"${script_path}/seahub.sh stop >> ${seahub_init_log} 2>&1" 45 | RETVAL=$? 46 | echo 47 | [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/seahub 48 | return $RETVAL 49 | } 50 | 51 | # See how we were called. 52 | case "$1" in 53 | start) 54 | start 55 | ;; 56 | stop) 57 | stop 58 | ;; 59 | restart|reload) 60 | stop 61 | start 62 | RETVAL=$? 63 | ;; 64 | *) 65 | echo $"Usage: $0 {start|stop|restart}" 66 | RETVAL=3 67 | esac 68 | 69 | exit $RETVAL 70 | -------------------------------------------------------------------------------- /templates/systemd/seafile.service: -------------------------------------------------------------------------------- 1 | # {{ ansible_managed }} 2 | 3 | [Unit] 4 | Description=Seafile 5 | After=network.target {% if seafile_backend != 'sqlite' and seafile_db_host == '127.0.0.1' %} {{ seafile_backend }}.service {% endif %} 6 | 7 | [Service] 8 | Type=oneshot 9 | ExecStart={{ seafile_org_dir }}/seafile-server-latest/seafile.sh start 10 | ExecStop={{ seafile_org_dir }}/seafile-server-latest/seafile.sh stop 11 | RemainAfterExit=yes 12 | User={{ seafile_user }} 13 | Group=seafile 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /templates/systemd/seahub.service: -------------------------------------------------------------------------------- 1 | # {{ ansible_managed }} 2 | 3 | [Unit] 4 | Description=Seafile hub 5 | After=network.target seafile.service 6 | 7 | [Service] 8 | # change start to start-fastcgi if you want to run fastcgi 9 | ExecStart={{ seafile_org_dir }}/seafile-server-latest/seahub.sh start 10 | ExecStop={{ seafile_org_dir }}/seafile-server-latest/seahub.sh stop 11 | User={{ seafile_user }} 12 | Group=seafile 13 | Type=oneshot 14 | RemainAfterExit=yes 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | min_ansible_version: 1.9 3 | SEAFILE_SUPPORTED_DISTRIBUTIONS: 4 | - 'Ubuntu' 5 | - 'Debian' 6 | - 'CentOS' 7 | SEAFILE_SUPPORTED_VERSIONS: 8 | - '5.0' 9 | - '5.1' 10 | - '6.0' 11 | - '6.1' 12 | - '6.2' 13 | - '6.3' 14 | SEAFILE_SUPPORTED_BACKENDS: 15 | - 'sqlite' 16 | - 'mysql' 17 | #- 'postgresql' 18 | SEAFILE_EXTERNAL_BACKENDS: > 19 | {{ SEAFILE_SUPPORTED_BACKENDS|difference(['sqlite']) }} 20 | SEAFILE_INIT_SCRIPTS: 21 | - name: 'seafile' 22 | os_family: 23 | - 'Debian' 24 | - 'RedHat' 25 | - name: 'seahub' 26 | os_family: 27 | - 'RedHat' 28 | 29 | DEPENDENCY_PACKAGES_APT: 30 | - python-setuptools 31 | - python-simplejson 32 | - python-pil 33 | - python-mysqldb 34 | - python-requests 35 | - sqlite 36 | - rsync 37 | - sudo 38 | DEPENDENCY_PACKAGES_RPM: 39 | - python2.6-setuptools 40 | - python2.6-simplejson 41 | - python2.6-imaging 42 | - MYSQL-python 43 | - sqlite 44 | - rsync 45 | - sudo 46 | 47 | SEAFILE_ENVIRONMENT: 48 | LD_LIBRARY_PATH: '{{ seafile_latest_dir }}/seafile/lib/:{{ seafile_latest_dir }}/seafile/lib64:${LD_LIBRARY_PATH}' 49 | PYTHONPATH: '{{ seafile_latest_dir }}/seafile/lib/python2.6/site-packages:{{ seafile_latest_dir }}/seafile/lib64/python2.6/site-packages:{{ seafile_latest_dir }}/seahub/thirdpart:{{ seafile_latest_dir }}/seafile/lib/python2.7/site-packages:{{ seafile_latest_dir }}/seafile/lib64/python2.7/site-packages:{{ ansible_env.PYTHONPATH | default("") }}' 50 | CCNET_CONF_DIR: '{{ seafile_ccnet_dir }}' 51 | SEAFILE_CONF_DIR: '{{ seafile_data_dir }}' 52 | SEAFILE_CENTRAL_CONF_DIR: '{{ seafile_conf_dir }}' 53 | 54 | SEAFILE_CCNET_INIT: '{{ seafile_latest_dir }}/seafile/bin/ccnet-init' 55 | SEAFILE_SERVER_INIT: '{{ seafile_latest_dir }}/seafile/bin/seaf-server-init' 56 | SEAFILE_SECRET_KEYGEN: 'python {{ seafile_latest_dir }}/seahub/tools/secret_key_generator.py' 57 | SEAFILE_MANAGEPY: 'python {{ seafile_latest_dir }}/seahub/manage.py' 58 | SEAFILE_AVATAR_SRC: '{{ seafile_seahubdata_dir }}/avatars' 59 | SEAFILE_AVATAR_DEST: '{{ seafile_latest_dir }}/seahub/media/avatars' 60 | SEAFILE_DOCS_SRC: '{{ seafile_latest_dir }}/seafile/docs' 61 | SEAFILE_DOCS_DEST: '{{ seafile_data_dir }}/library-template' 62 | 63 | # moved to vars, seems hardcoded in seafile scripts 64 | seafile_log_dir: '{{ seafile_org_dir + "/logs" }}' 65 | 66 | --------------------------------------------------------------------------------