Compare commits
39 Commits
main
...
prod-7_6_x
| Author | SHA1 | Date | |
|---|---|---|---|
| e3c2e8024b | |||
| 2ae12c8e28 | |||
| 58ad5fa2f7 | |||
| c02c8d69da | |||
| 0d43ce4c70 | |||
| 172d3bb9fd | |||
| 75999aed6c | |||
| 8b9bfa6deb | |||
| 85e6d34016 | |||
| c1f3ff33dc | |||
| bce349330d | |||
| 4f634b61f3 | |||
| af1424f4c8 | |||
| 5f2e545fed | |||
| 24dc849936 | |||
| 4a567c9c00 | |||
| dba5f6d8ce | |||
| 8d6a243787 | |||
| c27934f28e | |||
| 8242255268 | |||
| 7831d88749 | |||
| f903333aee | |||
| 69cf72ca9b | |||
| 5bd7a40284 | |||
| 79b7c2d112 | |||
| 003d8e7fbf | |||
| fdca04f5b8 | |||
| d3e324c40b | |||
| 9e4dae7624 | |||
| c7a950afb6 | |||
| 9b02160937 | |||
| d65c8f9470 | |||
| 226c2a6ecf | |||
| 0d0848cdef | |||
|
|
07c38103f3 | ||
|
|
97eb39b1e5 | ||
| 2783691f0d | |||
| d87661c3e2 | |||
| 717cc11a03 |
816
LICENSE
816
LICENSE
@@ -1,235 +1,661 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
|
||||
1. Source Code.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
sprpcb
|
||||
Copyright (C) 2026 sysadmin
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <http://www.gnu.org/licenses/>.
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
75
README.md
75
README.md
@@ -1,31 +1,66 @@
|
||||
# sprpcb
|
||||
# SPRPCB para producción
|
||||
|
||||
Sistema Plurinacional de Registro del Patrimonio Cultural Boliviano
|
||||
# Implementación en servidor web público Arches versión 7.6.x
|
||||
|
||||
## 1. Prerrequisitos
|
||||
* Tener un nombre de dominio.
|
||||
* Servidor con una dirección IP pública.
|
||||
* Apuntar el dominio al servidor con un registro tipo A
|
||||
* Docker y Docker Compose están instalados.
|
||||
* Clonar el repositorio:
|
||||
|
||||
```bash
|
||||
git clone -b prod-7_6_x https://gitea.patrimonio.org.bo/sysadmin/sprpcb.git avd-prod
|
||||
```
|
||||
|
||||
# Nginx y Let’s Encrypt con Docker Compose
|
||||
## 2. Preparar la configuración para la instalación inicial
|
||||
|
||||
Este enfoque obtiene y renueva automáticamente los certificados TLS [Let's Encrypt](https://letsencrypt.org/) y configura el acceso HTTPS en Nginx para su dominio.
|
||||
|
||||
Hay 3 contenedores que trabajan para ello utilizando docker compose:
|
||||
|
||||
* Nginx, genera certificados autofirmados "dummy" para obtener los certificados de Let's Encrypt
|
||||
* Certbot - obtiene y renueva los certificados, espera hasta que Nginx esté listo para obtener los certificados
|
||||
* Cron - cada día renueva los certificados, si verifica que están vencidos, arranca Cerbot para renovarlos, luego reinicia Nginx
|
||||
|
||||
Para personalizar el manejo de certificados debe cambiar estos parámetros en el archivo `.env`. Por ejemplo:
|
||||
```shell
|
||||
# crear volúmenes de docker para el manejo de certificados SSL/TLS
|
||||
docker volume create --name=logs_nginx
|
||||
docker volume create --name=nginx_ssl
|
||||
docker volume create --name=certbot_certs
|
||||
docker volume create --name=arches_certbot
|
||||
# Configuración de docker
|
||||
cd ./avd-prod
|
||||
cp edit_dot_env .env
|
||||
# Personalizar el archivo .env
|
||||
vi .env # o nano .env
|
||||
```
|
||||
## 3. Configuración básica de .env
|
||||
|
||||
```properties
|
||||
DOMAINS=patrimonio.org.bo
|
||||
CERTBOT_EMAILS=admin@patrimonio.org.bo info@patrimonio.org.bo
|
||||
COMPOSE_PROJECT_NAME=sprpcb_prod
|
||||
DOMAINS=sprpcb.patrimonio.org.bo
|
||||
CERTBOT_EMAILS=sysadmin@patrimonio.org.bo
|
||||
CERTBOT_TEST_CERT=0
|
||||
CERTBOT_RSA_KEY_SIZE=4096
|
||||
```
|
||||
## 4. Construir imágenes, arrancar y detener contenedores
|
||||
|
||||
```bash
|
||||
docker compose up --build
|
||||
```
|
||||
|
||||
Configuration parameters:
|
||||
Detener y eliminar los contenedores:
|
||||
|
||||
* `DOMAINS` - lista de dominios separadas por espacio para el manejo de certificados
|
||||
* `CERTBOT_EMAILS` - lista de emails separada por espacios para los dominios correspondientes. Si no se especifica, el sistema trabajara con el parámetro `--register-unsafely-without-email`
|
||||
* `CERTBOT_TEST_CERT` - usa el servidor de prueba de Let's Encrypt staging (`--test-cert`)
|
||||
```bash
|
||||
docker compose down
|
||||
```
|
||||
|
||||
Let's Encrypt tiene límites de velocidad. Por lo tanto, durante las pruebas es mejor usar un servidor de prueba configurando `CERTBOT_TEST_CERT=1` (valor predeterminado). Cuando esté listo para usar el servidor Let's Encrypt de producción,t `CERTBOT_TEST_CERT=0`.
|
||||
Arrancar y detener (Start, Stop) los contenedores:
|
||||
|
||||
```bash
|
||||
docker compose start
|
||||
docker compose stop
|
||||
```
|
||||
## Cómo crear comandos de administración de Arches
|
||||
Además de configurar HTTPS y Nginx, este repositorio implementa una instancia de Arches.
|
||||
Al inicio, se configura una instancia de Arches "vacía". Se deberá cargar con datos propios mediante la instalación de un paquete o algún otro método.
|
||||
Una vez implementada Arches, puedes usar los comandos de administración habituales de Arches desde el servidor. Por ejemplo:
|
||||
```bash
|
||||
docker exec -it arches python manage.py makemigrations
|
||||
docker exec -it arches python manage.py migrate
|
||||
```
|
||||
|
||||
# Créditos
|
||||
SPRPCB es un desarrollo de [ArchesProject](https://www.archesproject.org/) y para este proyecto, se emplea el modelo de implementación de [OpenContext](https://github.com/opencontext/arches-via-docker)
|
||||
249
arches/Dockerfile
Normal file
249
arches/Dockerfile
Normal file
@@ -0,0 +1,249 @@
|
||||
FROM ubuntu:22.04
|
||||
# Start with Ubuntu 22
|
||||
|
||||
USER root
|
||||
|
||||
# Set environment variables to make installations non-interactive
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ="America/La_Paz"
|
||||
|
||||
# Update package lists and install basic packages first
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
wget \
|
||||
gnupg \
|
||||
lsb-release \
|
||||
software-properties-common \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Add Python 3.12 repository and install Python packages
|
||||
RUN add-apt-repository ppa:deadsnakes/ppa \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
python3.12 \
|
||||
python3.12-dev \
|
||||
python3.12-venv \
|
||||
python3-pip \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
make \
|
||||
gcc \
|
||||
build-essential \
|
||||
mime-support \
|
||||
libgdal-dev \
|
||||
dos2unix \
|
||||
nano \
|
||||
git \
|
||||
postgresql-client-14 \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# set environment variables
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
# Set up a virual environment to use for all later commands.
|
||||
RUN python3.12 -m venv /opt/venv \
|
||||
&& . /opt/venv/bin/activate \
|
||||
&& pip install --upgrade pip
|
||||
# Make sure we use the virtualenv:
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
## Setting default environment variables
|
||||
ARG ARCHES_ROOT
|
||||
# The name of the arches project
|
||||
ARG ARCHES_PROJECT
|
||||
# Project specific paths
|
||||
ARG APP_ROOT
|
||||
ARG APP_COMP_FOLDER
|
||||
ARG UPLOADED_FILES_FOLDER
|
||||
ARG ARCHES_PIP_VERSION
|
||||
|
||||
# settings_local.py provides the DB credentials, etc. to the Arches project.
|
||||
ENV SETTINGS_PATH=${APP_COMP_FOLDER}/settings.py
|
||||
ENV SETTINGS_LOCAL_PATH=${APP_COMP_FOLDER}/settings_local.py
|
||||
ENV CELERY_PATH=${APP_COMP_FOLDER}/celery.py
|
||||
ENV URLS_PATH=${APP_COMP_FOLDER}/urls.py
|
||||
ENV GUNICORN_CONFIG_PATH=${APP_COMP_FOLDER}/gunicorn_config.py
|
||||
ENV ARCHES_DATA=${ARCHES_ROOT}/arches_data
|
||||
ENV PACKAGE_PATH=${APP_COMP_FOLDER}/package.json
|
||||
ENV ESLINT_CONFIG_MJS_PATH_USE=${APP_ROOT}/eslint.config.mjs
|
||||
ENV UPLOADED_FILES_FOLDER=${UPLOADED_FILES_FOLDER}
|
||||
ENV WHEELS=/wheels
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
|
||||
# Setup needed directories
|
||||
RUN mkdir ${ARCHES_ROOT} && mkdir /var/log/supervisor && mkdir /var/log/celery
|
||||
|
||||
# Get ready to do some code installation
|
||||
RUN apt-get update && apt-get install -y make software-properties-common
|
||||
|
||||
# Install packages required to run Arches
|
||||
# Note that the ubuntu/debian package for libgdal1-dev pulls in libgdal1i, which is built
|
||||
# with everything enabled, and so, it has a huge amount of dependancies (everything that GDAL
|
||||
# support, directly and indirectly pulling in mysql-common, odbc, jp2, perl! ... )
|
||||
# a minimised build of GDAL could remove several hundred MB from the container layer.
|
||||
RUN set -ex \
|
||||
&& RUN_DEPS=" \
|
||||
build-essential \
|
||||
libxml2-dev \
|
||||
libproj-dev \
|
||||
libjson-c-dev \
|
||||
xsltproc \
|
||||
docbook-xsl \
|
||||
docbook-mathml \
|
||||
libgdal-dev \
|
||||
libpq-dev \
|
||||
mime-support \
|
||||
python3-dev \
|
||||
postgresql-client-14 \
|
||||
dos2unix \
|
||||
wait-for-it \
|
||||
nano \
|
||||
" \
|
||||
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
|
||||
&& curl -sL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql-keyring.gpg \
|
||||
&& echo "deb [signed-by=/usr/share/keyrings/postgresql-keyring.gpg] http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | tee /etc/apt/sources.list.d/postgresql.list \
|
||||
&& apt-get update -y \
|
||||
&& apt-get install -y --no-install-recommends $RUN_DEPS \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------
|
||||
# Do installs relating to Node
|
||||
# ----------------------------------------------
|
||||
|
||||
# Set environment variables
|
||||
ENV NODE_MAJOR=18
|
||||
|
||||
# Update package lists and install necessary packages
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
&& mkdir -p /etc/apt/keyrings
|
||||
|
||||
# Add nodesource GPG key
|
||||
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||
|
||||
# Add nodesource repository
|
||||
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
|
||||
&& apt-get update
|
||||
|
||||
# Install Node.js
|
||||
RUN apt-get install -y nodejs
|
||||
|
||||
# Clean up
|
||||
RUN apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
|
||||
|
||||
|
||||
WORKDIR ${ARCHES_ROOT}
|
||||
|
||||
RUN rm -rf /root/.cache/pip/*
|
||||
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install --force-reinstall -U setuptools
|
||||
|
||||
# Install the current stable release of the Arches application and make an Arches project.
|
||||
RUN pip install supervisor \
|
||||
&& pip install pytz --upgrade \
|
||||
&& pip install tzdata --upgrade \
|
||||
&& pip install Redis \
|
||||
&& pip install gunicorn \
|
||||
&& pip install boto3==1.26 \
|
||||
&& pip install django-storages==1.14.4 \
|
||||
&& pip install arches==${ARCHES_PIP_VERSION}
|
||||
|
||||
# create a new Arches project
|
||||
RUN mkdir -p /new_arches_proj
|
||||
RUN arches-admin startproject ${ARCHES_PROJECT} --directory /new_arches_proj
|
||||
RUN mv /new_arches_proj ${APP_ROOT}
|
||||
|
||||
# create the uploaded files folder
|
||||
RUN mkdir -p ${UPLOADED_FILES_FOLDER}
|
||||
|
||||
# copia de archivos de idioma es
|
||||
COPY ./arches/es /opt/venv/lib/python3.12/site-packages/arches/locale/es
|
||||
RUN echo 'archivos de idioma es copiados'
|
||||
|
||||
# copy in local settings to our newly created Arches project.
|
||||
WORKDIR ${APP_ROOT}
|
||||
COPY ./arches/settings_local.py ${SETTINGS_LOCAL_PATH}
|
||||
RUN sed -i 's/\r$//g' ${SETTINGS_LOCAL_PATH}
|
||||
# copy the celery.py file into out archaes project. This hopefully makes the workers and beat work:
|
||||
COPY ./arches/celery.py ${CELERY_PATH}
|
||||
RUN sed -i 's/\r$//g' ${CELERY_PATH}
|
||||
# copy the urls.py into our new Arches project. This is part of
|
||||
# customization for internationalization
|
||||
RUN echo "copied urls to ${URLS_PATH}";
|
||||
COPY ./arches/urls.py ${URLS_PATH}
|
||||
RUN sed -i 's/\r$//g' ${URLS_PATH}
|
||||
|
||||
# Copy the gunicorn_config.py file into our new Arches project. This is used
|
||||
# for running Arches in production (not DEBUG mode)
|
||||
# NOTE: We're NOT actually using this, because it will throw an error with urls.py
|
||||
# So this is here for reference only in case someone wants to edit gunicorn_config.py
|
||||
# and figure out how to make it work.
|
||||
RUN echo "copy gunicorn_config.py to ${GUNICORN_CONFIG_PATH}";
|
||||
COPY ./arches/gunicorn_config.py ${GUNICORN_CONFIG_PATH}
|
||||
RUN sed -i 's/\r$//g' ${GUNICORN_CONFIG_PATH}
|
||||
|
||||
# Copy customized package until the issue with datatables.net is resolved.
|
||||
# COPY ./arches/package.json ${PACKAGE_PATH}
|
||||
|
||||
# copy the celery supervisor
|
||||
COPY /arches/conf.d/ ${APP_ROOT}/conf.d/
|
||||
RUN chmod -R 700 ${APP_ROOT}/conf.d/
|
||||
COPY /arches/arches_proj-supervisor.conf ${APP_ROOT}/arches_proj-supervisor.conf
|
||||
RUN chmod -R 700 ${APP_ROOT}/arches_proj-supervisor.conf
|
||||
RUN mkdir -p /var/log/supervisor
|
||||
RUN mkdir -p /var/log/celery
|
||||
|
||||
# Now install NPM
|
||||
WORKDIR ${APP_ROOT}
|
||||
# RUN echo "NPM install....";
|
||||
# RUN npm install
|
||||
|
||||
# Set some settings to make NPM less fussy
|
||||
RUN npm config set cafile null
|
||||
RUN npm config set strict-ssl false
|
||||
|
||||
# remove any node_modules that might have been installed by the arches install
|
||||
RUN rm -rf ${APP_ROOT}/node_modules
|
||||
RUN rm -f ${APP_ROOT}/package-lock.json
|
||||
# Now do the NPM install
|
||||
RUN npm install
|
||||
|
||||
# Make sure the entry point is available and lacks weird characters
|
||||
# that don't work in a Linux OS
|
||||
COPY /arches/entrypoint.sh ${APP_ROOT}/entrypoint.sh
|
||||
RUN chmod -R 700 ${APP_ROOT}/entrypoint.sh &&\
|
||||
dos2unix ${APP_ROOT}/entrypoint.sh
|
||||
|
||||
|
||||
# Set default workdir
|
||||
WORKDIR ${APP_ROOT}
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
||||
CMD ["run_arches"]
|
||||
|
||||
|
||||
# Set default workdir
|
||||
WORKDIR ${APP_ROOT}
|
||||
# Expose port 8000 (Django server)
|
||||
EXPOSE 8000
|
||||
# Expose Webpack port
|
||||
EXPOSE 8021
|
||||
# Expose CouchDB port
|
||||
EXPOSE 5984
|
||||
4
arches/arches_data/README.md
Normal file
4
arches/arches_data/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# arches_data
|
||||
|
||||
This folder will be mounted into the `arches` container so that it will be easier to load packages and exchange other files with the running Arches instance.
|
||||
The `arches` container will expect to find a `packages` sub-directory inside the `arches_data` folder.
|
||||
29
arches/arches_proj-supervisor.conf
Normal file
29
arches/arches_proj-supervisor.conf
Normal file
@@ -0,0 +1,29 @@
|
||||
[unix_http_server]
|
||||
file=/tmp/supervisor.sock ; path to your socket file
|
||||
chmod=7770
|
||||
|
||||
[supervisord]
|
||||
logfile=/var/log/supervisor/supervisord.log ; supervisord log file
|
||||
logfile_maxbytes=50MB ; maximum size of logfile before rotation
|
||||
logfile_backups=10 ; number of backed up logfiles
|
||||
loglevel=info ; info, debug, warn, trace
|
||||
pidfile=/var/run/supervisord.pid ; pidfile location
|
||||
nodaemon=false ; run supervisord as a daemon
|
||||
minfds=1024 ; number of startup file descriptors
|
||||
minprocs=200 ; number of process descriptors
|
||||
user=root ; defaults to whichever user is runs supervisor
|
||||
childlogdir=/var/log/supervisor/ ; where child log files will live
|
||||
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl=unix:///tmp/supervisor.sock ; use unix:// schem for a unix sockets.
|
||||
|
||||
[include]
|
||||
files=./conf.d/arches_proj-celeryd.conf
|
||||
# While the above appears to work, and is needed for features like the Bulk
|
||||
# Data manager, I can't seem to get celerybeat to work as below:
|
||||
#
|
||||
# files=./conf.d/arches_proj-celeryd.conf ./conf.d/arches_proj-celerybeat.conf
|
||||
|
||||
10
arches/celery.py
Normal file
10
arches/celery.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
import os
|
||||
from celery import Celery
|
||||
|
||||
ARCHES_PROJECT = os.getenv('ARCHES_PROJECT')
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', f'{ARCHES_PROJECT}.settings')
|
||||
app = Celery(ARCHES_PROJECT)
|
||||
app.config_from_object('django.conf:settings', namespace='CELERY')
|
||||
app.autodiscover_tasks()
|
||||
22
arches/conf.d/arches_proj-celerybeat.conf
Normal file
22
arches/conf.d/arches_proj-celerybeat.conf
Normal file
@@ -0,0 +1,22 @@
|
||||
; ================================
|
||||
; celery beat supervisor
|
||||
; ================================
|
||||
|
||||
[program:celerybeat]
|
||||
command=python -m celery -A arches_proj.celery beat --schedule=/tmp/celerybeat-schedule --loglevel=INFO --pidfile=/tmp/celerybeat.pid
|
||||
directory=/arches_app/arches_proj
|
||||
|
||||
user=root
|
||||
numprocs=1
|
||||
stdout_logfile=/var/log/celery/beat.log
|
||||
stderr_logfile=/var/log/celery/beat.log
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startsecs=10
|
||||
|
||||
; Causes supervisor to send the termination signal (SIGTERM) to the whole process group.
|
||||
stopasgroup=true
|
||||
|
||||
; if rabbitmq is supervised, set its priority higher
|
||||
; so it starts first
|
||||
priority=999
|
||||
26
arches/conf.d/arches_proj-celeryd.conf
Normal file
26
arches/conf.d/arches_proj-celeryd.conf
Normal file
@@ -0,0 +1,26 @@
|
||||
; ==================================
|
||||
; celery worker supervisor
|
||||
; ==================================
|
||||
|
||||
[program:celery]
|
||||
command=python -m celery -A arches_proj worker -l INFO
|
||||
directory=/arches_app/arches_proj
|
||||
|
||||
user=root
|
||||
numprocs=1
|
||||
stdout_logfile=/var/log/celery/worker.log
|
||||
stderr_logfile=/var/log/celery/worker.log
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startsecs=10
|
||||
|
||||
; Need to wait for currently executing tasks to finish at shutdown.
|
||||
; Increase this if you have very long running tasks.
|
||||
stopwaitsecs = 600
|
||||
|
||||
; Causes supervisor to send the termination signal (SIGTERM) to the whole process group.
|
||||
stopasgroup=true
|
||||
|
||||
; Set Celery priority higher than default (999)
|
||||
; so, if rabbitmq is supervised, it will start first.
|
||||
priority=1000
|
||||
435
arches/entrypoint.sh
Normal file
435
arches/entrypoint.sh
Normal file
@@ -0,0 +1,435 @@
|
||||
#!/bin/bash
|
||||
|
||||
# APP and YARN folder locations
|
||||
APP_FOLDER=${APP_ROOT}
|
||||
APP_COMP_FOLDER=${APP_COMP_FOLDER}
|
||||
GUNICORN_CONFIG_PATH=${APP_COMP_FOLDER}/gunicorn_config.py
|
||||
STATIC_ROOT=/static_root
|
||||
STATIC_JS=${STATIC_ROOT}/js
|
||||
WEBPACK_STATS_PATH=${APP_FOLDER}/webpack-stats.json
|
||||
|
||||
# Environmental Variables
|
||||
export DJANGO_PORT=${DJANGO_PORT:-8000}
|
||||
COUCHDB_URL=${COUCHDB_URL}
|
||||
|
||||
#Utility functions that check db status
|
||||
wait_for_db() {
|
||||
echo "Testing if database server is up..."
|
||||
while [[ ! ${return_code} == 0 ]]
|
||||
do
|
||||
psql --host=${PGHOST} --port=${PGPORT} --user=${PGUSERNAME} --dbname=postgres -c "select 1" >&/dev/null
|
||||
return_code=$?
|
||||
sleep 1
|
||||
done
|
||||
echo "Database server is up"
|
||||
|
||||
echo "Testing if Elasticsearch is up..."
|
||||
while [[ ! ${return_code} == 0 ]]
|
||||
do
|
||||
curl -s "http://${ESHOST}:${ESPORT}/_cluster/health?wait_for_status=green&timeout=60s" >&/dev/null
|
||||
return_code=$?
|
||||
sleep 1
|
||||
done
|
||||
echo "Elasticsearch is up"
|
||||
}
|
||||
|
||||
db_exists() {
|
||||
echo "Checking if database "${PGDBNAME}" exists..."
|
||||
count=`psql --host=${PGHOST} --port=${PGPORT} --user=${PGUSERNAME} --dbname=postgres -Atc "SELECT COUNT(*) FROM pg_catalog.pg_database WHERE datname='${PGDBNAME}'"`
|
||||
|
||||
# Check if returned value is a number and not some error message
|
||||
re='^[0-9]+$'
|
||||
if ! [[ ${count} =~ $re ]] ; then
|
||||
echo "Error: Something went wrong when checking if database "${PGDBNAME}" exists..." >&2;
|
||||
echo "Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Return 0 (= true) if database exists
|
||||
if [[ ${count} > 0 ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#### Install
|
||||
init_arches() {
|
||||
echo "Checking if Arches project "${ARCHES_PROJECT}" exists..."
|
||||
if [[ ! -d ${APP_FOLDER} ]] || [[ ! "$(ls ${APP_FOLDER})" ]]; then
|
||||
echo ""
|
||||
echo "----- Custom Arches project '${ARCHES_PROJECT}' does not exist. -----"
|
||||
echo "----- Creating '${ARCHES_PROJECT}'... -----"
|
||||
echo ""
|
||||
|
||||
cd ${APP_FOLDER}
|
||||
echo "Sleep for a 45 seconds because elastic search seems to need the wait (a total hack)..."
|
||||
sleep 45s;
|
||||
arches-project create ${ARCHES_PROJECT}
|
||||
run_setup_db
|
||||
setup_couchdb
|
||||
|
||||
exit_code=$?
|
||||
if [[ ${exit_code} != 0 ]]; then
|
||||
echo "Something went wrong when creating your Arches project: ${ARCHES_PROJECT}."
|
||||
echo "Exiting..."
|
||||
exit ${exit_code}
|
||||
fi
|
||||
else
|
||||
echo "Custom Arches project '${ARCHES_PROJECT}' exists."
|
||||
wait_for_db
|
||||
if db_exists; then
|
||||
echo "Database ${PGDBNAME} already exists."
|
||||
echo "Skipping Package Loading"
|
||||
else
|
||||
echo "Database ${PGDBNAME} does not exists yet."
|
||||
run_setup_db
|
||||
run_elastic_safe_migrations
|
||||
setup_couchdb
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Setup Couchdb
|
||||
setup_couchdb() {
|
||||
echo "--- SKIP Creating couchdb system databases (not in V7, no Collector) ---"
|
||||
# echo "Sleep for a 10 seconds because elastic search seems to need the wait (a total hack)..."
|
||||
# sleep 10s;
|
||||
# curl -X PUT ${COUCHDB_URL}/_users
|
||||
# curl -X PUT ${COUCHDB_URL}/_global_changes
|
||||
# curl -X PUT ${COUCHDB_URL}/_replicator
|
||||
}
|
||||
|
||||
|
||||
#### Misc
|
||||
check_settings_local() {
|
||||
# Make sure we have a settings_local in the proper location of the project
|
||||
cd ${APP_COMP_FOLDER}
|
||||
echo "The directory ${APP_COMP_FOLDER} contains:"
|
||||
ls -l
|
||||
echo "---------------------------------------------------------------"
|
||||
}
|
||||
|
||||
#### Run commands
|
||||
start_celery_supervisor() {
|
||||
echo ""
|
||||
echo "----- START CELERY SUPERVISOR -----"
|
||||
echo ""
|
||||
echo "Sleep 60s in the hope that arches_redis will be fully up and running..."
|
||||
sleep 60s;
|
||||
if [ -f "/tmp/supervisor.sock" ]; then
|
||||
echo "The celery supervisor seems started, so why try to start it again? "
|
||||
else
|
||||
echo "The celery supervisor has yet to start, so we'll start it.."
|
||||
cd ${APP_FOLDER}
|
||||
wait-for-it arches_redis:6379 -t 120 && supervisord -c arches_proj-supervisor.conf
|
||||
fi
|
||||
}
|
||||
|
||||
run_createcachetable() {
|
||||
echo ""
|
||||
echo "----- RUNNING CREATE CACHETABLE -----"
|
||||
echo ""
|
||||
cd ${APP_FOLDER}
|
||||
python3 manage.py createcachetable
|
||||
}
|
||||
|
||||
run_elastic_safe_migrations() {
|
||||
echo ""
|
||||
echo "----- RUNNING DATABASE MIGRATIONS WITH ELASTIC CHECK -----"
|
||||
echo ""
|
||||
echo "Testing if Elasticsearch is up..."
|
||||
while [[ ! ${return_code} == 0 ]]
|
||||
do
|
||||
curl -s "http://${ESHOST}:${ESPORT}/_cluster/health?wait_for_status=green&timeout=60s" >&/dev/null
|
||||
return_code=$?
|
||||
sleep 1
|
||||
done
|
||||
echo "Elasticsearch is up"
|
||||
cd ${APP_FOLDER}
|
||||
echo "Sleep for a 20 seconds because elastic search seems to need the wait (a total hack)..."
|
||||
echo "We're running migrations in case the initial db setup failed because elasticsearch was still not quite ready"
|
||||
sleep 20s;
|
||||
echo "Now do Migrations..."
|
||||
python3 manage.py migrate
|
||||
}
|
||||
|
||||
run_make_migrations() {
|
||||
echo ""
|
||||
echo "----- RUNNING DATABASE MAKE MIGRATIONS -----"
|
||||
echo ""
|
||||
cd ${APP_FOLDER}
|
||||
python manage.py makemigrations
|
||||
}
|
||||
|
||||
run_migrations() {
|
||||
echo ""
|
||||
echo "----- RUNNING DATABASE MIGRATIONS -----"
|
||||
echo ""
|
||||
cd ${APP_FOLDER}
|
||||
python manage.py migrate
|
||||
}
|
||||
|
||||
run_es_reindex() {
|
||||
echo ""
|
||||
echo "----- RUNNING ELASTIC SEARCH (ES) REINDEX DATABASE -----"
|
||||
echo ""
|
||||
cd ${APP_FOLDER}
|
||||
python3 manage.py es reindex_database
|
||||
}
|
||||
|
||||
|
||||
run_collect_static() {
|
||||
echo ""
|
||||
echo "----- RUNNING COLLECT STATIC -----"
|
||||
echo ""
|
||||
if [[ ${BUILD_PRODUCTION} == 'True' ]]; then
|
||||
echo "Skipping collectstatic, hopefully buildproduction will do the trick..."
|
||||
else
|
||||
cd ${APP_FOLDER}
|
||||
python3 manage.py collectstatic --noinput
|
||||
fi
|
||||
echo "---------------------------------------------------------------"
|
||||
}
|
||||
|
||||
run_collect_static_nocheck() {
|
||||
echo ""
|
||||
echo "----- RUNNING COLLECT STATIC -----"
|
||||
echo ""
|
||||
cd ${APP_FOLDER}
|
||||
python3 manage.py collectstatic --noinput
|
||||
echo "---------------------------------------------------------------"
|
||||
}
|
||||
|
||||
run_build_production() {
|
||||
echo ""
|
||||
echo "----- RUNNING BUILD PRODUCTION -----"
|
||||
echo ""
|
||||
if [[ ${BUILD_PRODUCTION} == 'True' ]]; then
|
||||
# NOTE: Only do this if you have more than 8GB of system RAM. This will likely error out
|
||||
# otherwise.
|
||||
cd ${APP_FOLDER}
|
||||
exec sh -c "npm run build_development"
|
||||
else
|
||||
echo "Skipping buildproduction because BUILD_PRODUCTION is not 'True' "
|
||||
fi
|
||||
echo "---------------------------------------------------------------"
|
||||
}
|
||||
|
||||
|
||||
run_setup_arches_setup_webpack() {
|
||||
if [[ ! -d ${STATIC_JS} ]] || [[ ! "$(ls ${STATIC_JS})" ]]; then
|
||||
cd ${APP_FOLDER}
|
||||
echo "Starting Django development server"
|
||||
python manage.py runserver 0.0.0.0:8000 &
|
||||
echo "Running npm build and collectstatic"
|
||||
npm run build_development && python manage.py collectstatic --noinput
|
||||
else
|
||||
echo "Webpack and Collectstatic for setup already completed.";
|
||||
fi
|
||||
|
||||
RUNSERVER_PID=$(pgrep -f "manage.py runserver")
|
||||
if [ -n "$RUNSERVER_PID" ]; then
|
||||
echo "Killing manage.py runserver process with PID $RUNSERVER_PID"
|
||||
kill -9 $RUNSERVER_PID
|
||||
echo "Process $RUNSERVER_PID killed"
|
||||
else
|
||||
echo "No manage.py runserver process found"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
run_webpack() {
|
||||
echo ""
|
||||
echo "----- *** RUNNING WEBPACK SERVER *** -----"
|
||||
echo ""
|
||||
if [[ ${BUILD_PRODUCTION} == 'True' ]]; then
|
||||
# NOTE: Only do this if you have more than 8GB of system RAM. This will likely error out
|
||||
# otherwise.
|
||||
echo "Running Webpack, hopefully the build_production thing will work!"
|
||||
cd ${APP_FOLDER}
|
||||
exec sh -c "npm run build_production"
|
||||
else
|
||||
cd ${APP_FOLDER}
|
||||
echo "Do build_development."
|
||||
echo "Running Webpack to do the NPM build_development thing."
|
||||
exec sh -c "npm run build_development && python manage.py collectstatic --noinput"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
run_setup_webpack() {
|
||||
# NOTE: We're deprecating this in favor of run_setup_arches_setup_webpack.
|
||||
echo ""
|
||||
echo "----- *** RUNNING WEBPACK SERVER FOR SETUP *** -----"
|
||||
echo ""
|
||||
echo "Check if the Arches app responds to http requests..."
|
||||
while [[ ! ${return_code} == 0 ]]
|
||||
do
|
||||
curl -s "http://arches:8000" >&/dev/null
|
||||
return_code=$?
|
||||
sleep 5
|
||||
done
|
||||
echo "Arches app is now responding to http requests!"
|
||||
sleep 5
|
||||
# We're going to first check to see if we have anythin in the static_root/js folder.
|
||||
# If we do, then we've run this already and can skip webpack and collect static.
|
||||
if [[ ! -d ${STATIC_JS} ]] || [[ ! "$(ls ${STATIC_JS})" ]]; then
|
||||
echo "We (apparently) have yet to run webpack and collectstatic. Do it now!";
|
||||
run_webpack
|
||||
|
||||
else
|
||||
echo "Webpack and Collectstatic for setup already completed.";
|
||||
# exec sh -c "python manage.py collectstatic --noinput"
|
||||
fi
|
||||
}
|
||||
|
||||
run_list_static() {
|
||||
echo ""
|
||||
echo "----- VIEW COLLECTED STATIC -----"
|
||||
echo ""
|
||||
cd /static_root
|
||||
ls
|
||||
echo "---------------------------------------------------------------"
|
||||
}
|
||||
|
||||
run_setup_db() {
|
||||
echo ""
|
||||
echo "----- RUNNING SETUP_DB -----"
|
||||
echo ""
|
||||
echo "Testing if Elasticsearch is up..."
|
||||
while [[ ! ${return_code} == 0 ]]
|
||||
do
|
||||
curl -s "http://${ESHOST}:${ESPORT}/_cluster/health?wait_for_status=green&timeout=60s" >&/dev/null
|
||||
return_code=$?
|
||||
sleep 1
|
||||
done
|
||||
echo "Elasticsearch is up, pause for 10 secs to be sure."
|
||||
sleep 10s;
|
||||
echo "Now we should be safe to setup the database"
|
||||
cd ${APP_FOLDER}
|
||||
python3 manage.py setup_db --force
|
||||
}
|
||||
|
||||
run_load_package() {
|
||||
echo ""
|
||||
echo "----- *** LOADING PACKAGE: ${ARCHES_PROJECT} *** -----"
|
||||
echo ""
|
||||
cd ${APP_FOLDER}
|
||||
python3 manage.py packages -o load_package -s ${ARCHES_PROJECT}/pkg -db -dev -y
|
||||
}
|
||||
|
||||
run_django_server() {
|
||||
echo ""
|
||||
echo "----- *** RUNNING DJANGO DEVELOPMENT SERVER *** -----"
|
||||
echo ""
|
||||
cd ${APP_FOLDER}
|
||||
if [[ ${DJANGO_DEBUG} == 'True' ]]; then
|
||||
echo "Running DEBUG mode Django"
|
||||
exec sh -c "python3 manage.py runserver 0.0.0.0:${DJANGO_PORT}"
|
||||
else
|
||||
echo "Should run the production mode Arches Django via gunicorn via:"
|
||||
# The GUNICORN_CONFIG_PATH breaks this, (errors in urls.py) so we'll just run it directly
|
||||
# echo "gunicorn ${ARCHES_PROJECT}.wsgi:application --config ${GUNICORN_CONFIG_PATH}"
|
||||
# exec sh -c "gunicorn ${ARCHES_PROJECT}.wsgi:application --config ${GUNICORN_CONFIG_PATH}"
|
||||
echo "gunicorn -w 2 -b 0.0.0.0:${DJANGO_PORT} ${ARCHES_PROJECT}.wsgi:application --reload --timeout 3600"
|
||||
exec sh -c "gunicorn -w 2 -b 0.0.0.0:${DJANGO_PORT} ${ARCHES_PROJECT}.wsgi:application --reload --timeout 3600"
|
||||
fi
|
||||
}
|
||||
|
||||
#### Main commands
|
||||
run_arches() {
|
||||
init_arches
|
||||
run_elastic_safe_migrations
|
||||
run_createcachetable
|
||||
start_celery_supervisor
|
||||
run_setup_arches_setup_webpack
|
||||
run_django_server
|
||||
}
|
||||
|
||||
#### Main commands
|
||||
run_livereload() {
|
||||
run_livereload_server
|
||||
}
|
||||
|
||||
### Starting point ###
|
||||
|
||||
# trying not to use virtualenv???
|
||||
# activate_virtualenv
|
||||
|
||||
# Use -gt 1 to consume two arguments per pass in the loop
|
||||
# (e.g. each argument has a corresponding value to go with it).
|
||||
# Use -gt 0 to consume one or more arguments per pass in the loop
|
||||
# (e.g. some arguments don't have a corresponding value to go with it, such as --help ).
|
||||
|
||||
# If no arguments are supplied, assume the server needs to be run
|
||||
if [[ $# -eq 0 ]]; then
|
||||
wait_for_db
|
||||
run_arches
|
||||
fi
|
||||
|
||||
# Else, process arguments
|
||||
echo "Full command: $@"
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
echo "Command: ${key}"
|
||||
|
||||
case ${key} in
|
||||
run_arches)
|
||||
wait_for_db
|
||||
run_arches
|
||||
;;
|
||||
run_livereload)
|
||||
run_livereload_server
|
||||
;;
|
||||
run_collect_static)
|
||||
run_collect_static
|
||||
;;
|
||||
run_collect_static_nocheck)
|
||||
run_collect_static_nocheck
|
||||
;;
|
||||
run_list_static)
|
||||
run_list_static
|
||||
;;
|
||||
run_setup_arches_setup_webpack)
|
||||
run_setup_arches_setup_webpack
|
||||
;;
|
||||
run_setup_webpack)
|
||||
run_setup_webpack
|
||||
;;
|
||||
run_webpack)
|
||||
run_webpack
|
||||
;;
|
||||
run_build_production)
|
||||
run_build_production
|
||||
;;
|
||||
setup_arches)
|
||||
start_celery_supervisor
|
||||
wait_for_db
|
||||
setup_arches
|
||||
;;
|
||||
run_make_migrations)
|
||||
wait_for_db
|
||||
run_make_migrations
|
||||
;;
|
||||
run_migrations)
|
||||
wait_for_db
|
||||
run_migrations
|
||||
;;
|
||||
run_es_reindex)
|
||||
wait_for_db
|
||||
run_es_reindex
|
||||
;;
|
||||
help|-h)
|
||||
display_help
|
||||
;;
|
||||
*)
|
||||
cd ${APP_FOLDER}
|
||||
"$@"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
shift # next argument or value
|
||||
done
|
||||
BIN
arches/es/LC_MESSAGES/django.mo
Normal file
BIN
arches/es/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
6483
arches/es/LC_MESSAGES/django.po
Normal file
6483
arches/es/LC_MESSAGES/django.po
Normal file
File diff suppressed because it is too large
Load Diff
242
arches/gunicorn_config.py
Normal file
242
arches/gunicorn_config.py
Normal file
@@ -0,0 +1,242 @@
|
||||
# Copied from:
|
||||
# https://github.com/archesproject/arches/blob/dev/7.6.x/docker/gunicorn_config.py
|
||||
#
|
||||
# NOTE: This does NOT work and will throw errors with urls.py if used as is.
|
||||
# Edit this to customize Gunicorn settings
|
||||
|
||||
|
||||
import os
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
|
||||
def get_optional_env_variable(var_name):
|
||||
try:
|
||||
return os.environ[var_name]
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
|
||||
#
|
||||
# Server socket
|
||||
#
|
||||
# bind - The socket to bind.
|
||||
#
|
||||
# A string of the form: 'HOST', 'HOST:PORT', 'unix:PATH'.
|
||||
# An IP is a valid HOST.
|
||||
#
|
||||
# backlog - The number of pending connections. This refers
|
||||
# to the number of clients that can be waiting to be
|
||||
# served. Exceeding this number results in the client
|
||||
# getting an error when attempting to connect. It should
|
||||
# only affect servers under significant load.
|
||||
#
|
||||
# Must be a positive integer. Generally set in the 64-2048
|
||||
# range.
|
||||
#
|
||||
|
||||
django_port = get_optional_env_variable("DJANGO_PORT")
|
||||
listen_port = django_port or "8000"
|
||||
bind = "0.0.0.0:" + listen_port
|
||||
|
||||
backlog = get_optional_env_variable("GUNICORN_BACKLOG") or 2048
|
||||
|
||||
#
|
||||
# Worker processes
|
||||
#
|
||||
# workers - The number of worker processes that this server
|
||||
# should keep alive for handling requests.
|
||||
#
|
||||
# A positive integer generally in the 2-4 x $(NUM_CORES)
|
||||
# range. You'll want to vary this a bit to find the best
|
||||
# for your particular application's work load.
|
||||
#
|
||||
# worker_class - The type of workers to use. The default
|
||||
# sync class should handle most 'normal' types of work
|
||||
# loads. You'll want to read
|
||||
# http://docs.gunicorn.org/en/latest/design.html#choosing-a-worker-type
|
||||
# for information on when you might want to choose one
|
||||
# of the other worker classes.
|
||||
#
|
||||
# A string referring to a Python path to a subclass of
|
||||
# gunicorn.workers.base.Worker. The default provided values
|
||||
# can be seen at
|
||||
# http://docs.gunicorn.org/en/latest/settings.html#worker-class
|
||||
#
|
||||
# worker_connections - For the eventlet and gevent worker classes
|
||||
# this limits the maximum number of simultaneous clients that
|
||||
# a single process can handle.
|
||||
#
|
||||
# A positive integer generally set to around 1000.
|
||||
#
|
||||
# timeout - If a worker does not notify the master process in this
|
||||
# number of seconds it is killed and a new worker is spawned
|
||||
# to replace it.
|
||||
#
|
||||
# Generally set to thirty seconds. Only set this noticeably
|
||||
# higher if you're sure of the repercussions for sync workers.
|
||||
# For the non sync workers it just means that the worker
|
||||
# process is still communicating and is not tied to the length
|
||||
# of time required to handle a single request.
|
||||
#
|
||||
# keepalive - The number of seconds to wait for the next request
|
||||
# on a Keep-Alive HTTP connection.
|
||||
#
|
||||
# A positive integer. Generally set in the 1-5 seconds range.
|
||||
#
|
||||
|
||||
workers = get_optional_env_variable("GUNICORN_WORKERS") or 2
|
||||
worker_class = get_optional_env_variable("GUNICORN_WORKER_CLASS") or "sync"
|
||||
worker_connections = get_optional_env_variable("GUNICORN_WORKER_CONNECTIONS") or 1000
|
||||
timeout = get_optional_env_variable("GUNICORN_WORKER_TIMEOUT") or 30
|
||||
keepalive = get_optional_env_variable("GUNICORN_KEEPALIVE") or 2
|
||||
|
||||
#
|
||||
# spew - Install a trace function that spews every line of Python
|
||||
# that is executed when running the server. This is the
|
||||
# nuclear option.
|
||||
#
|
||||
# True or False
|
||||
#
|
||||
|
||||
spew = get_optional_env_variable("GUNICORN_SPEW") or False
|
||||
|
||||
#
|
||||
# Server mechanics
|
||||
#
|
||||
# daemon - Detach the main Gunicorn process from the controlling
|
||||
# terminal with a standard fork/fork sequence.
|
||||
#
|
||||
# True or False
|
||||
#
|
||||
# raw_env - Pass environment variables to the execution environment.
|
||||
#
|
||||
# pidfile - The path to a pid file to write
|
||||
#
|
||||
# A path string or None to not write a pid file.
|
||||
#
|
||||
# user - Switch worker processes to run as this user.
|
||||
#
|
||||
# A valid user id (as an integer) or the name of a user that
|
||||
# can be retrieved with a call to pwd.getpwnam(value) or None
|
||||
# to not change the worker process user.
|
||||
#
|
||||
# group - Switch worker process to run as this group.
|
||||
#
|
||||
# A valid group id (as an integer) or the name of a user that
|
||||
# can be retrieved with a call to pwd.getgrnam(value) or None
|
||||
# to change the worker processes group.
|
||||
#
|
||||
# umask - A mask for file permissions written by Gunicorn. Note that
|
||||
# this affects unix socket permissions.
|
||||
#
|
||||
# A valid value for the os.umask(mode) call or a string
|
||||
# compatible with int(value, 0) (0 means Python guesses
|
||||
# the base, so values like "0", "0xFF", "0022" are valid
|
||||
# for decimal, hex, and octal representations)
|
||||
#
|
||||
# tmp_upload_dir - A directory to store temporary request data when
|
||||
# requests are read. This will most likely be disappearing soon.
|
||||
#
|
||||
# A path to a directory where the process owner can write. Or
|
||||
# None to signal that Python should choose one on its own.
|
||||
#
|
||||
|
||||
daemon = get_optional_env_variable("GUNICORN_DAEMON") or False
|
||||
raw_env = get_optional_env_variable("GUNICORN_RAW_ENV") or []
|
||||
pidfile = get_optional_env_variable("GUNICORN_PIDFILE") or None
|
||||
umask = get_optional_env_variable("GUNICORN_UMASK") or 0
|
||||
user = get_optional_env_variable("GUNICORN_USER") or None
|
||||
group = get_optional_env_variable("GUNICORN_GROUP") or None
|
||||
tmp_upload_dir = get_optional_env_variable("GUNICORN_TMP_UPLOAD_DIR") or None
|
||||
|
||||
#
|
||||
# Logging
|
||||
#
|
||||
# logfile - The path to a log file to write to.
|
||||
#
|
||||
# A path string. "-" means log to stdout.
|
||||
#
|
||||
# loglevel - The granularity of log output
|
||||
#
|
||||
# A string of "debug", "info", "warning", "error", "critical"
|
||||
#
|
||||
|
||||
errorlog = get_optional_env_variable("GUNICORN_ERRORLOG") or "-"
|
||||
loglevel = get_optional_env_variable("GUNICORN_LOGLEVEL") or "info"
|
||||
accesslog = get_optional_env_variable("GUNICORN_ACCESSLOG") or "-"
|
||||
access_log_format = (
|
||||
get_optional_env_variable("GUNICORN_ACCESS_LOG_FORMAT")
|
||||
or '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
|
||||
)
|
||||
|
||||
#
|
||||
# Process naming
|
||||
#
|
||||
# proc_name - A base to use with setproctitle to change the way
|
||||
# that Gunicorn processes are reported in the system process
|
||||
# table. This affects things like 'ps' and 'top'. If you're
|
||||
# going to be running more than one instance of Gunicorn you'll
|
||||
# probably want to set a name to tell them apart. This requires
|
||||
# that you install the setproctitle module.
|
||||
#
|
||||
# A string or None to choose a default of something like 'gunicorn'.
|
||||
#
|
||||
|
||||
proc_name = get_optional_env_variable("GUNICORN_PROC_NAME") or None
|
||||
|
||||
#
|
||||
# Server hooks
|
||||
#
|
||||
# post_fork - Called just after a worker has been forked.
|
||||
#
|
||||
# A callable that takes a server and worker instance
|
||||
# as arguments.
|
||||
#
|
||||
# pre_fork - Called just prior to forking the worker subprocess.
|
||||
#
|
||||
# A callable that accepts the same arguments as after_fork
|
||||
#
|
||||
# pre_exec - Called just prior to forking off a secondary
|
||||
# master process during things like config reloading.
|
||||
#
|
||||
# A callable that takes a server instance as the sole argument.
|
||||
#
|
||||
|
||||
|
||||
def post_fork(server, worker):
|
||||
server.log.info("Worker spawned (pid: %s)", worker.pid)
|
||||
|
||||
|
||||
def pre_fork(server, worker):
|
||||
pass
|
||||
|
||||
|
||||
def pre_exec(server):
|
||||
server.log.info("Forked child, re-executing.")
|
||||
|
||||
|
||||
def when_ready(server):
|
||||
server.log.info("Server is ready. Spawning workers")
|
||||
|
||||
|
||||
def worker_int(worker):
|
||||
worker.log.info("worker received INT or QUIT signal")
|
||||
|
||||
# get traceback info
|
||||
import threading
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
id2name = {th.ident: th.name for th in threading.enumerate()}
|
||||
code = []
|
||||
for threadId, stack in list(sys._current_frames().items()):
|
||||
code.append("\n# Thread: %s(%d)" % (id2name.get(threadId, ""), threadId))
|
||||
for filename, lineno, name, line in traceback.extract_stack(stack):
|
||||
code.append('File: "%s", line %d, in %s' % (filename, lineno, name))
|
||||
if line:
|
||||
code.append(" %s" % (line.strip()))
|
||||
worker.log.debug("\n".join(code))
|
||||
|
||||
|
||||
def worker_abort(worker):
|
||||
worker.log.info("worker received SIGABRT signal")
|
||||
118
arches/settings_local.py
Normal file
118
arches/settings_local.py
Normal file
@@ -0,0 +1,118 @@
|
||||
import os
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
import ast
|
||||
|
||||
|
||||
def get_env_variable(var_name):
|
||||
msg = "Set the %s environment variable"
|
||||
try:
|
||||
return os.environ[var_name]
|
||||
except KeyError:
|
||||
error_msg = msg % var_name
|
||||
raise ImproperlyConfigured(error_msg)
|
||||
|
||||
|
||||
def get_optional_env_variable(var_name):
|
||||
try:
|
||||
return os.environ[var_name]
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
|
||||
# options are either "PROD" or "DEV"
|
||||
# (installing with Dev mode set gets you extra dependencies)
|
||||
MODE = get_env_variable("DJANGO_MODE")
|
||||
|
||||
DEBUG = ast.literal_eval(get_env_variable("DJANGO_DEBUG"))
|
||||
|
||||
if not DEBUG:
|
||||
# Some extra security settings for production deployments
|
||||
|
||||
SESSION_COOKIE_SECURE = True
|
||||
# We could use the DOMAINS envinronment variable here, but
|
||||
# since we're only supporting one domain and that's the same
|
||||
# has DEPLOY_HOST that is used for the SSL CERT_PATH.
|
||||
DEPLOY_HOST = get_env_variable("DEPLOY_HOST")
|
||||
CSRF_TRUSTED_ORIGINS = [
|
||||
f"https://{DEPLOY_HOST}",
|
||||
]
|
||||
|
||||
# Set the APP_NAME here too, it may be useful for making the URLs
|
||||
# work correctly when running gunicorn.
|
||||
APP_NAME = get_env_variable("ARCHES_PROJECT")
|
||||
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.contrib.gis.db.backends.postgis",
|
||||
"NAME": get_env_variable("PGDBNAME"),
|
||||
"USER": get_env_variable("PGUSERNAME"),
|
||||
"PASSWORD": get_env_variable("PGPASSWORD"),
|
||||
"HOST": get_env_variable("PGHOST"),
|
||||
"PORT": get_env_variable("PGPORT"),
|
||||
"POSTGIS_TEMPLATE": "template_postgis",
|
||||
}
|
||||
}
|
||||
|
||||
ARCHES_NAMESPACE_FOR_DATA_EXPORT = get_env_variable("ARCHES_NAMESPACE")
|
||||
|
||||
CACHES = {
|
||||
"default": {
|
||||
"BACKEND": "django.core.cache.backends.redis.RedisCache",
|
||||
"LOCATION": "redis://arches_redis:6379/1",
|
||||
},
|
||||
"user_permission": {
|
||||
"BACKEND": "django.core.cache.backends.db.DatabaseCache",
|
||||
"LOCATION": "user_permission_cache",
|
||||
},
|
||||
}
|
||||
|
||||
"""
|
||||
Since we're using Docker, we can use Redis (even on a Windows OS). So, we
|
||||
will comment out the RabbitMQ connection in favor of a Redis connection.
|
||||
|
||||
CELERY_BROKER_URL = "amqp://{}:{}@arches_rabbitmq:5672".format(
|
||||
get_env_variable("RABBITMQ_USER"), get_env_variable("RABBITMQ_PASS")
|
||||
)
|
||||
"""
|
||||
|
||||
CELERY_BROKER_URL = "redis://@arches_redis:6379/0"
|
||||
|
||||
# NOTE: If you want to disable celery and workers, leave a blank string fo
|
||||
# the CELERY_BROKER_URL as follows:
|
||||
#
|
||||
# CELERY_BROKER_URL = ""
|
||||
|
||||
# CANTALOUPE_HTTP_ENDPOINT = "http://{}:{}".format(get_env_variable("CANTALOUPE_HOST"), get_env_variable("CANTALOUPE_PORT"))
|
||||
ELASTICSEARCH_HTTP_PORT = get_env_variable("ESPORT")
|
||||
ELASTICSEARCH_HOSTS = [
|
||||
{
|
||||
"scheme": "http",
|
||||
"host": get_env_variable("ESHOST"),
|
||||
"port": int(ELASTICSEARCH_HTTP_PORT),
|
||||
}
|
||||
]
|
||||
|
||||
USER_ELASTICSEARCH_PREFIX = get_optional_env_variable("ELASTICSEARCH_PREFIX")
|
||||
if USER_ELASTICSEARCH_PREFIX:
|
||||
ELASTICSEARCH_PREFIX = USER_ELASTICSEARCH_PREFIX
|
||||
|
||||
ALLOWED_HOSTS = get_env_variable("DOMAIN_NAMES").split() + ['*']
|
||||
|
||||
USER_SECRET_KEY = get_optional_env_variable("DJANGO_SECRET_KEY")
|
||||
if USER_SECRET_KEY:
|
||||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = USER_SECRET_KEY
|
||||
|
||||
STATIC_ROOT = "/static_root"
|
||||
|
||||
LANGUAGE_CODE = 'es'
|
||||
# Added for v7 internationalization demo
|
||||
# Change these to match the languages you want to support
|
||||
LANGUAGES = [
|
||||
('es', ('Spanish')),
|
||||
('en', ('English')),
|
||||
]
|
||||
# This does not work when using gunicorn
|
||||
# SHOW_LANGUAGE_SWITCH = len(LANGUAGES) > 1
|
||||
SHOW_LANGUAGE_SWITCH = False
|
||||
22
arches/urls.py
Normal file
22
arches/urls.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.urls import include, path
|
||||
|
||||
urlpatterns = [
|
||||
# project-level urls
|
||||
]
|
||||
|
||||
# Ensure Arches core urls are superseded by project-level urls
|
||||
urlpatterns.append(path('', include('arches.urls')))
|
||||
|
||||
# Adds URL pattern to serve media files during development
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
# Only handle i18n routing in active project. This will still handle the routes provided by Arches core and Arches applications,
|
||||
# but handling i18n routes in multiple places causes application errors.
|
||||
if settings.ROOT_URLCONF == __name__:
|
||||
if settings.SHOW_LANGUAGE_SWITCH is True:
|
||||
urlpatterns = i18n_patterns(*urlpatterns)
|
||||
|
||||
urlpatterns.append(path("i18n/", include("django.conf.urls.i18n")))
|
||||
9
certbot/Dockerfile
Normal file
9
certbot/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
||||
FROM certbot/certbot
|
||||
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
COPY certbot.sh /opt/
|
||||
|
||||
RUN chmod +x /opt/certbot.sh
|
||||
|
||||
ENTRYPOINT ["/opt/certbot.sh"]
|
||||
58
certbot/certbot.sh
Normal file
58
certbot/certbot.sh
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
trap exit INT TERM
|
||||
|
||||
if [ -z "$DOMAINS" ]; then
|
||||
echo "DOMAINS environment variable is not set"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
until nc -z nginx 80; do
|
||||
echo "Waiting for nginx to start..."
|
||||
sleep 5s & wait ${!}
|
||||
done
|
||||
|
||||
if [ "$CERTBOT_TEST_CERT" != "0" ]; then
|
||||
test_cert_arg="--test-cert"
|
||||
fi
|
||||
|
||||
domains_fixed=$(echo "$DOMAINS $DOMAINS_EXTRA" | tr -d \")
|
||||
domain_list=($domains_fixed)
|
||||
emails_fixed=$(echo "$CERTBOT_EMAILS" | tr -d \")
|
||||
emails_list=($emails_fixed)
|
||||
|
||||
for i in "${!domain_list[@]}"; do
|
||||
domain="${domain_list[i]}"
|
||||
|
||||
echo "Make cerbot directory for $domain";
|
||||
mkdir -p /var/www/certbot/$domain;
|
||||
echo "Make the $domain deep directory for acme-challenges";
|
||||
mkdir -p /var/www/certbot/$domain/.well-known/acme-challenge;
|
||||
|
||||
if [ -d "/etc/letsencrypt/live/$domain" ]; then
|
||||
echo "Let's Encrypt certificate for $domain already exists"
|
||||
continue
|
||||
fi
|
||||
|
||||
email="${emails_list[i]}"
|
||||
if [ -z "$email" ]; then
|
||||
email_arg="--register-unsafely-without-email"
|
||||
echo "Obtaining the certificate for $domain without email"
|
||||
else
|
||||
email_arg="--email $email"
|
||||
echo "Obtaining the certificate for $domain with email $email"
|
||||
fi
|
||||
|
||||
certbot certonly \
|
||||
--webroot \
|
||||
-w "/var/www/certbot/$domain" \
|
||||
-d "$domain" \
|
||||
$test_cert_arg \
|
||||
$email_arg \
|
||||
--rsa-key-size "${CERTBOT_RSA_KEY_SIZE:-4096}" \
|
||||
--agree-tos \
|
||||
--noninteractive \
|
||||
--verbose || true
|
||||
done
|
||||
20
code_of_conduct.md
Normal file
20
code_of_conduct.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We welcome collaboration to improve this software repository.
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Expectations
|
||||
|
||||
We expect contributors to conduct themselves according to the
|
||||
expectations of the Arches Community code of conduct (see: https://www.archesproject.org/code-of-conduct/). Please carefully review the Arches code of conduct and use it to make positive contributions to this and other Arches related projects.
|
||||
12
cron/Dockerfile
Normal file
12
cron/Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM alpine:3.16
|
||||
|
||||
RUN apk update && \
|
||||
apk add --no-cache docker-cli docker-cli-compose
|
||||
|
||||
COPY renew_certs.sh /etc/periodic/daily/renew_certs
|
||||
|
||||
RUN chmod +x /etc/periodic/daily/renew_certs
|
||||
|
||||
WORKDIR /workdir
|
||||
|
||||
CMD ["crond", "-f", "-l", "0"]
|
||||
7
cron/renew_certs.sh
Normal file
7
cron/renew_certs.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd /workdir
|
||||
echo "Renewing Let's Encrypt Certificates... (`date`)"
|
||||
docker compose run --rm --no-TTY --entrypoint certbot certbot renew --no-random-sleep-on-renew
|
||||
echo "Reloading Nginx configuration"
|
||||
docker compose exec --no-TTY nginx nginx -s reload
|
||||
219
docker-compose.yml
Normal file
219
docker-compose.yml
Normal file
@@ -0,0 +1,219 @@
|
||||
services:
|
||||
|
||||
arches_db:
|
||||
container_name: arches_db
|
||||
image: postgis/postgis:14-3.2
|
||||
env_file:
|
||||
- ./.env
|
||||
environment:
|
||||
- PGUSER=postgres
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD=postgis
|
||||
- POSTGRES_MULTIPLE_EXTENSIONS=postgis,postgis_topology
|
||||
restart: always
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data/
|
||||
- postgres-log:/var/log/postgresql
|
||||
- ./init-unix.sql:/docker-entrypoint-initdb.d/init.sql # to set up the DB template
|
||||
- ../arches_data/:/arches_data
|
||||
ports:
|
||||
- '5434:5432'
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10k"
|
||||
max-file: "10"
|
||||
networks:
|
||||
- arches_net
|
||||
|
||||
arches_elasticsearch:
|
||||
container_name: arches_elasticsearch
|
||||
image: elasticsearch:8.5.3
|
||||
restart: always
|
||||
env_file:
|
||||
- ./.env
|
||||
environment:
|
||||
- TZ="${TZ}"
|
||||
- xpack.security.enabled=false
|
||||
- discovery.type=single-node
|
||||
- "ES_JAVA_OPTS=-Xms400m -Xmx400m"
|
||||
volumes:
|
||||
- elasticsearch-data:/usr/share/elasticsearch/data
|
||||
ports:
|
||||
- "9202:9200"
|
||||
- "9302:9300"
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10k"
|
||||
max-file: "10"
|
||||
networks:
|
||||
- arches_net
|
||||
|
||||
arches_redis:
|
||||
container_name: arches_redis
|
||||
image: "redis:6-alpine"
|
||||
restart: always
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- "redisdata:/data"
|
||||
command: "redis-server"
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10k"
|
||||
max-file: "10"
|
||||
networks:
|
||||
- arches_net
|
||||
|
||||
pg_tilesrv:
|
||||
container_name: pg_tilesrv
|
||||
image: pramsey/pg_tileserv:latest-amd64
|
||||
restart: always
|
||||
tty: true
|
||||
environment:
|
||||
- DATABASE_URL=${DATABASE_URL}
|
||||
ports:
|
||||
- 7800:7800
|
||||
expose:
|
||||
- 7800:7800
|
||||
networks:
|
||||
- arches_net
|
||||
|
||||
arches:
|
||||
container_name: arches
|
||||
image: arches
|
||||
env_file:
|
||||
- ./.env
|
||||
build:
|
||||
context: .
|
||||
dockerfile: arches/Dockerfile
|
||||
args:
|
||||
ARCHES_PROJECT: ${ARCHES_PROJECT}
|
||||
ARCHES_ROOT: ${ARCHES_ROOT}
|
||||
APP_ROOT: ${APP_ROOT}
|
||||
APP_COMP_FOLDER: ${APP_COMP_FOLDER}
|
||||
ARCHES_PIP_VERSION: ${ARCHES_PIP_VERSION}
|
||||
UPLOADED_FILES_FOLDER: ${UPLOADED_FILES_FOLDER}
|
||||
environment:
|
||||
- DEBUG="${DJANGO_DEBUG}"
|
||||
- ARCHES_PROJECT=${ARCHES_PROJECT}
|
||||
stdin_open: true # docker run -i
|
||||
tty: true # docker run -t
|
||||
ports:
|
||||
- "5432:5432"
|
||||
- 8004:8000
|
||||
- 5678:5678
|
||||
- 5984:5984
|
||||
depends_on:
|
||||
- arches_db
|
||||
- arches_elasticsearch
|
||||
- arches_redis
|
||||
command:
|
||||
- run_arches
|
||||
expose:
|
||||
- 8004:8000
|
||||
volumes:
|
||||
- arches-log:/web_root/logs
|
||||
- arches-static:/static_root
|
||||
- arches-app:/arches_app
|
||||
- ../arches_data/:/arches_data
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "10"
|
||||
networks:
|
||||
- arches_net
|
||||
|
||||
nginx:
|
||||
container_name: nginx
|
||||
build: ./nginx
|
||||
image: arches_via_docker/nginx
|
||||
env_file:
|
||||
- ./.env
|
||||
environment:
|
||||
- DOMAINS="${DOMAINS}"
|
||||
- DEPLOY_HOST="${DEPLOY_HOST}"
|
||||
- CERT_PATH="${CERT_PATH}"
|
||||
- DJANGO_PORT="${DJANGO_PORT}"
|
||||
volumes:
|
||||
- logs_nginx:/logs/nginx
|
||||
- nginx_ssl:/etc/nginx/ssl
|
||||
- certbot_certs:/etc/letsencrypt
|
||||
- arches_certbot:$CERT_PATH
|
||||
- arches-static:/static_root
|
||||
- ./html:$NGINX_HTML_PATH
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
restart: always
|
||||
depends_on:
|
||||
- arches
|
||||
- pg_tilesrv
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "10"
|
||||
networks:
|
||||
- arches_net
|
||||
|
||||
certbot:
|
||||
container_name: certbot
|
||||
build: ./certbot
|
||||
image: arches_oc/certbot
|
||||
env_file:
|
||||
- ./.env
|
||||
volumes:
|
||||
- certbot_certs:/etc/letsencrypt
|
||||
- arches_certbot:$CERT_PATH
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "1k"
|
||||
max-file: "3"
|
||||
networks:
|
||||
- arches_net
|
||||
|
||||
cron:
|
||||
container_name: cron
|
||||
build: ./cron
|
||||
image: arches_via_docker/cron
|
||||
environment:
|
||||
COMPOSE_PROJECT_NAME: "${COMPOSE_PROJECT_NAME}"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./:/workdir:ro
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "1k"
|
||||
max-file: "3"
|
||||
networks:
|
||||
- arches_net
|
||||
|
||||
networks:
|
||||
arches_net:
|
||||
driver: bridge
|
||||
name: arches_net
|
||||
|
||||
volumes:
|
||||
nginx_ssl:
|
||||
external: true
|
||||
certbot_certs:
|
||||
external: true
|
||||
arches_certbot:
|
||||
external: true
|
||||
redisdata:
|
||||
couchdb-data:
|
||||
couchdb-log:
|
||||
postgres-data:
|
||||
postgres-log:
|
||||
elasticsearch-data:
|
||||
arches-log:
|
||||
arches-static:
|
||||
arches-app:
|
||||
logs_nginx:
|
||||
72
edit_dot_env
Normal file
72
edit_dot_env
Normal file
@@ -0,0 +1,72 @@
|
||||
# Edit this file and save as ".env" for use.
|
||||
|
||||
COMPOSE_PROJECT_NAME=sprpcb_prod
|
||||
|
||||
# Not supporting multiple domains yet, so just make sure there's only
|
||||
# one here.
|
||||
DOMAINS=pmoxos.patrimonio.org.bo
|
||||
|
||||
DEPLOY_HOST=$DOMAINS
|
||||
NGINX_HTML_PATH=/var/www/html/$DEPLOY_HOST
|
||||
CERT_PATH=/var/www/certbot/$DEPLOY_HOST
|
||||
CERTBOT_EMAILS=sysadmin@patrimonio.org.bo
|
||||
CERTBOT_TEST_CERT=0
|
||||
CERTBOT_RSA_KEY_SIZE=4096
|
||||
TZ="America/La_Paz"
|
||||
|
||||
#arches project and paths
|
||||
ARCHES_PIP_VERSION="7.6.19"
|
||||
ARCHES_PROJECT=arches_proy
|
||||
ARCHES_ROOT=/arches_app
|
||||
APP_ROOT=$ARCHES_ROOT/$ARCHES_PROJECT
|
||||
APP_COMP_FOLDER=$APP_ROOT/$ARCHES_PROJECT
|
||||
|
||||
# for file uploads
|
||||
UPLOADED_FILES_FOLDER=$APP_COMP_FOLDER/uploadedfiles
|
||||
|
||||
#Arches configs
|
||||
# NOTE: the ARCHES_NAMESPACE needs to look like a URL, ending in a '/',
|
||||
# with the same port as used by the Arches Django APP.
|
||||
ARCHES_NAMESPACE=http://$ARCHES_PROJECT:8000/
|
||||
# This will hopefully make the yarn build not fail.
|
||||
NODE_OPTIONS='--max-old-space-size=1024'
|
||||
INSTALL_DEFAULT_GRAPHS=True
|
||||
INSTALL_DEFAULT_CONCEPTS=True
|
||||
# Don't change these, because I can't figure out how dynamically pass
|
||||
# a new database password to Postgres via docker compose. If you change
|
||||
# something like the PGPASSWORD, be sure to change it in the corresponding
|
||||
# value in the docker-compse.yml for the Postgres container.
|
||||
PGUSERNAME=postgres
|
||||
PGPASSWORD=postgis
|
||||
PGDBNAME=$ARCHES_PROJECT
|
||||
PGHOST=arches_db
|
||||
PGPORT=5432
|
||||
ESHOST=arches_elasticsearch
|
||||
ESPORT=9200
|
||||
DJANGO_MODE=DEV
|
||||
DJANGO_DEBUG=False
|
||||
# Don't change the port, since it's pretty hard-coded.
|
||||
DJANGO_PORT=8000
|
||||
DOMAIN_NAMES=$DOMAINS localhost 0.0.0.0 127.0.0.1
|
||||
# NOTE: Only set BUILD_PRODUCTION=True if you have well over
|
||||
# 8GB of system RAM. Otherwise, yarn will likely error out.
|
||||
BUILD_PRODUCTION=False
|
||||
PYTHONUNBUFFERED=0
|
||||
ELASTICSEARCH_PREFIX=$ARCHES_PROJECT
|
||||
|
||||
# RabbitMQ credentials. We're currently using Redis as a task
|
||||
# broker, not RabbitMQ, so these are commented out.
|
||||
# RABBITMQ_USER=guest
|
||||
# RABBITMQ_PASS=guest
|
||||
|
||||
# couchdb for arches. Not needed for V7+, but config exists incase it
|
||||
# reappears.
|
||||
COUCHDB_HOST=arches
|
||||
COUCHDB_PORT=5984
|
||||
COUCHDB_USER=admin
|
||||
COUCHDB_PASS=password
|
||||
COUCHDB_URL=http://$COUCHDB_USER:$COUCHDB_PASS@$COUCHDB_HOST:$COUCHDB_PORT
|
||||
|
||||
# The DATABASE_URL is a convenience consolidated way help connect to Postgresql
|
||||
# pg_featureserv and tileserv
|
||||
DATABASE_URL=postgresql://$PGUSERNAME:$PGPASSWORD@$PGHOST/$PGDBNAME
|
||||
24
html/index.html
Normal file
24
html/index.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Hello</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.8.0/css/bulma.min.css">
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<h1 class="title">
|
||||
Hello from the Arches via Docker NGINX Server
|
||||
</h1>
|
||||
<p class="subtitle" id="main-subtitle">
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
<script>
|
||||
document.getElementById('main-subtitle').innerHTML = 'From ' + location.href + '!';
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
13
init-unix.sql
Normal file
13
init-unix.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
UPDATE pg_database SET datistemplate='false' WHERE datname='template_postgis';
|
||||
DROP DATABASE IF EXISTS template_postgis;
|
||||
CREATE DATABASE template_postgis WITH ENCODING 'UTF8';
|
||||
UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';
|
||||
|
||||
\c template_postgis
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS postgis;
|
||||
GRANT ALL ON geometry_columns TO PUBLIC;
|
||||
GRANT ALL ON geography_columns TO PUBLIC;
|
||||
GRANT ALL ON spatial_ref_sys TO PUBLIC;
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
3
logs/README.md
Normal file
3
logs/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Logs Directory
|
||||
-------------------------------------------------------
|
||||
These will provide a unified place to output logs
|
||||
3
logs/arches/README.md
Normal file
3
logs/arches/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Logs Directory
|
||||
-------------------------------------------------------
|
||||
These will provide a unified place to output logs
|
||||
3
logs/nginx/README.md
Normal file
3
logs/nginx/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Logs Directory
|
||||
-------------------------------------------------------
|
||||
These will provide a unified place to output logs
|
||||
19
nginx/Dockerfile
Normal file
19
nginx/Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM nginx:1.18-alpine-perl
|
||||
|
||||
RUN apk add --no-cache nginx-mod-http-perl
|
||||
RUN apk add --no-cache openssl
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
COPY default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
COPY options-ssl-nginx.conf /etc/nginx/
|
||||
COPY hsts.conf /etc/nginx/
|
||||
RUN mkdir -p /customization
|
||||
COPY blacklist.conf /customization/blacklist.conf
|
||||
RUN mkdir -p /etc/symb_link_ssl
|
||||
RUN mkdir -p /logs/nginx
|
||||
COPY nginx.sh /customization/nginx.sh
|
||||
RUN chmod +x /customization/nginx.sh
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["/customization/nginx.sh"]
|
||||
132
nginx/blacklist.conf
Normal file
132
nginx/blacklist.conf
Normal file
@@ -0,0 +1,132 @@
|
||||
### This file implements a blacklist for certain user agents and
|
||||
### referrers. It's a first line of defense. It must be included
|
||||
### inside an http block.
|
||||
###
|
||||
### Author: mariusv
|
||||
###
|
||||
### Contributors: mitchellkrogza https://github.com/mitchellkrogza/nginx-badbot-blocker
|
||||
###
|
||||
### Last Updated: 2017-01-11
|
||||
###
|
||||
### Bad URL Referer lists extracted from:
|
||||
### https://perishablepress.com/blacklist/ultimate-referrer-blacklist.txt
|
||||
###
|
||||
### Tested on: version: nginx/1.10.0 (Ubuntu)
|
||||
###
|
||||
### Modifications: - Added to bad_bot list
|
||||
###
|
||||
### - Added to bad_referer list (excuse the nasty words)
|
||||
###
|
||||
### - Added bad_urls1 bad_urls2 bad_urls3 and bad_urls4
|
||||
### (Broken up into 4 sections for ease of maintenance)
|
||||
###
|
||||
### - Added validate_client (allowing all except Cyveillance IP's)
|
||||
### (originally from https://github.com/oohnoitz/nginx-blacklist)
|
||||
###
|
||||
### I have this set up on my server as /etc/nginx/conf.d/blacklist.conf
|
||||
### This is loaded and available for any vhost to use in its config
|
||||
###
|
||||
### Need I say, please don't just copy and paste this without reviewing what bots and
|
||||
### referers are being blocked, you may want to exclude certain of them
|
||||
### Also make SURE to whitelist your own IP's in the geo $bad_referer section.
|
||||
###
|
||||
### Note that: 0 = allow 1 = deny
|
||||
###
|
||||
### To enable it in a host file the following will go in the server block
|
||||
### You can use all or just pick the one's you want on a host configuration
|
||||
### You may also want to {return 444;} which is an Nginx feature that drops the
|
||||
### connection immediately without even sending headers.
|
||||
###
|
||||
### # Block Bad Bots
|
||||
### # Send 403 Forbidden or 444 Drop Connection
|
||||
### if ($bad_bot) { return 444; }
|
||||
### # Block Bad Referers
|
||||
### # Send 403 Forbidden or 444 Drop Connection
|
||||
### if ($bad_referer) { return 403; }
|
||||
### if ($bad_urls1) { return 403; }
|
||||
### if ($bad_urls2) { return 403; }
|
||||
### if ($bad_urls3) { return 403; }
|
||||
### if ($bad_urls4) { return 403; }
|
||||
### if ($bad_urls5) { return 403; }
|
||||
### if ($bad_urls6) { return 403; }
|
||||
### # Block Snoopers
|
||||
### # Send 444 Connection Closed Without Response
|
||||
### if ($validate_client) { return 444;}
|
||||
###
|
||||
### NOTE: You need to change the hash max values or add them if they are not specified in your nginx.conf file
|
||||
### This is because the defaults are too small and loading a big file like this into Nginx can cause errors
|
||||
### Add the following into your nginx.conf file
|
||||
### server_names_hash_bucket_size 64;
|
||||
### server_names_hash_max_size 4096;
|
||||
###
|
||||
### Make sure to "sudo nginx -t" to check the config
|
||||
|
||||
|
||||
map $http_user_agent $bad_bot {
|
||||
default 0;
|
||||
~*^Lynx 0; # Let Lynx go through
|
||||
libwww-perl 1;
|
||||
~*(?i)(80legs|360Spider|Aboundex|Abonti|Acunetix|^AIBOT|^Alexibot|Alligator|AllSubmitter|Apexoo|^asterias|^attach|^BackDoorBot|^BackStreet|^BackWeb|Badass|Bandit|Baid|Baiduspider|^BatchFTP|^Bigfoot|^Black.Hole|^BlackWidow|BlackWidow|^BlowFish|Blow|^BotALot|Buddy|^BuiltBotTough|^Bullseye|^BunnySlippers|BBBike|^Cegbfeieh|^CheeseBot|^CherryPicker|^ChinaClaw|^Cogentbot|CPython|Collector|cognitiveseo|Copier|^CopyRightCheck|^cosmos|^Crescent|CSHttp|^Custo|^Demon|^Devil|^DISCo|^DIIbot|discobot|^DittoSpyder|Download.Demon|Download.Devil|Download.Wonder|^dragonfly|^Drip|^eCatch|^EasyDL|^ebingbong|^EirGrabber|^EmailCollector|^EmailSiphon|^EmailWolf|^EroCrawler|^Exabot|^Express|Extractor|^EyeNetIE|FHscan|^FHscan|^flunky|^Foobot|^FrontPage|GalaxyBot|^gotit|Grabber|^GrabNet|^Grafula|^Harvest|^HEADMasterSEO|^hloader|^HMView|^HTTrack|httrack|HTTrack|htmlparser|^humanlinks|^IlseBot|Image.Stripper|Image.Sucker|imagefetch|^InfoNaviRobot|^InfoTekies|^Intelliseek|^InterGET|^Iria|^Jakarta|^JennyBot|^JetCar|JikeSpider|^JOC|^JustView|^Jyxobot|^Kenjin.Spider|^Keyword.Density|libwww|^larbin|LeechFTP|LeechGet|^LexiBot|^lftp|^libWeb|^likse|^LinkextractorPro|^LinkScan|^LNSpiderguy|^LinkWalker|msnbot|MSIECrawler|MJ12bot|MegaIndex|^Magnet|^Mag-Net|^MarkWatch|Mass.Downloader|masscan|^Mata.Hari|^Memo|^MIIxpc|^NAMEPROTECT|^Navroad|^NearSite|^NetAnts|^Netcraft|^NetMechanic|^NetSpider|^NetZIP|^NextGenSearchBot|^NICErsPRO|^niki-bot|^NimbleCrawler|^Nimbostratus-Bot|^Ninja|^Nmap|nmap|^NPbot|Offline.Explorer|Offline.Navigator|OpenLinkProfiler|^Octopus|^Openfind|^OutfoxBot|Pixray|probethenet|proximic|^PageGrabber|^pavuk|^pcBrowser|^Pockey|^ProPowerBot|^ProWebWalker|^psbot|^Pump|python-requests|^QueryN.Metasearch|^RealDownload|Reaper|^Reaper|^Ripper|Ripper|Recorder|^ReGet|^RepoMonkey|^RMA|scanbot|SEOkicks-Robot|seoscanners|^Stripper|^Sucker|Siphon|Siteimprove|^SiteSnagger|SiteSucker|^SlySearch|^SmartDownload|^Snake|^Snapbot|^Snoopy|Sosospider|^sogou|spbot|^SpaceBison|^spanner|^SpankBot|Spinn4r|^Sqworm|Sqworm|Stripper|Sucker|^SuperBot|SuperHTTP|^SuperHTTP|^Surfbot|^suzuran|^Szukacz|^tAkeOut|^Teleport|^Telesoft|^TurnitinBot|^The.Intraformant|^TheNomad|^TightTwatBot|^Titan|^True_Robot|^turingos|^TurnitinBot|^URLy.Warning|^Vacuum|^VCI|VidibleScraper|^VoidEYE|^WebAuto|^WebBandit|^WebCopier|^WebEnhancer|^WebFetch|^Web.Image.Collector|^WebLeacher|^WebmasterWorldForumBot|WebPix|^WebReaper|^WebSauger|Website.eXtractor|^Webster|WebShag|^WebStripper|WebSucker|^WebWhacker|^WebZIP|Whack|Whacker|^Widow|Widow|WinHTTrack|^WISENutbot|WWWOFFLE|^WWWOFFLE|^WWW-Collector-E|^Xaldon|^Xenu|^Zade|^Zeus|ZmEu|^Zyborg|SemrushBot|^WebFuck|^MJ12bot|^majestic12|^WallpapersHD) 1;
|
||||
}
|
||||
|
||||
## Add here all referrers that are to blocked.
|
||||
map $http_referer $bad_referer_block {
|
||||
default 0;
|
||||
~(?i)(adcash|advair|allegra|ambien|amoxicillin|adult|anal|asshole|babes|baccarat|betting|bithack|blackjack|cash|casino|celeb|cheap|cialis|craps|credit|click|cunt|deal|debt|drug|diamond|effexor|equity|faxo|finance|fisting|forsale|gambling|gaysex|girl|hardcore|hold-em|holdem|iconsurf|ilovevitaly|insurance|interest|internetsupervision|jewelry|keno|levitra|lipitor|loan|loans|love|makemoneyonline|make-money-online|meds|money|mortgage|myftpupload|nudit|omaha|organic|paxil|pharmacy|pharmacies|phentermine|pheromone|pills|piss|poker|porn|poweroversoftware|refinance|replica|rimming|roulette|screentoolkit|seoexperimenty|sex|snuff|scout|seventwentyfour|slot|slots|syntryx|teen|texas|t0phackteam|tournament|tramadol|tramidol|valtrex|vvakhrin-ws1|viagra|vicodin|webcam|xanax|xnxx|xxxrus|zanax|zippo|zoloft) 1;
|
||||
}
|
||||
|
||||
## Add here all bad referer domains to be blocked - broken up into sections
|
||||
## Alphabetical A - E (incl numbers)
|
||||
map $http_referer $bad_urls1 {
|
||||
default 0;
|
||||
~(?i)(^http://(www\.)?38ha(-|.).*$|^http://(www\.)?4free(-|.).*$|^http://(www\.)?4hs8(-|.).*$|^http://(www\.)?4t(-|.).*$|^http://(www\.)?4u(-|.).*$|^http://(www\.)?6q(-|.).*$|^http://(www\.)?7makemoneyonline(-|.).*$|^http://(www\.)?8gold(-|.).*$|^http://(www\.)?911(-|.).*$|^http://(www\.)?adcash(-|.).*$|^http://(www\.)?.*(-|.)?adult(-|.).*$|^http://(www\.)?.*(-|.)?acunetix-referrer(-|.).*$|^http://(www\.)?abalone(-|.).*$|^http://(www\.)?adminshop(-|.).*$|^http://(www\.)?adultactioncam(-|.).*$|^http://(www\.)?aizzo(-|.).*$|^http://(www\.)?alphacarolinas(-|.).*$|^http://(www\.)?amateur(-|.).*$|^http://(www\.)?amateurxpass(-|.).*$|^http://(www\.)?.*(-|.)?anal(-|.).*$|^http://(www\.)?ansar-u-deen(-|.).*$|^http://(www\.)?atelebanon(-|.).*$|^http://(www\.)?beastiality(-|.).*$|^http://(www\.)?bestiality(-|.).*$|^http://(www\.)?belize(-|.).*$|^http://(www\.)?best-deals(-|.).*$|^http://(www\.)?bithack(-|.).*$|^http://(www\.)?blogincome(-|.).*$|^http://(www\.)?bontril(-|.).*$|^http://(www\.)?bruce-holdeman(-|.).*$|^http://(www\.)?.*(-|.)?blow.?job(-|.).*$|^http://(www\.)?buttons-for-website(-|.).*$|^http://(www\.)?ca-america(-|.).*$|^http://(www\.)?chatt-net(-|.).*$|^http://(www\.)?cenokos(-|.).*$|^http://(www\.)?cenoval(-|.).*$|^http://(www\.)?cityadspix(-|.).*$|^http://(www\.)?commerce(-|.).*$|^http://(www\.)?condo(-|.).*$|^http://(www\.)?conjuratia(-|.).*$|^http://(www\.)?consolidate(-|.).*$|^http://(www\.)?coswap(-|.).*$|^http://(www\.)?crescentarian(-|.).*$|^http://(www\.)?crepesuzette(-|.).*$|^http://(www\.)?darodar(-|.).*$|^http://(www\.)?dating(-|.).*$|^http://(www\.)?devaddict(-|.).*$|^http://(www\.)?discount(-|.).*$|^http://(www\.)?doobu(-|.).*$|^http://(www\.)?domainsatcost(-|.).*$|^http://(www\.)?econom.co(-|.).*$|^http://(www\.)?edakgfvwql(-|.).*$|^http://(www\.)?.*(-|.)?sex(-|.).*$|^http://(www\.)?e-site(-|.).*$|^http://(www\.)?egygift(-|.).*$|^http://(www\.)?empathica(-|.).*$|^http://(www\.)?empirepoker(-|.).*$|^http://(www\.)?e-poker-2005(-|.).*$|^http://(www\.)?escal8(-|.).*$|^http://(www\.)?eurip(-|.).*$|^http://(www\.)?exitq(-|.).*$|^http://(www\.)?eyemagination(-|.).*$) 1;
|
||||
}
|
||||
## F - I
|
||||
map $http_referer $bad_urls2 {
|
||||
default 0;
|
||||
~(?i)(^http://(www\.)?fastcrawl(-|.).*$|^http://(www\.)?fearcrow(-|.).*$|^http://(www\.)?ferretsoft(-|.).*$|^http://(www\.)?fick(-|.).*$|^http://(www\.)?finance(-|.).*$|^http://(www\.)?flafeber(-|.).*$|^http://(www\.)?fidelityfunding(-|.).*$|^http://(www\.)?freakycheats(-|.).*$|^http://(www\.)?freeality(-|.).*$|^http://(www\.)?fuck(-|.).*$|^http://(www\.)?future-2000(-|.).*$|^http://(www\.)?.*(-|.)?gay(-|.).*$|^http://(www\.)?gobongo.info(-|.).*$|^http://(www\.)?gabriola(-|.).*$|^http://(www\.)?gallerylisting(-|.).*$|^http://(www\.)?gb.com(-|.).*$|^http://(www\.)?ghostvisitor(-|.).*$|^http://(www\.)?globusy(-|.).*$|^http://(www\.)?golf-e-course(-|.).*$|^http://(www\.)?gospelcom(-|.).*$|^http://(www\.)?gradfinder(-|.).*$|^http://(www\.)?hasfun(-|.).*$|^http://(www\.)?herbal(-|.).*$|^http://(www\.)?hermosa(-|.).*$|^http://(www\.)?highprofitclub(-|.).*$|^http://(www\.)?hilton(-|.).*$|^http://(www\.)?teaminspection(-|.).*$|^http://(www\.)?hotel(-|.).*$|^http://(www\.)?houseofseven(-|.).*$|^http://(www\.)?hurricane(-|.).*$|^http://(www\.)?.*(-|.)?incest(-|.).*$|^http://(www\.)?iaea(-|.).*$|^http://(www\.)?ilovevitality(-|.).*$|^http://(www\.)?ime(-|.).*$|^http://(www\.)?info(-|.).*$|^http://(www\.)?ingyensms(-|.).*$|^http://(www\.)?inkjet-toner(-|.).*$|^http://(www\.)?isacommie(-|.).*$|^http://(www\.)?istarthere(-|.).*$|^http://(www\.)?it.tt(-|.).*$|^http://(www\.)?italiancharms(-|.).*$|^http://(www\.)?iwantu(-|.).*$|^http://(www\.)?ilovevitality(-|.).*$|^http://(www\.)?iskalko.ru(-|.).*$) 1;
|
||||
}
|
||||
## J - P
|
||||
map $http_referer $bad_urls3 {
|
||||
default 0;
|
||||
~(?i)(^http://(www\.)?jfcadvocacy(-|.).*$|^http://(www\.)?jmhic(-|.).*$|^http://(www\.)?juris(-|.).*$|^http://(www\.)?kylos(-|.).*$|^http://(www\.)?laser-eye(-|.).*$|^http://(www\.)?leathertree(-|.).*$|^http://(www\.)?lillystar(-|.).*$|^http://(www\.)?linkerdome(-|.).*$|^http://(www\.)?livenet(-|.).*$|^http://(www\.)?low-limit(-|.).*$|^http://(www\.)?lowest-price(-|.).*$|^http://(www\.)?luxup.ru(-|.).*$|^http://(www\.)?macsurfer(-|.).*$|^http://(www\.)?mall.uk(-|.).*$|^http://(www\.)?maloylawn(-|.).*$|^http://(www\.)?marketing(-|.).*$|^http://(www\.)?.*(-|.)?mature(-|.).*$|^http://(www\.)?mcdortaklar(-|.).*$|^http://(www\.)?mediavisor(-|.).*$|^http://(www\.)?medications(-|.).*$|^http://(www\.)?mirror.sytes(-|.).*$|^http://(www\.)?mp3(-|.).*$|^http://(www\.)?(-|.)musicbox1(-|.).*$|^http://(www\.)?myftpupload(-|.).*$|^http://(www\.)?naked(-|.).*$|^http://(www\.)?netdisaster(-|.).*$|^http://(www\.)?netfirms(-|.).*$|^http://(www\.)?newtruths(-|.).*$|^http://(www\.)?no-limit(-|.).*$|^http://(www\.)?nude(-|.).*$|^http://(www\.)?nudeceleb(-|.).*$|^http://(www\.)?nutzu(-|.).*$|^http://(www\.)?odge(-|.).*$|^http://(www\.)?oiline(-|.).*$|^http://(www\.)?onlinegamingassoc(-|.).*$|^http://(www\.)?outpersonals(-|.).*$|^http://(www\.)?o-o-6-o-o.ru(-|.).*$|^http://(www\.)?o-o-8-o-o.ru(-|.).*$|^http://(www\.)?pagetwo(-|.).*$|^http://(www\.)?paris(-|.).*$|^http://(www\.)?passions(-|.).*$|^http://(www\.)?peblog(-|.).*$|^http://(www\.)?peng(-|.).*$|^http://(www\.)?perfume-cologne(-|.).*$|^http://(www\.)?personal(-|.).*$|^http://(www\.)?php-soft(-|.).*$|^http://(www\.)?pisoc(-|.).*$|^http://(www\.)?pisx(-|.).*$|^http://(www\.)?popwow(-|.).*$|^http://(www\.)?porn(-|.).*$|^http://(www\.)?prescriptions(-|.).*$|^http://(www\.)?priceg(-|.).*$|^http://(www\.)?.*(-|.)?pus*y(-|.).*$|^http://(www\.)?printdirectforless(-|.).*$|^http://(www\.)?ps2cool(-|.).*$|^http://(www\.)?psnarones(-|.).*$|^http://(www\.)?psxtreme(-|.).*$) 1;
|
||||
}
|
||||
## Q - Z
|
||||
map $http_referer $bad_urls4 {
|
||||
default 0;
|
||||
~(?i)(^http://(www\.)?quality-traffic(-|.).*$|^http://(www\.)?registrarprice(-|.).*$|^http://(www\.)?reliableresults(-|.).*$|^http://(www\.)?rimpim(-|.).*$|^http://(www\.)?ro7kalbe(-|.).*$|^http://(www\.)?rohkalby(-|.).*$|^http://(www\.)?ronnieazza(-|.).*$|^http://(www\.)?rulo.biz(-|.).*$|^http://(www\.)?responsinator(-|.).*$|^http://(www\.)?s5(-|.).*$|^http://(www\.)?samiuls(-|.).*$|^http://(www\.)?savefrom(-|.).*$|^http://(www\.)?savetubevideo.com(-|.).*$|^http://(www\.)?screentoolkit.com(-|.).*$|^http://(www\.)?searchedu(-|.).*$|^http://(www\.)?semalt.com(-|.).*$|^http://(www\.)?seoexperimenty(-|.).*$|^http://(www\.)?seventwentyfour(-|.).*$|^http://(www\.)?seventwentyfour.*$|^http://(www\.)?sex(-|.).*$|^http://(www\.)?sexsearch(-|.).*$|^http://(www\.)?sexsq(-|.).*$|^http://(www\.)?shoesdiscount(-|.).*$|^http://(www\.)?site-4u(-|.).*$|^http://(www\.)?site5(-|.).*$|^http://(www\.)?slatersdvds(-|.).*$|^http://(www\.)?slftsdybbg.ru(-|.).*$|^http://(www\.)?sml338(-|.).*$|^http://(www\.)?sms(-|.).*$|^http://(www\.)?smsportali(-|.).*$|^http://(www\.)?socialseet.ru(-|.).*$|^http://(www\.)?software(-|.).*$|^http://(www\.)?sortthemesitesby(-|.).*$|^http://(www\.)?spears(-|.).*$|^http://(www\.)?spoodles(-|.).*$|^http://(www\.)?sportsparent(-|.).*$|^http://(www\.)?srecorder(-|.).*$|^http://(www\.)?stmaryonline(-|.).*$|^http://(www\.)?superiends.org(-|.).*$|^http://(www\.)?strip(-|.).*$|^http://(www\.)?suttonjames(-|.).*$|^http://(www\.)?talk.uk-yankee(-|.).*$|^http://(www\.)?tecrep-inc(-|.).*$|^http://(www\.)?teen(-|.).*$|^http://(www\.)?terashells(-|.).*$|^http://(www\.)?thatwhichis(-|.).*$|^http://(www\.)?thorcarlson(-|.).*$|^http://(www\.)?.*(-|.)?tits(-|.).*$|^http://(www\.)?.*(-|.)?titten(-|.).*$|^http://(www\.)?tmsathai(-|.).*$|^http://(www\.)?traffixer(-|.).*$|^http://(www\.)?tranny(-|.).*$|^http://(www\.)?valeof(-|.).*$|^http://(www\.)?video(-|.).*$|^http://(www\.)?vinhas(-|.).*$|^http://(www\.)?vixen1(-|.).*$|^http://(www\.)?vpshs(-|.).*$|^http://(www\.)?vrajitor(-|.).*$|^http://(www\.)?vodkoved.ru(-|.).*$|^http://(www\.)?w3md(-|.).*$|^http://(www\.)?websocial.me(-|.).*$|^http://(www\.)?webdevsquare(-|.).*$|^http://(www\.)?whois(-|.).*$|^http://(www\.)?withdrawal(-|.).*$|^http://(www\.)?worldemail(-|.).*$|^http://(www\.)?wslp24(-|.).*$|^http://(www\.)?ws-op(-|.).*$|^http://(www\.)?xnxx(-|.).*$|^http://(www\.)?xopy(-|.).*$|^http://(www\.)?xxx(-|.).*$|^http://(www\.)?yelucie(-|.).*$|^http://(www\.)?youradulthosting(-|.).*$|^http://(www\.)?ykecwqlixx.ru(-|.).*$|^http://(www\.)?yougetsignal.com(-|.).*$|^http://(www\.)?(-|.)zindagi(-|.).*$) 1;
|
||||
}
|
||||
## Domains Linked to Yontoo Browser Malware and a Few Other New Ones
|
||||
## Have split this into it's own section to keep lines shorter NOTE: changes to instructions
|
||||
## adding if ($bad_urls5) and if ($bad_urls6) to your site(s) config.
|
||||
map $http_referer $bad_urls5 {
|
||||
default 0;
|
||||
~(?i)(^http://(www\.)?101raccoon.ru(-|.).*$|^http://(www\.)?28n2gl3wfyb0.ru(-|.).*$|^http://(www\.)?627ad6438b58439cad1fc8cf6d67a92e.com(-|.).*$|^http://(www\.)?6ab9743d0152486387559b4abaa02ada.com(-|.).*$|^http://(www\.)?a342ae9750004b14b55f7310eff0ab65.com(-|.).*$|^http://(www\.)?aa08daf7e13b6345e09e92f771507fa5f4.com(-|.).*$|^http://(www\.)?aa14ab57a3339c4064bd9ae6fad7495b5f.com(-|.).*$|^http://(www\.)?aa625d84f1587749c1ab011d6f269f7d64.com(-|.).*$|^http://(www\.)?aa81bf391151884adfa3dd677e41f94be1.com(-|.).*$|^http://(www\.)?aa8780bb28a1de4eb5bff33c28a218a930.com(-|.).*$|^http://(www\.)?aa8b68101d388c446389283820863176e7.com(-|.).*$|^http://(www\.)?aa9bd78f328a6a41279d0fad0a88df1901.com(-|.).*$|^http://(www\.)?aa9d046aab36af4ff182f097f840430d51.com(-|.).*$|^http://(www\.)?aaa38852e886ac4af1a3cff9b47cab6272.com(-|.).*$|^http://(www\.)?aab94f698f36684c5a852a2ef272e031bb.com(-|.).*$|^http://(www\.)?aac500b7a15b2646968f6bd8c6305869d7.com(-|.).*$|^http://(www\.)?aac52006ec82a24e08b665f4db2b5013f7.com(-|.).*$|^http://(www\.)?aad1f4acb0a373420d9b0c4202d38d94fa.com(-|.).*$|^http://(www\.)?asrv-a.akamoihd.net(-|.).*$|^http://(www\.)?asrvrep-a.akamaihd.net(-|.).*$|^http://(www\.)?bestpriceninja.com(-|.).*$|^http://(www\.)?bronzeaid-a.akamaihd.net(-|.).*$|^http://(www\.)?browsepulse-a.akamaihd.net(-|.).*$|^http://(www\.)?cashkitten-a.akamaihd.net(-|.).*$|^http://(www\.)?coolbar.pro(-|.).*$) 1;
|
||||
}
|
||||
map $http_referer $bad_urls6 {
|
||||
default 0;
|
||||
~(?i)(^http://(www\.)?davebestdeals.com(-|.).*$|^http://(www\.)?discovertreasure-a.akamaihd.net(-|.).*$|^http://(www\.)?discovertreasurenow.com(-|.).*$|^http://(www\.)?foxydeal.com(-|.).*$|^http://(www\.)?gameonasia.com(-|.).*$|^http://(www\.)?gameplexcity.com(-|.).*$|^http://(www\.)?gamerextra.com(-|.).*$|^http://(www\.)?gamerscorps.com(-|.).*$|^http://(www\.)?gamewrath.com(-|.).*$|^http://(www\.)?generousdeal-a.akamaihd.net(-|.).*$|^http://(www\.)?girlgamerdaily.com(-|.).*$|^http://(www\.)?hdapp1008-a.akamaihd.net(-|.).*$|^http://(www\.)?highstairs-a.akamaihd.net(-|.).*$|^http://(www\.)?hotshoppymac.com(-|.).*$|^http://(www\.)?matchpal-a.akamaihd.net(-|.).*$|^http://(www\.)?mecash.ru(-|.).*$|^http://(www\.)?monarchfind-a.akamaihd.net(-|.).*$|^http://(www\.)?myshopmatemac.com(-|.).*$|^http://(www\.)?nottyu.xyz(-|.).*$|^http://(www\.)?onlinemegax.com(-|.).*$|^http://(www\.)?outrageousdeal-a.akamaihd.net(-|.).*$|^http://(www\.)?pijoto.net(-|.).*$|^http://(www\.)?recordpage-a.akamaihd.net(-|.).*$|^http://(www\.)?resultshub-a.akamaihd.net(-|.).*$|^http://(www\.)?rvzr-a.akamaihd.net(-|.).*$|^http://(www\.)?savingsslider-a.akamaihd.net(-|.).*$|^http://(www\.)?searchinterneat-a.akamaihd.net(-|.).*$|^http://(www\.)?searchwebknow-a.akamaihd.net(-|.).*$|^http://(www\.)?seeresultshub-a.akamaihd.net(-|.).*$|^http://(www\.)?shoppytoolmac.com(-|.).*$|^http://(www\.)?skytraf.xyz(-|.).*$|^http://(www\.)?splendorsearch-a.akamaihd.net(-|.).*$|^http://(www\.)?strongsignal-a.akamaihd.net(-|.).*$|^http://(www\.)?surfbuyermac.com(-|.).*$|^http://(www\.)?treasuretrack-a.akamaihd.net(-|.).*$|^http://(www\.)?webshoppermac.com(-|.).*$|^http://(www\.)?pospr.waw.pl(-|.).*$|^http://(www\.)?abclauncher.com(-|.).*$|^http://(www\.)?alert-fjg.xyz(-|.).*$|^http://(www\.)?analytics-ads.xyz(-|.).*$|^http://(www\.)?bamo.xsl.pt(-|.).*$|^http://(www\.)?compliance-olga.top(-|.).*$|^http://(www\.)?digital-video-processing.com(-|.).*$|^http://(www\.)?eu-cookie-law.info(-|.).*$|^http://(www\.)?findpik.com(-|.).*$|^http://(www\.)?forum20.smailik.org(-|.).*$|^http://(www\.)?free-share-buttons.top(-|.).*$|^http://(www\.)?free-social-buttons2.xyz(-|.).*$|^http://(www\.)?free-social-buttons3.xyz(-|.).*$|^http://(www\.)?free-social-buttons4.xyz(-|.).*$|^http://(www\.)?free-social-buttons5.xyz(-|.).*$|^http://(www\.)?front.to(-|.).*$|^http://(www\.)?infokonkurs.ru(-|.).*$|^http://(www\.)?mapquestz.us(-|.).*$|^http://(www\.)?quick-offer.com(-|.).*$|^http://(www\.)?rank-checker.online(-|.).*$|^http://(www\.)?rankchecker.online(-|.).*$|^http://(www\.)?rapidokbrain.com(-|.).*$|^http://(www\.)?real-time-analytics.com(-|.).*$|^http://(www\.)?sharebutton.net(-|.).*$|^http://(www\.)?sharebutton.org(-|.).*$|^http://(www\.)?shemale-sex.net(-|.).*$|^http://(www\.)?site-speed-check.site(-|.).*$|^http://(www\.)?site-speed-checker.site(-|.).*$|^http://(www\.)?trafficmania.com(-|.).*$|^http://(www\.)?website-speed-up.site(-|.).*$|^http://(www\.)?website-speed-up.top(-|.).*$|^http://(www\.)?xn--80aagddcgkbcqbad7amllnejg6dya.xn--p1ai(-|.).*$|^http://(www\.)?xn--80aikhbrhr.net(-|.).*$|^http://(www\.)?pila.pl(-|.).*$|^http://(www\.)?dytohqka.su(-|.).*$|^http://(www\.)?fqvjhqciw.net.ru(-|.).*$|^http://(www\.)?wycjrqzy.ua(-|.).*$|^http://(www\.)?0ca29773681c7e82.com(-|.).*$|^http://(www\.)?intervsem.ru(-|.).*$|^http://(www\.)?candy-glam-hp.com(-|.).*$|^http://(www\.)?thecoolimages.net(-|.).*$|^http://(www\.)?rebuildermedical.com(-|.).*$|^http://(www\.)?gaygalls.net(-|.).*$|^http://(www\.)?keywordteam.net(-|.).*$|^http://(www\.)?netfacet.net(-|.).*$|^http://(www\.)?pattersonsweb.com(-|.).*$|^http://(www\.)?trapit.com.gg(-|.).*$) 1;
|
||||
}
|
||||
## Add here all hosts that should be spared any referrer checking.
|
||||
## Whitelist all your own IPs in this section, each IP followed by a 0;
|
||||
geo $bad_referer {
|
||||
127.0.0.1 0;
|
||||
111.111.111.111 0;
|
||||
}
|
||||
|
||||
# Geo directive to deny certain ip addresses
|
||||
geo $validate_client {
|
||||
default 0;
|
||||
|
||||
# Cyveillance
|
||||
38.100.19.8/29 1;
|
||||
38.100.21.0/24 1;
|
||||
38.100.41.64/26 1;
|
||||
38.105.71.0/25 1;
|
||||
38.105.83.0/27 1;
|
||||
38.112.21.140/30 1;
|
||||
38.118.42.32/29 1;
|
||||
65.213.208.128/27 1;
|
||||
65.222.176.96/27 1;
|
||||
65.222.185.72/29 1;
|
||||
}
|
||||
209
nginx/default.conf
Normal file
209
nginx/default.conf
Normal file
@@ -0,0 +1,209 @@
|
||||
server_names_hash_bucket_size 64;
|
||||
proxy_headers_hash_bucket_size 512;
|
||||
server_names_hash_max_size 512;
|
||||
large_client_header_buffers 8 64k;
|
||||
proxy_read_timeout 3600;
|
||||
proxy_connect_timeout 3600;
|
||||
|
||||
|
||||
# include configs for spamers, bad bots to reject
|
||||
include /customization/blacklist.conf;
|
||||
|
||||
|
||||
# Rate limit configurations
|
||||
limit_req_zone $binary_remote_addr zone=all:10m rate=20r/s;
|
||||
|
||||
map $http_user_agent $limit_bots {
|
||||
default '';
|
||||
~*(google|bing|yandex|msnbot|baidu|crawler|robot) $binary_remote_addr;
|
||||
}
|
||||
limit_req_zone $limit_bots zone=bots:10m rate=2r/m;
|
||||
|
||||
# Connect to the Arches Django app running with
|
||||
# Gunicorn. Note, you need to match more than the port
|
||||
# number, you need match the Docker container NAME where
|
||||
# we've launched the Arches Djagno app.
|
||||
upstream django {
|
||||
server arches:8000;
|
||||
}
|
||||
|
||||
upstream mapas {
|
||||
server pg_tilesrv:7800;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
charset utf-8;
|
||||
server_name ${DEPLOY_HOST} www.${DEPLOY_HOST};
|
||||
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
default_type "text/plain";
|
||||
autoindex on;
|
||||
allow all;
|
||||
root /var/www/certbot/$host;
|
||||
}
|
||||
|
||||
access_log /logs/nginx/access.log;
|
||||
error_log /logs/nginx/error.log;
|
||||
|
||||
proxy_read_timeout 3600;
|
||||
|
||||
proxy_set_header X-Forwarded-Protocol $scheme;
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_types text/plain text/css application/json application/ld+json
|
||||
application/geo+json text/xml application/xml application/xml+rss
|
||||
text/javascript application/javascript text/html;
|
||||
|
||||
# block the evil spammers and bad bots
|
||||
if ($bad_bot) {
|
||||
return 444;
|
||||
}
|
||||
if ($bad_referer_block) {
|
||||
return 444;
|
||||
}
|
||||
if ($bad_urls1) {
|
||||
return 403;
|
||||
}
|
||||
if ($bad_urls2) {
|
||||
return 403;
|
||||
}
|
||||
if ($bad_urls3) {
|
||||
return 403;
|
||||
}
|
||||
if ($bad_urls4) {
|
||||
return 403;
|
||||
}
|
||||
if ($bad_urls5) {
|
||||
return 403;
|
||||
}
|
||||
if ($bad_urls6) {
|
||||
return 403;
|
||||
}
|
||||
|
||||
location /.nginx {
|
||||
alias /var/www/html/${DEPLOY_HOST};
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
|
||||
server_name ${DEPLOY_HOST} www.${DEPLOY_HOST};
|
||||
access_log /logs/nginx/ssl_access.log;
|
||||
error_log /logs/nginx/ssl_error.log;
|
||||
|
||||
proxy_set_header X-Forwarded-Protocol $scheme;
|
||||
proxy_read_timeout 3600;
|
||||
|
||||
ssl_certificate /etc/symb_link_ssl/fullchain.pem;
|
||||
ssl_certificate_key /etc/symb_link_ssl/privkey.pem;
|
||||
|
||||
include /etc/nginx/options-ssl-nginx.conf;
|
||||
|
||||
ssl_dhparam /etc/nginx/sites/ssl/ssl-dhparams.pem;
|
||||
|
||||
include /etc/nginx/hsts.conf;
|
||||
|
||||
# Allows upload of up to a 100MB file
|
||||
client_max_body_size 100M;
|
||||
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_types text/plain text/css application/json application/ld+json
|
||||
application/geo+json text/xml application/xml application/xml+rss
|
||||
text/javascript application/javascript text/html;
|
||||
|
||||
# block the evil spammers and bad bots
|
||||
if ($bad_bot) {
|
||||
return 444;
|
||||
}
|
||||
if ($bad_referer_block) {
|
||||
return 444;
|
||||
}
|
||||
if ($bad_urls1) {
|
||||
return 403;
|
||||
}
|
||||
if ($bad_urls2) {
|
||||
return 403;
|
||||
}
|
||||
if ($bad_urls3) {
|
||||
return 403;
|
||||
}
|
||||
if ($bad_urls4) {
|
||||
return 403;
|
||||
}
|
||||
if ($bad_urls5) {
|
||||
return 403;
|
||||
}
|
||||
if ($bad_urls6) {
|
||||
return 403;
|
||||
}
|
||||
|
||||
location /pgtileserv/ {
|
||||
proxy_pass http://mapas/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
}
|
||||
|
||||
location /.nginx {
|
||||
autoindex on;
|
||||
alias /var/www/html/${DEPLOY_HOST};
|
||||
}
|
||||
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
default_type "text/plain";
|
||||
autoindex on;
|
||||
allow all;
|
||||
root /var/www/certbot/$host;
|
||||
}
|
||||
|
||||
# See the nginx docker-compose.yml where we
|
||||
# provide this volume mapping to "static"
|
||||
location /static/ {
|
||||
# Note: No rate limit
|
||||
autoindex on;
|
||||
allow all;
|
||||
alias /static_root/;
|
||||
include /etc/nginx/mime.types;
|
||||
}
|
||||
|
||||
location / {
|
||||
# rate limit
|
||||
limit_req zone=all burst=30;
|
||||
limit_req zone=bots burst=10;
|
||||
try_files $uri @proxy_to_django;
|
||||
}
|
||||
|
||||
location @proxy_to_django {
|
||||
proxy_pass http://django;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1
nginx/hsts.conf
Normal file
1
nginx/hsts.conf
Normal file
@@ -0,0 +1 @@
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
29
nginx/nginx.conf
Normal file
29
nginx/nginx.conf
Normal file
@@ -0,0 +1,29 @@
|
||||
worker_processes 1;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
load_module "modules/ngx_http_perl_module.so";
|
||||
env ENV;
|
||||
env DOMAINS;
|
||||
env FRONTEND;
|
||||
env DJANGO_PORT;
|
||||
env CERT_PATH;
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
http {
|
||||
include mime.types;
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
perl_set $ENV 'sub { return $ENV{"ENV"}; }';
|
||||
perl_set $DOMAINS 'sub { return $ENV{"DOMAINS"}; }';
|
||||
perl_set $DEPLOY_HOST 'sub { return $ENV{"DEPLOY_HOST"}; }';
|
||||
perl_set $DJANGO_PORT 'sub { return $ENV{"DJANGO_PORT"}; }';
|
||||
perl_set $CERT_PATH 'sub { return $ENV{"CERT_PATH"}; }';
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
106
nginx/nginx.sh
Normal file
106
nginx/nginx.sh
Normal file
@@ -0,0 +1,106 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "$DOMAINS" ]; then
|
||||
echo "DOMAINS environment variable is not set"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
use_dummy_certificate() {
|
||||
# Switch sympolic links to reference the apprpriate SSL keys
|
||||
mkdir -p /etc/symb_link_ssl;
|
||||
|
||||
if [ -f "/etc/letsencrypt/live/$1/fullchain.pem" ]; then
|
||||
echo "Nginx to use Let's Encrypt certificate for $1";
|
||||
ln -sfn "/etc/letsencrypt/live/$1/fullchain.pem" /etc/symb_link_ssl/fullchain.pem;
|
||||
ln -sfn "/etc/letsencrypt/live/$1/privkey.pem" /etc/symb_link_ssl/privkey.pem;
|
||||
else
|
||||
echo "Nginx to use dummy (testing) SSL certificate for $1"
|
||||
ln -sfn "/etc/nginx/sites/ssl/dummy/$1/fullchain.pem" /etc/symb_link_ssl/fullchain.pem;
|
||||
ln -sfn "/etc/nginx/sites/ssl/dummy/$1/privkey.pem" /etc/symb_link_ssl/privkey.pem;
|
||||
fi
|
||||
}
|
||||
|
||||
use_lets_encrypt_certificate() {
|
||||
# Switch sympolic links to reference the apprpriate SSL keys
|
||||
mkdir -p /etc/symb_link_ssl;
|
||||
|
||||
if [ -f "/etc/letsencrypt/live/$1/fullchain.pem" ]; then
|
||||
echo "Nginx to use Let's Encrypt certificate for $1";
|
||||
ln -sfn "/etc/letsencrypt/live/$1/fullchain.pem" /etc/symb_link_ssl/fullchain.pem;
|
||||
ln -sfn "/etc/letsencrypt/live/$1/privkey.pem" /etc/symb_link_ssl/privkey.pem;
|
||||
else
|
||||
echo "Nginx to use dummy (testing) SSL certificate for $1"
|
||||
ln -sfn "/etc/nginx/sites/ssl/dummy/$1/fullchain.pem" /etc/symb_link_ssl/fullchain.pem;
|
||||
ln -sfn "/etc/nginx/sites/ssl/dummy/$1/privkey.pem" /etc/symb_link_ssl/privkey.pem;
|
||||
fi
|
||||
}
|
||||
|
||||
reload_nginx() {
|
||||
echo "Reloading Nginx configuration"
|
||||
nginx -s reload;
|
||||
}
|
||||
|
||||
wait_for_lets_encrypt() {
|
||||
certpath_fixed=$(echo "$CERT_PATH" | tr -d \");
|
||||
until [ -d "/etc/letsencrypt/live/$1" ]; do
|
||||
echo "CERT_PATH is apparently $certpath_fixed, with contents: ";
|
||||
ls $certpath_fixed;
|
||||
echo "Waiting for Let's Encrypt certificates for $1";
|
||||
sleep 10s & wait ${!}
|
||||
done
|
||||
use_lets_encrypt_certificate "$1"
|
||||
reload_nginx
|
||||
}
|
||||
|
||||
if [ ! -f /etc/nginx/sites/ssl/ssl-dhparams.pem ]; then
|
||||
mkdir -p "/etc/nginx/sites/ssl"
|
||||
openssl dhparam -out /etc/nginx/sites/ssl/ssl-dhparams.pem 2048
|
||||
fi
|
||||
|
||||
domains_fixed=$(echo "$DOMAINS" | tr -d \")
|
||||
for domain in $domains_fixed; do
|
||||
echo "Checking configuration for $domain"
|
||||
|
||||
echo "Make sure we have a cerbot directory for $domain";
|
||||
mkdir -p /var/www/certbot/$domain;
|
||||
|
||||
echo "Prepping cerbot acme-challenge folder for: $domain"
|
||||
mkdir -p /var/www/certbot/$domain/.well-known/acme-challenge
|
||||
echo "look here for $domain cert dir (deep)!" > /var/www/certbot/$domain/.well-known/acme-challenge/hello.txt;
|
||||
chmod 644 /var/www/certbot/$domain/.well-known/acme-challenge/hello.txt;
|
||||
echo "look here for $domain cert dir (shallow)!" > /var/www/certbot/$domain/hello.txt;
|
||||
chmod 644 /var/www/certbot/$domain/hello.txt;
|
||||
|
||||
if [ ! -f "/etc/nginx/sites/$domain.conf" ]; then
|
||||
echo "Skip creating Nginx configuration file /etc/nginx/sites/$domain.conf"
|
||||
# sed "s/\${domain}/$domain/g" /customization/site.conf.tpl > "/etc/nginx/sites/$domain.conf"
|
||||
fi
|
||||
|
||||
if [ ! -f "/etc/nginx/sites/ssl/dummy/$domain/fullchain.pem" ]; then
|
||||
|
||||
echo "Generating dummy ceritificate for $domain"
|
||||
mkdir -p /etc/nginx/sites/ssl/dummy/$domain
|
||||
printf "[dn]\nCN=${domain}\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:$domain, DNS:www.$domain\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth" > openssl.cnf
|
||||
openssl req -x509 -out "/etc/nginx/sites/ssl/dummy/$domain/fullchain.pem" -keyout "/etc/nginx/sites/ssl/dummy/$domain/privkey.pem" \
|
||||
-newkey rsa:2048 -nodes -sha256 \
|
||||
-subj "/CN=${domain}" -extensions EXT -config openssl.cnf
|
||||
rm -f openssl.cnf
|
||||
|
||||
fi
|
||||
|
||||
if [ ! -d "/etc/letsencrypt/live/$domain" ]; then
|
||||
use_dummy_certificate "$domain"
|
||||
wait_for_lets_encrypt "$domain" &
|
||||
else
|
||||
use_lets_encrypt_certificate "$domain"
|
||||
fi
|
||||
|
||||
echo "-----------------------------------------------";
|
||||
echo "Check out the contents of /static_root/";
|
||||
ls /static_root;
|
||||
echo "-----------------------------------------------";
|
||||
done
|
||||
|
||||
exec nginx -g "daemon off;"
|
||||
8
nginx/options-ssl-nginx.conf
Normal file
8
nginx/options-ssl-nginx.conf
Normal file
@@ -0,0 +1,8 @@
|
||||
ssl_session_cache shared:le_nginx_SSL:10m;
|
||||
ssl_session_timeout 1440m;
|
||||
ssl_session_tickets off;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_prefer_server_ciphers off;
|
||||
|
||||
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
|
||||
11
pgtilesrv_config.sh
Normal file
11
pgtilesrv_config.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
eval MIDOMINIO=$(docker exec arches_db printenv DOMAINS)
|
||||
eval MIPROY=$(docker exec arches_db printenv COMPOSE_PROJECT_NAME)
|
||||
|
||||
MISQL="INSERT INTO map_sources (name, source)
|
||||
VALUES ('ponderacion-pg-tilesrv', '{\"type\": \"vector\", \"tiles\": [\"https://$MIDOMINIO/pgtileserv/public.ponderacion/{z}/{x}/{y}.pbf\"], \"tileSize\": 512}')
|
||||
ON CONFLICT (name)
|
||||
DO UPDATE SET source = EXCLUDED.source;"
|
||||
|
||||
docker exec arches_db psql -U postgres -d $MIPROY -c "$MISQL"
|
||||
Reference in New Issue
Block a user