├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── PULL_REQUEST_TEMPLATE
│ └── pull_request.md
├── .gitignore
├── CODE_OF_CONDUCT.md
├── LICENSE
├── README.md
├── cert
├── .gitignore
└── README.md
├── django
├── Dockerfile
├── README.md
├── gunicorn_config.py
└── supervisord.conf
├── docker-compose.yml
├── memcached
└── Dockerfile
├── nginx
├── .gitignore
├── Dockerfile
├── README.md
└── conf.d
│ ├── includes
│ ├── app_server.conf
│ ├── assets.conf
│ ├── compression.conf
│ ├── frontend.conf
│ ├── security.conf
│ └── ssl.conf
│ └── stencils
│ ├── application.conf
│ ├── logging.conf
│ ├── main.conf
│ ├── redirect.conf
│ └── upstreams.conf
├── postgres
├── .gitignore
├── Dockerfile
├── README.md
├── checkhealth.sh
└── database_stencil.env
├── rabbitmq
├── .gitignore
├── Dockerfile
├── README.md
├── checkhealth.sh
└── message_broker_stencil.env
├── react
└── Dockerfile
├── readme-assets
├── maintainers
│ └── wordmark.svg
└── site
│ └── wordmark.svg
├── redis
├── Dockerfile
└── checkhealth.sh
└── scripts
├── README.md
├── build
├── django.sh
├── memcached.sh
├── nginx.sh
├── postgres.sh
├── rabbitmq.sh
├── react.sh
└── redis.sh
├── clone
├── backend.sh
├── everything.sh
├── frontend.sh
└── utils.sh
└── start
├── development.sh
└── logs.sh
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | ---
6 |
7 | **Describe the bug**
8 | A clear and concise description of what the bug is.
9 |
10 | **To Reproduce**
11 | Steps to reproduce the behavior:
12 |
13 | **Expected behavior**
14 | A clear and concise description of what you expected to happen.
15 |
16 | **Screenshots**
17 | If applicable, add screenshots to help explain your problem.
18 |
19 | **Operating System:**
20 | - OS: [e.g. iOS]
21 | - Browser [e.g. chrome, safari]
22 | - Version [e.g. 22]
23 |
24 | **Additional context**
25 | Add any other context about the problem here.
26 |
27 | **Want to take up?**
28 | Are you interested in and capable of tackling this issue? [yes|no]
29 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | ---
6 |
7 | **Is your feature request related to a problem? Please describe.**
8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9 |
10 | **Describe the solution you'd like**
11 | A clear and concise description of what you want to happen.
12 |
13 | **Describe alternatives you've considered**
14 | A clear and concise description of any alternative solutions or features you've considered.
15 |
16 | **Additional context**
17 | Add any other context or screenshots about the feature request here.
18 |
19 | **Want to take up?**
20 | Are you interested in and capable of tackling this issue? [yes|no]
21 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE/pull_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Pull request
3 | about: Submit a patch to help us improve
4 | title: ''
5 | ---
6 |
7 | **Description**
8 | What does this PR achieve? [feature|hotfix|refactor]
9 |
10 | **Fixes**
11 | Issue # by @
12 |
13 | **Technical**
14 | Notable details about the implementation.
15 |
16 | **Testing**
17 | Steps for the reviewer to verify that this PR fixes the problem:
18 |
19 | **Evidence**
20 | If applicable, add screenshots to show the problem and the solution.
21 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # IntelliJ configuration
2 | .idea/
3 |
4 | # VSCode configuration
5 | .vscode/
6 |
7 | # Codebase (backend and frontend)
8 | codebase/
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at img@iitr.ac.in. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
77 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) {year} {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | {project} Copyright (C) {year} {fullname}
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | > The Docker of the one true portal for any and every educational institute
4 |
5 | ## Docker distribution
6 |
7 | This is the official Docker distribution of Omniport. Do note that although
8 | every effort has been made to generalise this Docker container set, this
9 | distribution involves a lot of assumptions and sensible defaults, changing which
10 | will probably lead to a lot of anguish.
11 |
12 | ## Technological stack
13 |
14 | - Containerisation: `Docker`
15 | - Orchestration: `Docker Compose`
16 |
17 | This Dockerised setup is the preferred mode of installation. You can however set
18 | all the components up yourself, after suffering a reasonable amount of
19 | headbanging, cursing, and physical and mental pain.
20 |
21 | ## Contribution guidelines
22 |
23 | - Fork the repository to your account.
24 | - Branch out to `a_meaningful_branch_name`.
25 | - Send in a `WIP: Pull request`.
26 | - Commit your changes.
27 | - Add your name to `CONTRIBUTORS.md`.
28 | - Get your pull request merged.
29 |
30 | It's that simple!
31 |
32 | ## Credits
33 |
34 |
35 |
--------------------------------------------------------------------------------
/cert/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore the private key
2 | omniport.key
3 |
4 | # Ignore the certificate
5 | omniport.crt
--------------------------------------------------------------------------------
/cert/README.md:
--------------------------------------------------------------------------------
1 | # Cert
2 |
3 | Place your SSL files in this directory and choose to enable SSL during the build
4 | process of the NGINX image.
5 |
6 | The files that are required are
7 | - `omniport.crt`: the certificate provided by the CA
8 | - `omniport.key`: the private key generated on the server
--------------------------------------------------------------------------------
/django/Dockerfile:
--------------------------------------------------------------------------------
1 | # Use Python from the Debian Linux project
2 | FROM python:3.10.2-slim-bullseye
3 |
4 | # Add labels for metadata
5 | LABEL maintainer="Dhruv Bhanushali "
6 |
7 | # Determines whether to build a production or a development package
8 | ARG IMAGETYPE
9 |
10 | # Create a non-root user
11 | RUN groupadd --system django && useradd --system --gid django django
12 |
13 | # Install dependencies
14 | RUN apt-get update \
15 | && apt-get install -y build-essential gcc libcairo2 libffi-dev \
16 | libgdk-pixbuf2.0-0 libpango-1.0-0 libpangocairo-1.0-0 poppler-utils \
17 | python3-cffi shared-mime-info curl\
18 | && rm -rf /var/lib/apt/lists/*
19 |
20 | # Install pip packages
21 | RUN pip install --upgrade pip \
22 | && pip install --upgrade setuptools \
23 | && pip install --upgrade supervisor
24 |
25 | # Install poetry for dependency management
26 | RUN curl -sSL https://install.python-poetry.org | python3 -
27 |
28 | # Add poetry to PATH
29 | ENV PATH="/root/.local/bin:$PATH"
30 |
31 | # Work in the root directory of the container
32 | WORKDIR /
33 |
34 | # Copy the file Pipfile.lock over to the container
35 | # This command implies an image rebuild when PyPI requirements change
36 | COPY ./pyproject.toml ./pyproject.toml
37 | COPY ./poetry.lock ./poetry.lock
38 |
39 | # Install dependencies from the file Pipfile.lock
40 | # Depending on build args, dev packages may not be installed
41 | RUN poetry config virtualenvs.create false \
42 | && poetry install
43 |
44 | # Create the static files volume as a directory
45 | RUN mkdir -p /static_files \
46 | && chown django:django /static_files \
47 | && chmod -R o+r /static_files
48 |
49 | # Create the media files volume as a directory
50 | RUN mkdir -p /media_files \
51 | && chown -R django:django /media_files \
52 | && chmod -R o+r /media_files
53 |
54 | # Create the personal files volume as a directory
55 | RUN mkdir -p /personal_files \
56 | && chown -R django:django /personal_files \
57 | && chmod -R o+r /personal_files
58 |
59 | # Create the supervisor configuration files volume as a directory
60 | RUN mkdir -p /supervisor.d \
61 | && chown -R django:django /supervisor.d \
62 | && chmod -R o+r /supervisor.d
63 |
64 | # Create the web server logs volume as a directory
65 | RUN mkdir -p /web_server_logs/supervisord_logs \
66 | && mkdir -p /web_server_logs/gunicorn_logs \
67 | && mkdir -p /web_server_logs/daphne_logs \
68 | && mkdir -p /web_server_logs/server_logs \
69 | && chown -R django:django /web_server_logs \
70 | && chmod -R o+r /web_server_logs
71 |
72 | # Create the history volume as a directory
73 | RUN mkdir -p /.history \
74 | && chown django:django /.history \
75 | && chmod -R o+r /.history
76 |
77 | # Change the directories into volumes
78 | VOLUME /static_files /media_files /personal_files /web_server_logs /supervisor.d /.history
79 | # Copy the supervisord.conf file over to the container
80 | COPY ./supervisord.conf ./supervisord.conf
81 |
82 | # Copy the gunicorn_config.py file over to the container
83 | COPY ./gunicorn_config.py ./gunicorn_config.py
84 |
85 | # Grant read rights to supervisord.conf and gunicorn_config.py
86 | RUN chown django:django ./supervisord.conf \
87 | && chown django:django ./gunicorn_config.py
88 |
89 | # Define environment variables
90 | ENV PYTHONPATH="/omniport:/omniport/core:/omniport/services:/omniport/apps"
91 | ENV HISTFILE="/.history/.bash_history"
92 | ENV IPYTHONDIR="/.history/.ipython/"
93 |
94 | # Add some terminal jazz
95 | RUN echo "PS1='docker@\$NAME:\w\$ '" >> /etc/bash.bashrc
96 |
97 | # Enter the omniport directory
98 | WORKDIR /omniport
99 |
--------------------------------------------------------------------------------
/django/README.md:
--------------------------------------------------------------------------------
1 | # Django
2 |
3 | Docker service name: `intranet-server` and `internet-server`
4 |
5 | Running applications:
6 | - `Gunicorn`
7 | - `Daphne`
8 | - `Supervisor`
9 |
10 | Folder contents:
11 | - `Dockerfile`: A Dockerfile is the recipe to build a Docker image.
12 | - `gunicorn_config.py`: This file contains configuration parameters for `Gunicorn` such as the binding interface and the port.
13 | - `supervisord.conf`: This file contains configuration parameters for `Supervisor` such as the software to run and the settings to run them with.
14 |
15 | ## Description
16 |
17 | Omniport serves application requests through either `Gunicorn` or `Daphne`, managed by `Supervisor`. This folder contains the Dockerfile required to build the image.
18 |
19 | The decision of the upstream server is based on whether the request is a plain old HTTP request (`Gunicorn` has the speed to beat) or whether it requires HTTP/2 and related technology like WebSockets and Long-polling (which are `Daphne`'s core strength). `Supervisor` makes sure both services are kept up at the specified ports, so that `NGINX` can proxy the request to the right upstream server.
--------------------------------------------------------------------------------
/django/gunicorn_config.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | bind = '0.0.0.0:8000'
4 |
5 | reload = True
6 |
7 | site_id = int(os.getenv('SITE_ID', '0'))
8 | accesslog = f'/web_server_logs/gunicorn_logs/{site_id}-access.log'
9 | errorlog = f'/web_server_logs/gunicorn_logs/{site_id}-error.log'
--------------------------------------------------------------------------------
/django/supervisord.conf:
--------------------------------------------------------------------------------
1 | [supervisord]
2 | nodaemon=true
3 |
4 | pidfile=/tmp/supervisord.pid
5 |
6 | logfile=/web_server_logs/supervisord_logs/self-%(ENV_SITE_ID)s.log
7 | logfile_maxbytes=1048576
8 | logfile_backups=32
9 |
10 | [program:gunicorn]
11 | environment=SERVER="gunicorn"
12 | command=gunicorn -c /gunicorn_config.py omniport.wsgi
13 |
14 | stdout_logfile=/web_server_logs/supervisord_logs/gunicorn-%(ENV_SITE_ID)s-stdout.log
15 | stdout_logfile_maxbytes=1048576
16 | stdout_logfile_backups=32
17 |
18 | stderr_logfile=/web_server_logs/supervisord_logs/gunicorn-%(ENV_SITE_ID)s-stderr.log
19 | stderr_logfile_maxbytes=1048576
20 | stderr_logfile_backups=32
21 |
22 | [program:daphne]
23 | environment=SERVER="daphne"
24 | command=daphne -b 0.0.0.0 -p 8001 omniport.asgi:application --access-log /web_server_logs/daphne_logs/%(ENV_SITE_ID)s-access.log
25 |
26 | stdout_logfile=/web_server_logs/supervisord_logs/daphne-%(ENV_SITE_ID)s-stdout.log
27 | stdout_logfile_maxbytes=1048576
28 | stdout_logfile_backups=32
29 |
30 | stderr_logfile=/web_server_logs/supervisord_logs/daphne-%(ENV_SITE_ID)s-stderr.log
31 | stderr_logfile_maxbytes=1048576
32 | stderr_logfile_backups=32
33 |
34 | [include]
35 | files = /supervisor.d/*.conf
36 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # The version of the docker-compose standard being followed here
2 | version: '3.4'
3 |
4 | # Services are groups of containers handling one aspect of the application
5 | services:
6 | database: # PostgreSQL
7 | # Use the PostgreSQL image we made ourselves by running ./scripts/build/postgres.sh
8 | image: omniport-postgres:latest
9 |
10 | # No matter what, if the container stops, start it again
11 | restart: always
12 |
13 | # Check the health of the container periodically
14 | healthcheck:
15 | test: ['CMD', 'checkhealth']
16 | retries: 4
17 |
18 | interval: 16m
19 | timeout: 16s
20 | start_period: 2m
21 |
22 | # Expose the port 5432 used by PostgreSQL to other containers
23 | expose:
24 | - "5432"
25 |
26 | # Run the container as the non-root user
27 | user: postgres
28 |
29 | # Set the environment variables
30 | env_file:
31 | - postgres/database.env
32 |
33 | # Mount the volumes on the database container
34 | volumes:
35 | # Mount 'database' as the place where PostgreSQL stores all its data
36 | - type: volume
37 | source: database
38 | target: /var/lib/postgresql/data
39 | read_only: false
40 |
41 | # Connect to the custom default network
42 | networks:
43 | - network
44 |
45 | channel-layer: # Redis
46 | # Use the Redis image we made ourselves by running ./scripts/build/redis.sh
47 | image: omniport-redis:latest
48 |
49 | # Check the health of the container periodically
50 | healthcheck:
51 | test: ['CMD', 'checkhealth']
52 | retries: 4
53 |
54 | interval: 16m
55 | timeout: 16s
56 | start_period: 2m
57 |
58 | # No matter what, if the container stops, start it again
59 | restart: always
60 |
61 | # Expose the port 6379 used by Redis to other containers
62 | expose:
63 | - "6379"
64 |
65 | # Run the container as the non-root user
66 | user: redis
67 |
68 | # Mount the volumes on the channel layer container
69 | volumes:
70 | # Mount 'channel_layer' as the place where Redis stores its dumps
71 | - type: volume
72 | source: channel_layer
73 | target: /data
74 | read_only: false
75 |
76 | # Connect to the custom default network
77 | networks:
78 | - network
79 |
80 | session-store: # Redis
81 | # Use the Redis image we made ourselves by running ./scripts/build/redis.sh
82 | image: omniport-redis:latest
83 |
84 | # Check the health of the container periodically
85 | healthcheck:
86 | test: ['CMD', 'checkhealth']
87 | retries: 4
88 |
89 | interval: 16m
90 | timeout: 16s
91 | start_period: 2m
92 |
93 | # No matter what, if the container stops, start it again
94 | restart: always
95 |
96 | # Expose the port 6379 used by Redis to other containers
97 | expose:
98 | - "6379"
99 |
100 | # Run the container as the non-root user
101 | user: redis
102 |
103 | # Mount the volumes on the session store container
104 | volumes:
105 | # Mount 'session_store' as the place where Redis stores all its dumps
106 | - type: volume
107 | source: session_store
108 | target: /data
109 | read_only: false
110 |
111 | # Connect to the custom default network
112 | networks:
113 | - network
114 |
115 | communication-store: # Redis
116 | # Use the Redis image we made ourselves by running ./scripts/build/redis.sh
117 | image: omniport-redis:latest
118 |
119 | # Check the health of the container periodically
120 | healthcheck:
121 | test: ['CMD', 'checkhealth']
122 | retries: 4
123 |
124 | interval: 16m
125 | timeout: 16s
126 | start_period: 2m
127 |
128 | # No matter what, if the container stops, start it again
129 | restart: always
130 |
131 | # Expose the port 6379 used by Redis to other containers
132 | expose:
133 | - "6379"
134 |
135 | # Run the container as the non-root user
136 | user: redis
137 |
138 | # Mount the volumes on the communication store container
139 | volumes:
140 | # Mount 'communication_store' as the place where Redis stores its dumps
141 | - type: volume
142 | source: communication_store
143 | target: /data
144 | read_only: false
145 |
146 | # Connect to the custom default network
147 | networks:
148 | - network
149 |
150 | verification-store: # Redis
151 | # Use the Redis image we made ourselves by running ./scripts/build/redis.sh
152 | image: omniport-redis:latest
153 |
154 | # Check the health of the container periodically
155 | healthcheck:
156 | test: ['CMD', 'checkhealth']
157 | retries: 4
158 |
159 | interval: 16m
160 | timeout: 16s
161 | start_period: 2m
162 |
163 | # No matter what, if the container stops, start it again
164 | restart: always
165 |
166 | # Expose the port 6379 used by Redis to other containers
167 | expose:
168 | - "6379"
169 |
170 | # Run the container as the non-root user
171 | user: redis
172 |
173 | # Mount the volumes on the session store container
174 | volumes:
175 | # Mount 'verification_store' as the place where Redis stores all its dumps
176 | - type: volume
177 | source: verification_store
178 | target: /data
179 | read_only: false
180 |
181 | # Connect to the custom default network
182 | networks:
183 | - network
184 |
185 | application-store: # Redis
186 | # Use the Redis image we made ourselves by running ./scripts/build/redis.sh
187 | image: omniport-redis:latest
188 |
189 | # Check the health of the container periodically
190 | healthcheck:
191 | test: ['CMD', 'checkhealth']
192 | retries: 4
193 |
194 | interval: 16m
195 | timeout: 16s
196 | start_period: 2m
197 |
198 | # No matter what, if the container stops, start it again
199 | restart: always
200 |
201 | # Expose the port 6379 used by Redis to other containers
202 | expose:
203 | - "6379"
204 |
205 | # Run the container as the non-root user
206 | user: redis
207 |
208 | # Mount the volumes on the application store container
209 | volumes:
210 | # Mount 'application_store' as the place where Redis stores all its dumps
211 | - type: volume
212 | source: application_store
213 | target: /data
214 | read_only: false
215 |
216 | # Connect to the custom default network
217 | networks:
218 | - network
219 |
220 | redis-gui: # Redis Commander
221 | # Use the Redis Commander image as is
222 | image: rediscommander/redis-commander:latest
223 |
224 | # Check the health of the container periodically
225 | healthcheck:
226 | test: ['CMD', 'nc', '-z', '127.0.0.1', '8081']
227 | retries: 4
228 |
229 | interval: 16m
230 | timeout: 16s
231 | start_period: 2m
232 |
233 | # No matter what, if the container stops, start it again
234 | restart: always
235 |
236 | # Expose the port 8081 used by Redis commander to the host
237 | ports:
238 | - "8081:8081"
239 |
240 | # Set the REDIS_HOSTS environment variable so that the Redis servers can be connected
241 | environment:
242 | - 'REDIS_HOSTS=
243 | channel-layer:channel-layer,
244 | session-store:session-store,
245 | communication-store:communication-store,
246 | application-store:application-store,
247 | verification-store:verification-store'
248 |
249 | # The services that need to be ready before this one
250 | depends_on:
251 | - channel-layer
252 | - session-store
253 | - communication-store
254 | - verification-store
255 |
256 | # Connect to the custom default network
257 | networks:
258 | - network
259 |
260 | cache: # Memcached
261 | # Use the Memcached image we made ourselves by running ./scripts/build/memcached.sh
262 | image: omniport-memcached:latest
263 |
264 | # Check the health of the container periodically
265 | healthcheck:
266 | test: ['CMD', 'netcat', '-z', '127.0.0.1', '11211']
267 | retries: 4
268 |
269 | interval: 16m
270 | timeout: 16s
271 | start_period: 2m
272 |
273 | # No matter what, if the container stops, start it again
274 | restart: always
275 |
276 | # Expose the port 5672 used by RabbitMQ to other containers
277 | expose:
278 | - "11211"
279 |
280 | # Run the container as the non-root user
281 | user: memcache
282 |
283 | # Connect to the custom default network
284 | networks:
285 | - network
286 |
287 | message-broker: # RabbitMQ
288 | # Use the RabbitMQ image we made ourselves by running ./scripts/build/rabbitmq.sh
289 | image: omniport-rabbitmq:latest
290 |
291 | # Check the health of the container periodically
292 | healthcheck:
293 | test: ['CMD', 'checkhealth']
294 | retries: 4
295 |
296 | interval: 16m
297 | timeout: 16s
298 | start_period: 2m
299 |
300 | # No matter what, if the container stops, start it again
301 | restart: always
302 |
303 | # Expose the port 5672 used by RabbitMQ to other containers
304 | expose:
305 | - "5672"
306 |
307 | # Expose the ports 15672 to the host at 5672 and 15672
308 | ports:
309 | - "15672:15672"
310 |
311 | # Run the container as the non-root user
312 | user: rabbitmq
313 |
314 | # Set the environment variables
315 | env_file:
316 | - rabbitmq/message_broker.env
317 |
318 | # Mount the volumes on the message broker container
319 | volumes:
320 | # Mount 'rabbitmq-data' as the place where RabbitMQ stores its data
321 | - type: volume
322 | source: rabbitmq_data
323 | target: /var/lib/rabbitmq
324 | read_only: false
325 |
326 | # Connect to the custom default network
327 | networks:
328 | - network
329 |
330 | intranet-server: # Django = Gunicorn + Daphne
331 | # Use the Django image we made ourselves by running ./scripts/build/django.sh
332 | image: omniport-django:latest
333 |
334 | # No matter what, if the container stops, start it again
335 | restart: always
336 |
337 | # Expose the ports 8000 and 8001 used by Gunicorn and Daphne to other containers
338 | expose:
339 | - "8000"
340 | - "8001"
341 |
342 | # Run the container as the non-root user
343 | user: django
344 |
345 | # Set the SITE_ID environment variable so that the right YAML is processed
346 | environment:
347 | - SITE_ID=1
348 | - NAME=intranet-server
349 |
350 | command: ["supervisord", "-c", "/supervisord.conf"]
351 |
352 | # Mount the volumes on the Django container
353 | volumes:
354 | # Mount the code from the 'omniport' folder in the root of the container
355 | - type: bind
356 | source: ./codebase/omniport-backend/omniport
357 | target: /omniport
358 | read_only: true
359 |
360 | # Mount the YAML files from the 'configuration' folder in the root of the container
361 | - type: bind
362 | source: ./codebase/omniport-backend/configuration
363 | target: /configuration
364 | read_only: true
365 |
366 | # Mount the imagery from the 'branding' folder in the root of the container
367 | - type: bind
368 | source: ./codebase/omniport-backend/branding
369 | target: /branding
370 | read_only: true
371 |
372 | # Mount the third-party service certificates from the 'certificates' folder in the root of the container
373 | - type: bind
374 | source: ./codebase/omniport-backend/certificates
375 | target: /certificates
376 | read_only: true
377 |
378 | # Mount 'network_storage' as 'network_storage' in the root of the container
379 | - type: bind
380 | source: ./codebase/omniport-backend/network_storage
381 | target: /network_storage
382 | read_only: false
383 |
384 | # Mount 'static_files' as its namesake in the root of the container
385 | - type: volume
386 | source: static_files
387 | target: /static_files
388 | read_only: false
389 |
390 | # Mount 'media_files' as its namesake in the root of the container
391 | - type: volume
392 | source: media_files
393 | target: /media_files
394 | read_only: false
395 |
396 | # Mount 'personal_files' as its namesake in the root of the container
397 | - type: volume
398 | source: personal_files
399 | target: /personal_files
400 | read_only: false
401 |
402 | # Mount 'supervisor.d' as its namesake in the root of the container
403 | - type: volume
404 | source: supervisor.d
405 | target: /supervisor.d
406 | read_only: false
407 |
408 | # Mount 'web_server_logs' as its namesake in the root of the container
409 | - type: volume
410 | source: web_server_logs
411 | target: /web_server_logs
412 | read_only: false
413 |
414 | # mount '.history' as its namesake in the root of the container
415 | - type: volume
416 | source: .history
417 | target: /.history
418 | read_only: false
419 |
420 | # The services that need to be ready before this one
421 | depends_on:
422 | - database
423 | - channel-layer
424 | - session-store
425 | - communication-store
426 | - application-store
427 | - message-broker
428 |
429 | # Connect to the custom default network
430 | networks:
431 | - network
432 |
433 | internet-server: # Django = Gunicorn + Daphne
434 | # Use the Django image we made ourselves by running ./scripts/build/django.sh
435 | image: omniport-django:latest
436 |
437 | # No matter what, if the container stops, start it again
438 | restart: always
439 |
440 | # Expose the ports 8000 and 8001 used by Gunicorn and Daphne to other containers
441 | expose:
442 | - "8000"
443 | - "8001"
444 |
445 | # Run the container as the non-root user
446 | user: django
447 |
448 | # Set the SITE_ID environment variable so that the right YAML is processed
449 | environment:
450 | - SITE_ID=2
451 | - NAME=internet-server
452 |
453 | command: ["supervisord", "-c", "/supervisord.conf"]
454 |
455 | # Mount the volumes on the Django container
456 | volumes:
457 | # Mount the code from the 'omniport' folder in the root of the container
458 | - type: bind
459 | source: ./codebase/omniport-backend/omniport
460 | target: /omniport
461 | read_only: true
462 |
463 | # Mount the YAML files from the 'configuration' folder in the root of the container
464 | - type: bind
465 | source: ./codebase/omniport-backend/configuration
466 | target: /configuration
467 | read_only: true
468 |
469 | # Mount the imagery from the 'branding' folder in the root of the container
470 | - type: bind
471 | source: ./codebase/omniport-backend/branding
472 | target: /branding
473 | read_only: true
474 |
475 | # Mount the third-party service certificates from the 'certificates' folder in the root of the container
476 | - type: bind
477 | source: ./codebase/omniport-backend/certificates
478 | target: /certificates
479 | read_only: true
480 |
481 | # Mount a network storage form the 'network_storage' folder in the root of the container
482 | - type: bind
483 | source: ./codebase/omniport-backend/network_storage
484 | target: /network_storage
485 | read_only: false
486 |
487 | # Mount 'static_files' as its namesake in the root of the container
488 | - type: volume
489 | source: static_files
490 | target: /static_files
491 | read_only: false
492 |
493 | # Mount 'media_files' as its namesake in the root of the container
494 | - type: volume
495 | source: media_files
496 | target: /media_files
497 | read_only: false
498 |
499 | # Mount 'personal_files' as its namesake in the root of the container
500 | - type: volume
501 | source: personal_files
502 | target: /personal_files
503 | read_only: false
504 |
505 | # Mount 'supervisor.d' as its namesake in the root of the container
506 | - type: volume
507 | source: supervisor.d
508 | target: /supervisor.d
509 | read_only: false
510 |
511 | # Mount 'web_server_logs' as its namesake in the root of the container
512 | - type: volume
513 | source: web_server_logs
514 | target: /web_server_logs
515 | read_only: false
516 |
517 | # Mount '.history' as its namesake in the root of the container
518 | - type: volume
519 | source: .history
520 | target: /.history
521 | read_only: false
522 |
523 | # The services that need to be ready before this one
524 | depends_on:
525 | - database
526 | - channel-layer
527 | - session-store
528 | - communication-store
529 | - application-store
530 | - message-broker
531 |
532 | # Connect to the custom default network
533 | networks:
534 | - network
535 |
536 | reverse-proxy: # NGINX
537 | # Use the NGINX image we made ourselves by running ./scripts/build/nginx.sh
538 | image: omniport-nginx:latest
539 |
540 | # No matter what, if the container stops, start it again
541 | restart: always
542 |
543 | # Expose the port 80 and 443 used by NGINX to other containers
544 | expose:
545 | - "80"
546 | - "443"
547 |
548 | # Expose the ports 80 and 443 used by NGINX to the host
549 | ports:
550 | - "80:80"
551 | - "443:443"
552 |
553 | # Mount the volumes on the NGINX container
554 | volumes:
555 | # Mount the imagery from the 'branding' folder in the root of the container
556 | - type: bind
557 | source: ./codebase/omniport-backend/branding
558 | target: /branding
559 | read_only: true
560 |
561 | # Mount 'build' as 'frontend' in the root of the container
562 | - type: bind
563 | source: ./codebase/omniport-frontend/omniport/build
564 | target: /frontend
565 | read_only: true
566 |
567 | # Mount 'network_storage' as 'network_storage' in the root of the container
568 | - type: bind
569 | source: ./codebase/omniport-backend/network_storage
570 | target: /network_storage
571 | read_only: true
572 |
573 | # Mount 'cert' as 'cert' in the root of the container
574 | - type: bind
575 | source: ./cert
576 | target: /cert
577 | read_only: true
578 |
579 | # Mount 'static_files' as its namesake in the root of the container
580 | - type: volume
581 | source: static_files
582 | target: /static_files
583 | read_only: true
584 |
585 | # Mount 'media_files' as its namesake in the root of the container
586 | - type: volume
587 | source: media_files
588 | target: /media_files
589 | read_only: true
590 |
591 | # Mount 'personal_files' as its namesake in the root of the container
592 | - type: volume
593 | source: personal_files
594 | target: /personal_files
595 | read_only: true
596 |
597 | # Mount 'reverse_proxy_logs' as its namesake in the root of the container
598 | - type: volume
599 | source: reverse_proxy_logs
600 | target: /reverse_proxy_logs
601 | read_only: false
602 |
603 | # The services that need to be ready before this one
604 | depends_on:
605 | - intranet-server
606 | - internet-server
607 |
608 | # Connect to the custom default network
609 | networks:
610 | - network
611 |
612 | # Volumes are virtual drives connected to containers
613 | volumes:
614 | # This volume contains the database and PostgreSQL configuration files
615 | database:
616 | # This volume contains periodic dumps of the database for backup
617 | database_backup:
618 |
619 | # This volume contains reverse proxy logs
620 | reverse_proxy_logs:
621 | # This volume contains web server logs
622 | web_server_logs:
623 |
624 | # This volume contains the static files
625 | static_files:
626 |
627 | # This volume contains the media files
628 | media_files:
629 | # This volume contains periodic dumps of the media files for backup
630 | media_files_backup:
631 |
632 | # This volume contains the personal media files
633 | personal_files:
634 | # This volume contains periodic dumps of the personal files for backup
635 | personal_files_backup:
636 |
637 | # This volume contains the supervisor.d conf files
638 | supervisor.d:
639 |
640 | # This volume contains the history files
641 | .history:
642 |
643 | # RabbitMQ needs a volume at /var/lib/rabbitmq/
644 | rabbitmq_data:
645 |
646 | # Periodic dumps taken by Redis acting as channel layer
647 | channel_layer:
648 | # Periodic dumps taken by Redis acting as session store
649 | session_store:
650 | # Periodic dumps taken by Redis acting as communication store
651 | communication_store:
652 | # Periodic dumps taken by Redis acting as verification store
653 | verification_store:
654 | # Periodic dumps taken by Redis acting as application store
655 | application_store:
656 |
657 | # Networks specify how containers communicate with each other and the host
658 | networks:
659 | # Create a network to override Docker's ambiguously named default
660 | network:
661 |
--------------------------------------------------------------------------------
/memcached/Dockerfile:
--------------------------------------------------------------------------------
1 | # Use Memcached from the Debian Linux project
2 | FROM memcached:latest
3 |
4 | # Need to undo the misdeeds of Memcached developers
5 | USER root
6 |
7 | # Add labels for metadata
8 | LABEL maintainer="Dhruv Bhanushali "
9 |
10 | # Install dependencies
11 | RUN apt-get update \
12 | && apt-get install -y netcat-traditional \
13 | && rm -rf /var/lib/apt/lists/*
14 |
15 | # Undo our undoing of Memcache's misdeeds, just in case they are important
16 | USER memcache
--------------------------------------------------------------------------------
/nginx/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore the .conf files generated using the stencils
2 | conf.d/0*.conf
3 | conf.d/includes/0*.conf
--------------------------------------------------------------------------------
/nginx/Dockerfile:
--------------------------------------------------------------------------------
1 | # Use NGINX from the Alpine Linux project
2 | FROM nginx:alpine
3 |
4 | # Add labels for metadata
5 | LABEL maintainer="Dhruv Bhanushali "
6 |
7 | # Work in the root directory of the container
8 | WORKDIR /
9 |
10 | # Create the reverse proxy logs volume as a directory
11 | RUN mkdir -p /reverse_proxy_logs/nginx_logs \
12 | && chown -R nginx:nginx /reverse_proxy_logs \
13 | && chmod -R o+r /reverse_proxy_logs
14 |
15 | # Change the directories into volumes
16 | VOLUME /reverse_proxy_logs
17 |
18 | # Change the working directory
19 | WORKDIR /etc/nginx
20 |
21 | # Remove the default welcome message by NGINX
22 | RUN rm -f ./conf.d/default.conf
23 |
24 | # Load the configurations from the supplied conf.d directory in its place
25 | # There should be as many .conf files as the number of sites you want to run
26 | ADD ./conf.d ./conf.d
27 |
--------------------------------------------------------------------------------
/nginx/README.md:
--------------------------------------------------------------------------------
1 | # NGINX
2 |
3 | Docker service name: `reverse-proxy`
4 |
5 | Running applications:
6 | - `NGINX`
7 |
8 | Folder contents:
9 | - `Dockerfile`: A Dockerfile is the recipe to build a Docker image.
10 | - conf.d/
11 | - `01-intranet.conf`: The NGINX configuration of the Intranet site, which is to be processed first as it is the inner network ring with higher privileges.
12 | - `02-internet.conf`: The NGINX configuration of the Internet site, which is to be processed second as it is the outer network ring with lower privileges.
13 |
14 | ## Description
15 |
16 | `NGINX` is the reverse-proxy used by Omniport. This folder contains the Dockerfile required to build the image.
17 |
18 | `NGINX` serves the static and media files itself. It also serves the frontend bundles. But it routes all application requests upstream to the `Gunicorn` on `Daphne` servers running on the Django containers.
19 |
--------------------------------------------------------------------------------
/nginx/conf.d/includes/app_server.conf:
--------------------------------------------------------------------------------
1 | # Set additional headers in communicating with the application server
2 | proxy_set_header Host $host;
3 | proxy_set_header X-Real-IP $remote_addr;
4 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
5 | proxy_set_header X-Forwarded-Proto $scheme;
--------------------------------------------------------------------------------
/nginx/conf.d/includes/assets.conf:
--------------------------------------------------------------------------------
1 | # Network storage public files
2 | location /external/public {
3 | # Network storage public files can be found in the network_storage volume bind at /network_storage/public
4 | alias /network_storage/public;
5 |
6 | # Expire the cache of these files daily
7 | expires 1d;
8 | # Don't log access to these files because of the sheer volume of logs that would generate
9 | access_log off;
10 | }
11 |
12 | # Network storage protected files
13 | location /external/protected {
14 | # Only allow internal redirects
15 | internal;
16 |
17 | # Network storage protected files can be found in the network_storage volume bind at /network_storage/protected
18 | alias /network_storage/protected;
19 |
20 | # Expire the cache of these files daily
21 | expires 1d;
22 | # Don't log access to these files because of the sheer volume of logs that would generate
23 | access_log off;
24 | }
25 |
26 | # Media files
27 | location /media {
28 | # Media files can be found in the media volume mounted at /media_files
29 | alias /media_files;
30 |
31 | # Expire the cache of these files daily
32 | expires 1d;
33 | # Don't log access to these files because of the sheer volume of logs that would generate
34 | access_log off;
35 | }
36 |
37 | # Personal files
38 | location /personal {
39 | # Personal files can be found in the personal volume mounted at /personal_files
40 | alias /personal_files;
41 |
42 | # Expire the cache of these files daily
43 | expires 1d;
44 | # Don't log access to these files because of the sheer volume of logs that would generate
45 | access_log off;
46 | }
47 |
48 | # Static files
49 | location /static {
50 | # Static files can be found in the static volume mounted at /static_files
51 | alias /static_files;
52 |
53 | # Expire the cache of these files daily
54 | expires 1d;
55 | # Don't log access to these files because of the sheer volume of logs that would generate
56 | access_log off;
57 | }
58 |
59 | # Branding imagery
60 | location /branding {
61 | # Branding imagery can be found in the branding volume mounted at /branding
62 | alias /branding;
63 |
64 | # Expire the cache of these files daily
65 | expires 1d;
66 | # Don't log access to these files because of the sheer volume of logs that would generate
67 | access_log off;
68 | }
69 |
--------------------------------------------------------------------------------
/nginx/conf.d/includes/compression.conf:
--------------------------------------------------------------------------------
1 | # Compression using gzip
2 | gzip on;
3 | gzip_vary on;
4 | gzip_proxied any;
5 | gzip_comp_level 6;
6 | gzip_types text/plain text/css text/xml
7 | application/json application/javascript
8 | application/xml+rss application/atom+xml
9 | image/svg+xml;
--------------------------------------------------------------------------------
/nginx/conf.d/includes/frontend.conf:
--------------------------------------------------------------------------------
1 | # Frontend files
2 | location / {
3 | root /frontend;
4 | index index.html;
5 | try_files $uri $uri/ /index.html =404;
6 | }
--------------------------------------------------------------------------------
/nginx/conf.d/includes/security.conf:
--------------------------------------------------------------------------------
1 | # Headers suggested online to improve security
2 | add_header X-Frame-Options "SAMEORIGIN" always;
3 | add_header X-XSS-Protection "1; mode=block" always;
4 | add_header X-Content-Type-Options "nosniff" always;
5 | add_header Referrer-Policy "no-referrer-when-downgrade" always;
6 | add_header Content-Security-Policy "default-src * blob: data: 'unsafe-eval' 'unsafe-inline'" always;
7 | add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
--------------------------------------------------------------------------------
/nginx/conf.d/includes/ssl.conf:
--------------------------------------------------------------------------------
1 | # SSL
2 | ssl_session_timeout 1d;
3 | ssl_session_cache shared:SSL:50m;
4 | ssl_session_tickets off;
5 |
6 | # modern configuration
7 | ssl_protocols TLSv1.2;
8 | ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256;
9 | ssl_prefer_server_ciphers on;
10 |
11 | # OCSP Stapling
12 | ssl_stapling on;
13 | ssl_stapling_verify on;
14 | resolver 1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=60s;
15 | resolver_timeout 2s;
16 |
17 | # SSL
18 | ssl_certificate /cert/omniport.crt;
19 | ssl_certificate_key /cert/omniport.key;
--------------------------------------------------------------------------------
/nginx/conf.d/stencils/application.conf:
--------------------------------------------------------------------------------
1 | # Websocket URLs
2 | location /ws {
3 | # Throttling for web socket URLs
4 | limit_req zone=[[side]]_limit burst=24 nodelay;
5 |
6 | # Reverse proxy the request to the upstream Daphne server
7 | proxy_pass http://[[side]]-daphne;
8 |
9 | # These headers upgrade HTTP to WS
10 | proxy_http_version 1.1;
11 | proxy_set_header Upgrade $http_upgrade;
12 | proxy_set_header Connection "Upgrade";
13 |
14 | # Set additional headers in communicating with the application server
15 | include conf.d/includes/app_server.conf;
16 | }
17 |
18 | # If neither of the above matches, forward the request to Gunicorn
19 | location ~ ^/(manifest|ensure_csrf|contenttype_object|tinymce|kernel|base_auth|token_auth|session_auth|open_auth|guest_auth|bootstrap|omnipotence|api) {
20 | # Throttling for other URLs
21 | limit_req zone=[[side]]_limit burst=24 nodelay;
22 |
23 | # Reverse proxy the request to the upstream Gunicorn server
24 | proxy_pass http://[[side]]-gunicorn;
25 |
26 | # Time before NGINX throw 504: Gateway Timeout
27 | proxy_read_timeout [[timeout]];
28 | proxy_connect_timeout [[timeout]];
29 | proxy_send_timeout [[timeout]];
30 |
31 | # Set additional headers in communicating with the application server
32 | include conf.d/includes/app_server.conf;
33 | }
34 |
--------------------------------------------------------------------------------
/nginx/conf.d/stencils/logging.conf:
--------------------------------------------------------------------------------
1 | # Logs all requests received by the NGINX process
2 | access_log /reverse_proxy_logs/nginx_logs/[[side]]_access.log;
3 |
4 | # Logs all errors thrown inside the NGINX process
5 | error_log /reverse_proxy_logs/nginx_logs/[[side]]_error.log warn;
--------------------------------------------------------------------------------
/nginx/conf.d/stencils/main.conf:
--------------------------------------------------------------------------------
1 | # Configuration file for the production server of Omniport
2 |
3 | # Configuration for rate limiting and throttling
4 | limit_req_zone $binary_remote_addr zone=[[side]]_limit:16m rate=16r/s;
5 |
6 | # Defines the upstream servers
7 | include conf.d/includes/[[id]]-upstreams.conf;
8 |
9 | # Whether to add the HTTP to HTTPS redirect server
10 | # If no line is present below, that's on the build script
11 | [[redirect]]
12 |
13 | # Configuration of the HTTP server
14 | server {
15 | # The port the site will be served on
16 | listen [[main_port]];
17 | listen [::]:[[main_port]];
18 |
19 | # The domain name it will serve for
20 | server_name .[[domain]];
21 |
22 | # Use the UTF-8 charset
23 | charset utf-8;
24 |
25 | # Max upload size
26 | # Adjust to taste
27 | client_max_body_size [[max_upload_size]];
28 |
29 | # Include support for MIME types
30 | include mime.types;
31 | default_type application/octet-stream;
32 |
33 | # Whether to enable SSL configuration
34 | # If no line is present below, that's on the build script
35 | [[enable_ssl]]
36 |
37 | # Compression
38 | # Uses GNU Gzip
39 | include conf.d/includes/compression.conf;
40 |
41 | # All the location blocks for assets
42 | # Consists of external/ static/ media/ personal/ and branding/
43 | include conf.d/includes/assets.conf;
44 |
45 | # Security
46 | # Adds security-minded headers to the response
47 | include conf.d/includes/security.conf;
48 |
49 | # Logging
50 | # Logs both access and errors
51 | include conf.d/includes/[[id]]-logging.conf;
52 |
53 | # Application
54 | # Forwards the request to Gunicorn or Daphne appropriately
55 | include conf.d/includes/[[id]]-application.conf;
56 |
57 | # The location block for that serves the frontend on /
58 | include conf.d/includes/frontend.conf;
59 | }
60 |
--------------------------------------------------------------------------------
/nginx/conf.d/stencils/redirect.conf:
--------------------------------------------------------------------------------
1 | # HTTP redirect
2 | server {
3 | listen 80;
4 | listen [::]:80;
5 |
6 | server_name .[[domain]];
7 |
8 | location / {
9 | return 301 https://[[domain]]$request_uri;
10 | }
11 | }
--------------------------------------------------------------------------------
/nginx/conf.d/stencils/upstreams.conf:
--------------------------------------------------------------------------------
1 | # The upstream Gunicorn component NGINX needs to connect to
2 | upstream [[side]]-gunicorn {
3 | # Here internet-server automatically refers to the Internet site container
4 | server [[side]]-server:8000; # Web port socket
5 | }
6 |
7 | # The upstream Daphne component NGINX needs to connect to
8 | upstream [[side]]-daphne {
9 | # Here internet-server automatically refers to the Internet site container
10 | server [[side]]-server:8001; # Web port socket
11 | }
--------------------------------------------------------------------------------
/postgres/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore the database environment variables
2 | database.env
--------------------------------------------------------------------------------
/postgres/Dockerfile:
--------------------------------------------------------------------------------
1 | # Use Postgres from the Debian Linux project
2 | FROM postgres:latest
3 |
4 | # Add labels for metadata
5 | LABEL maintainer="Dhruv Bhanushali "
6 |
7 | # Install the health check script
8 | COPY checkhealth.sh /usr/local/bin/checkhealth
9 |
--------------------------------------------------------------------------------
/postgres/README.md:
--------------------------------------------------------------------------------
1 | # PostgreSQL
2 |
3 | Docker service name: `database`
4 |
5 | Running applications:
6 | - `PostgreSQL`
7 |
8 | Folder contents:
9 | - `database_stencil.env`: The fields in this file are to be populated to create the actual environment file, named `database.env`.
10 |
11 | ## Description
12 |
13 | The primary database used by Omniport is `PostgreSQL`. Since the image is directly used without building on top of it, no Dockerfile is required.
14 |
15 | `PostgreSQL` serves as the primary, relational, SQL-based database that is used by the Django ORM for the major part of Omniport. However other databases are available such as `Redis` for use in certain apps under certain circumstances.
--------------------------------------------------------------------------------
/postgres/checkhealth.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -eo pipefail
3 |
4 | HOST="$(hostname -i || echo '127.0.0.1')"
5 | USER="${POSTGRES_USER:-postgres}"
6 | DB="${POSTGRES_DB:-postgres}"
7 |
8 | export PGPASSWORD="${POSTGRES_PASSWORD:-}"
9 |
10 | # A Postgres node is considered healthy if
11 | # * it connects with the given username and password
12 | # * it returns 1 for a 'SELECT 1' SQL query
13 |
14 | args=(
15 | # Force postgres to not use the local socket and test external connectivity
16 | --host "$HOST"
17 | --username "$USER"
18 | --dbname "$DB"
19 | --quiet --no-align --tuples-only
20 | )
21 |
22 | if select="$(echo 'SELECT 1' | psql "${args[@]}")" && [ "$select" = '1' ]; then
23 | exit 0
24 | fi
25 |
26 | exit 1
--------------------------------------------------------------------------------
/postgres/database_stencil.env:
--------------------------------------------------------------------------------
1 | POSTGRES_DB=[[db]]
2 | POSTGRES_USER=[[user]]
3 | POSTGRES_PASSWORD=[[password]]
--------------------------------------------------------------------------------
/rabbitmq/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore the message broker environment variables
2 | message_broker.env
--------------------------------------------------------------------------------
/rabbitmq/Dockerfile:
--------------------------------------------------------------------------------
1 | # Use RabbitMQ from the Debian Linux project
2 | FROM rabbitmq:management
3 |
4 | # Add labels for metadata
5 | LABEL maintainer="Dhruv Bhanushali "
6 |
7 | # Install the health check script
8 | COPY checkhealth.sh /usr/local/bin/checkhealth
9 |
--------------------------------------------------------------------------------
/rabbitmq/README.md:
--------------------------------------------------------------------------------
1 | # RabbitMQ
2 |
3 | Docker service name: `message-broker`
4 |
5 | Running applications:
6 | - `RabbitMQ`
7 |
8 | Folder contents:
9 | - `message_broker_stencil.env`: The fields in this file are to be populated to create the actual environment file, named `message_broker.env`.
10 |
11 | ## Description
12 |
13 | The message queuing system used by Omniport is `RabbitMQ`. Since the image is directly used without building on top of it, no Dockerfile is required.
14 |
15 | `RabbitMQ` may either be used standalone or in conjunction with a wrapper such as Celery in order to carry out long operations outside the request-response cycle in an asynchronous, non-blocking fashion.
--------------------------------------------------------------------------------
/rabbitmq/checkhealth.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -eo pipefail
3 |
4 | # A RabbitMQ node is considered healthy if
5 | # * the rabbit app finished booting & it's running
6 | # * there are no alarms
7 | # * there is at least 1 active listener
8 |
9 | rabbitmqctl eval '
10 | { true, rabbit_app_booted_and_running } = { rabbit:is_booted(node()), rabbit_app_booted_and_running },
11 | { [], no_alarms } = { rabbit:alarms(), no_alarms },
12 | [] /= rabbit_networking:active_listeners(),
13 | rabbitmq_node_is_healthy.
14 | ' || exit 1
--------------------------------------------------------------------------------
/rabbitmq/message_broker_stencil.env:
--------------------------------------------------------------------------------
1 | RABBITMQ_DEFAULT_USER=[[user]]
2 | RABBITMQ_DEFAULT_PASS=[[pass]]
--------------------------------------------------------------------------------
/react/Dockerfile:
--------------------------------------------------------------------------------
1 | # Use Node from the Debian Linux project
2 | FROM node:lts-stretch-slim
3 |
4 | # Add labels for metadata
5 | LABEL maintainer="Dhruv Bhanushali "
6 |
7 | # Determines whether to build a production or a development package
8 | ARG IMAGETYPE
9 |
10 | # Create a non-root user
11 | RUN groupadd --system react && useradd --system --gid react react
12 |
13 | # Work in the root directory of the container
14 | WORKDIR /
15 |
16 | # Copy the yarn.lock file over to the container
17 | # This command implies an image rebuild when npm dependencies change
18 | COPY ./package.json ./package.json
19 | COPY ./yarn.lock ./yarn.lock
20 |
21 | # Add webpack dependency
22 | RUN yarn global add webpack-dev-server
23 |
24 | # Install dependenices from the file yarn.lock
25 | RUN yarn install ${IMAGETYPE}
26 |
27 | # Add some terminal jazz
28 | RUN echo "PS1='docker@\$NAME:\w\$ '" >> /etc/bash.bashrc
29 |
30 | # Enter the omniport directory
31 | WORKDIR /omniport
32 |
--------------------------------------------------------------------------------
/readme-assets/maintainers/wordmark.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/readme-assets/site/wordmark.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/redis/Dockerfile:
--------------------------------------------------------------------------------
1 | # Use Redis from the Debian Linux project
2 | FROM redis:latest
3 |
4 | # Add labels for metadata
5 | LABEL maintainer="Dhruv Bhanushali "
6 |
7 | # Install the health check script
8 | COPY checkhealth.sh /usr/local/bin/checkhealth
9 |
--------------------------------------------------------------------------------
/redis/checkhealth.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -eo pipefail
3 |
4 | host="$(hostname -i || echo '127.0.0.1')"
5 |
6 | # A Redis node is considered healthy if
7 | # * it responds 'PONG' to every ping
8 |
9 | if ping="$(redis-cli -h "$host" ping)" && [ "$ping" = 'PONG' ]; then
10 | exit 0
11 | fi
12 |
13 | exit 1
--------------------------------------------------------------------------------
/scripts/README.md:
--------------------------------------------------------------------------------
1 | # Scripts
2 |
3 | This folder contains a bunch of shell scripts to perform some repetitive operations such as building Docker images and running transient containers. All these scripts are written assuming them to be executed from the root folder, namely `omniport-docker/`.
4 |
5 | Folder structure:
6 | - clone/
7 | - `core.sh`: Clone the core of the Omniport project from GitHub, into a folder named `omniport/` in the root directory.
8 | - `shell.sh`: Clone the Omniport shell specific to IIT Roorkee from GitHub, into a folder named `shell/`, inside the `omniport/` folder created by the `core.sh` script.
9 | - `services.sh`: Clone the various services of the Omniport project into their respective folders inside the folder `services/`, inside the `omniport/` directory.
10 | - build/
11 | - `django.sh`: Build the Django container from the Dockerfile present in the `django/` folder inside the project root.
12 | - `nginx.sh`: Build the NGINX container from the Dockerfile present in the `nginx/` folder inside the project root.
13 | - run/
14 | - `django.sh`: Run a temporal Django web-server container with development settings. Optionally takes the following command-line arguments:
15 | - a name for the container, defaults to `django-dev`
16 | - the interface and port to bind to, defaults to `0.0.0.0:8000`
17 | - `logs.sh`: Run a temportal Alpine container to inspect logs created by various containers. Optionally takes the following command-line arguments:
18 | - a name for the container, defaults to `logs-prod`
19 | - clean/
20 | - `unclone.sh`: Removes the `omniport/` directory from the root directory. This will remove the Omniport core, the shell, all services and any apps you might have cloned into the code base.
--------------------------------------------------------------------------------
/scripts/build/django.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copy the prod-requirements.txt file from the codebase into the Django Docker folder
4 | cp codebase/omniport-backend/pyproject.toml django/
5 | cp codebase/omniport-backend/poetry.lock django/
6 |
7 | read -p "Add PyPI dependencies for developer tools? (y/N): " DEV_TOOLS
8 | if [ $DEV_TOOLS == 'Y' -o $DEV_TOOLS == 'y' ]; then
9 | # Set the build argument IMAGETYPE to --dev
10 | IMAGETYPE='--dev'
11 |
12 | # Assign a tag of dev-latest for usecases that mandate development
13 | TAG='dev-latest'
14 | else
15 | # Set the build argument IMAGETYPE to blank
16 | IMAGETYPE=''
17 |
18 | # Assign a tag of prod-latest for usecases that mandate production
19 | TAG='prod-latest'
20 | fi
21 |
22 | # Enter the Django Docker folder
23 | cd django/
24 |
25 | # Build the container from the Django folder and tag it
26 | TIMESTAMP=$(date +"%s")
27 |
28 | docker build \
29 | --build-arg IMAGETYPE=${IMAGETYPE} \
30 | --tag omniport-django:${TIMESTAMP} \
31 | --tag omniport-django:${TAG} \
32 | --tag omniport-django:latest \
33 | .
34 |
35 | # Remove the requirement files after they have served their purpose
36 | rm pyproject.toml
37 | rm poetry.lock
38 |
--------------------------------------------------------------------------------
/scripts/build/memcached.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Enter the Memcached Docker folder
4 | cd memcached/
5 |
6 | # Build the container from the Memcached folder and tag it
7 | TIMESTAMP=$(date +"%s")
8 |
9 | docker build \
10 | --tag omniport-memcached:${TIMESTAMP} \
11 | --tag omniport-memcached:latest \
12 | .
--------------------------------------------------------------------------------
/scripts/build/nginx.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Enter the NGINX Docker folder
4 | cd nginx/
5 |
6 | read -p "Rebuild NGINX .conf files? (y/N): " REBUILD
7 | if [ $REBUILD == 'Y' -o $REBUILD == 'y' ]; then
8 | read -p "Enter the intranet-side domain as 'omniport.intranet': " INTRANET_DOMAIN
9 | read -p "Enter the Internet-side domain as 'omniport.internet': " INTERNET_DOMAIN
10 | read -p "Enter timeout value for intranet server (in seconds) [60]: " INTRANET_TIMEOUT
11 | INTRANET_TIMEOUT=${INTRANET_TIMEOUT:-60}
12 | read -p "Enter timeout value for internet server (in seconds) [60]: " INTERNET_TIMEOUT
13 | INTERNET_TIMEOUT=${INTERNET_TIMEOUT:-60}
14 |
15 | read -p "Enter max upload size [63M]: " MAX_UPLOAD_SIZE
16 | MAX_UPLOAD_SIZE=${MAX_UPLOAD_SIZE:-63M}
17 |
18 | # Choose whether to enable SSL in the NGINX conf
19 | read -p "Enable HTTPS? [y/N]: " HTTPS
20 | if [ $HTTPS == 'Y' -o $HTTPS == 'y' ]; then
21 | MAIN_PORT='443 ssl' # 'ssl' is essential here
22 | REDIRECT_INTRANET='include conf\.d\/includes\/01-redirect\.conf;'
23 | REDIRECT_INTERNET='include conf\.d\/includes\/02-redirect\.conf;'
24 | ENABLE_SSL='include conf\.d\/includes\/ssl\.conf;'
25 | else
26 | MAIN_PORT='80'
27 | REDIRECT_INTRANET='' # Leaves out the include directives
28 | REDIRECT_INTERNET='' # Leaves out the include directives
29 | ENABLE_SSL='' # Leaves out the include directives
30 | fi
31 |
32 | # Enter conf.d/ inside the NGINX Docker folder
33 | cd conf.d/
34 |
35 | # Remove pre-existing .conf files
36 | rm 0*.conf
37 | rm includes/0*.conf
38 |
39 | # Perform text substitution to generate the new .conf files
40 | printf "Writing intranet application file... "
41 | cp stencils/application.conf includes/01-application.conf
42 | sed -i "s/\[\[side\]\]/intranet/g" includes/01-application.conf
43 | sed -i "s/\[\[timeout\]\]/${INTRANET_TIMEOUT}/g" includes/01-application.conf
44 | printf "done\n"
45 |
46 | printf "Writing intranet http_redirect file... "
47 | cp stencils/redirect.conf includes/01-redirect.conf
48 | sed -i "s/\[\[domain\]\]/${INTRANET_DOMAIN}/g" includes/01-redirect.conf
49 | printf "done\n"
50 |
51 | printf "Writing intranet logging file... "
52 | cp stencils/logging.conf includes/01-logging.conf
53 | sed -i "s/\[\[side\]\]/intranet/g" includes/01-logging.conf
54 | printf "done\n"
55 |
56 | printf "Writing intranet upstreams file... "
57 | cp stencils/upstreams.conf includes/01-upstreams.conf
58 | sed -i "s/\[\[side\]\]/intranet/g" includes/01-upstreams.conf
59 | printf "done\n"
60 |
61 | printf "Writing main intranet .conf file... "
62 | cp stencils/main.conf 01-intranet.conf
63 | sed -i "s/\[\[side\]\]/intranet/g" 01-intranet.conf
64 | sed -i "s/\[\[id\]\]/01/g" 01-intranet.conf
65 | sed -i "s/\[\[redirect\]\]/${REDIRECT_INTRANET}/g" 01-intranet.conf
66 | sed -i "s/\[\[main_port\]\]/${MAIN_PORT}/g" 01-intranet.conf
67 | sed -i "s/\[\[domain\]\]/${INTRANET_DOMAIN}/g" 01-intranet.conf
68 | sed -i "s/\[\[enable_ssl\]\]/${ENABLE_SSL}/g" 01-intranet.conf
69 | sed -i "s/\[\[max_upload_size\]\]/${MAX_UPLOAD_SIZE}/g" 01-intranet.conf
70 | printf "done\n"
71 |
72 | printf "Writing Internet application file... "
73 | cp stencils/application.conf includes/02-application.conf
74 | sed -i "s/\[\[side\]\]/internet/g" includes/02-application.conf
75 | sed -i "s/\[\[timeout\]\]/${INTERNET_TIMEOUT}/g" includes/02-application.conf
76 | printf "done\n"
77 |
78 | printf "Writing Internet http_redirect file... "
79 | cp stencils/redirect.conf includes/02-redirect.conf
80 | sed -i "s/\[\[domain\]\]/${INTERNET_DOMAIN}/g" includes/02-redirect.conf
81 | printf "done\n"
82 |
83 | printf "Writing Internet logging file... "
84 | cp stencils/logging.conf includes/02-logging.conf
85 | sed -i "s/\[\[side\]\]/internet/g" includes/02-logging.conf
86 | printf "done\n"
87 |
88 | printf "Writing Internet upstreams file... "
89 | cp stencils/upstreams.conf includes/02-upstreams.conf
90 | sed -i "s/\[\[side\]\]/internet/g" includes/02-upstreams.conf
91 | printf "done\n"
92 |
93 | printf "Writing main Internet .conf file... "
94 | cp stencils/main.conf 02-internet.conf
95 | sed -i "s/\[\[side\]\]/internet/g" 02-internet.conf
96 | sed -i "s/\[\[id\]\]/02/g" 02-internet.conf
97 | sed -i "s/\[\[redirect\]\]/${REDIRECT_INTERNET}/g" 02-internet.conf
98 | sed -i "s/\[\[main_port\]\]/${MAIN_PORT}/g" 02-internet.conf
99 | sed -i "s/\[\[domain\]\]/${INTERNET_DOMAIN}/g" 02-internet.conf
100 | sed -i "s/\[\[enable_ssl\]\]/${ENABLE_SSL}/g" 02-internet.conf
101 | sed -i "s/\[\[max_upload_size\]\]/${MAX_UPLOAD_SIZE}/g" 02-internet.conf
102 | printf "done\n"
103 |
104 | # Get back out
105 | cd ..
106 | fi
107 |
108 | # Build the container from the NGINX folder and tag it
109 | TIMESTAMP=$(date +"%s")
110 |
111 | docker build \
112 | --tag omniport-nginx:${TIMESTAMP} \
113 | --tag omniport-nginx:latest \
114 | .
115 |
--------------------------------------------------------------------------------
/scripts/build/postgres.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Enter the Postgres Docker folder
4 | cd postgres/
5 |
6 | read -p "Rebuild database .env file? (y/N): " REBUILD
7 | if [ $REBUILD == 'Y' -o $REBUILD == 'y' ]; then
8 | read -p "Enter the name of the database: " DB
9 | read -p "Enter the user of the database: " USER
10 | read -p "Enter the password of the database: " PASSWORD
11 |
12 | # Perform text substitution to generate the new .env file
13 | printf "Writing database environment file... "
14 | cp database_stencil.env database.env
15 | sed -i "s/\[\[db\]\]/${DB}/g" database.env
16 | sed -i "s/\[\[user\]\]/${USER}/g" database.env
17 | sed -i "s/\[\[password\]\]/${PASSWORD}/g" database.env
18 | printf "done\n"
19 | fi
20 |
21 | # Build the container from the Postgres folder and tag it
22 | TIMESTAMP=$(date +"%s")
23 |
24 | docker build \
25 | --tag omniport-postgres:${TIMESTAMP} \
26 | --tag omniport-postgres:latest \
27 | .
--------------------------------------------------------------------------------
/scripts/build/rabbitmq.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Enter the RabbitMQ Docker folder
4 | cd rabbitmq/
5 |
6 | read -p "Rebuild message broker .env file? (y/N): " REBUILD
7 | if [ $REBUILD == 'Y' -o $REBUILD == 'y' ]; then
8 | read -p "Enter the user of the message broker: " USER
9 | read -p "Enter the pass of the message broker: " PASS
10 |
11 | # Perform text substitution to generate the new .env file
12 | printf "Writing message broker environment file... "
13 | cp message_broker_stencil.env message_broker.env
14 | sed -i "s/\[\[user\]\]/${USER}/g" message_broker.env
15 | sed -i "s/\[\[pass\]\]/${PASS}/g" message_broker.env
16 | printf "done\n"
17 | fi
18 |
19 | # Build the container from the RabbitMQ folder and tag it
20 | TIMESTAMP=$(date +"%s")
21 |
22 | docker build \
23 | --tag omniport-rabbitmq:${TIMESTAMP} \
24 | --tag omniport-rabbitmq:latest \
25 | .
--------------------------------------------------------------------------------
/scripts/build/react.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copy the yarn.lock file from the codebase into the React Docker folder
4 | cp codebase/omniport-frontend/omniport/package.json react/
5 | cp codebase/omniport-frontend/omniport/yarn.lock react/
6 |
7 | read -p "Add npm dependencies for developer tools? (y/N): " DEV_TOOLS
8 | if [ $DEV_TOOLS == 'Y' -o $DEV_TOOLS == 'y' ]; then
9 | # Set the build argument IMAGETYPE to blank
10 | IMAGETYPE=''
11 |
12 | # Assign a tag of dev-latest for usecases that mandate development
13 | TAG='dev-latest'
14 | else
15 | # Set the build argument IMAGETYPE to --prod
16 | IMAGETYPE='--prod'
17 |
18 | # Assign a tag of prod-latest for usecases that mandate production
19 | TAG='prod-latest'
20 | fi
21 |
22 | # Enter the React Docker folder
23 | cd react/
24 |
25 | # Build the container from the React folder and tag it
26 | TIMESTAMP=$(date +"%s")
27 |
28 | docker build \
29 | --build-arg IMAGETYPE=${IMAGETYPE} \
30 | --tag omniport-react:${TIMESTAMP} \
31 | --tag omniport-react:${TAG} \
32 | --tag omniport-react:latest \
33 | .
34 |
35 | # Remove the yarn.lock file after it has served its purpose
36 | rm package.json
37 | rm yarn.lock
--------------------------------------------------------------------------------
/scripts/build/redis.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Enter the Redis Docker folder
4 | cd redis/
5 |
6 | # Build the container from the Redis folder and tag it
7 | TIMESTAMP=$(date +"%s")
8 |
9 | docker build \
10 | --tag omniport-redis:${TIMESTAMP} \
11 | --tag omniport-redis:latest \
12 | .
--------------------------------------------------------------------------------
/scripts/clone/backend.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Import the utility functions
4 | source ./scripts/clone/utils.sh
5 |
6 | # Check if codebase/ directory exists and enter it
7 | if [[ ! -d "codebase" ]]; then
8 | mkdir codebase/
9 | fi
10 | cd codebase/
11 |
12 | # Reset the omniport-backend/ directory and enter it
13 | if [[ -d "omniport\-backend" ]]; then
14 | rm -rf omniport-backend
15 | fi
16 | clonerepo "Backend core" "omniport-backend" "omniport-backend"
17 | cd omniport-backend/
18 |
19 | # Pass the cloning to the backend's clone scripts
20 | bash ./scripts/clone/everything.sh
21 |
--------------------------------------------------------------------------------
/scripts/clone/everything.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Reset the codebase/ directory and enter it
4 | if [[ -d "codebase" ]]; then
5 | rm -rf codebase
6 | fi
7 | mkdir codebase
8 |
9 | # Clone the backend
10 | printf "Cloning the backend\n"
11 | bash ./scripts/clone/backend.sh
12 |
13 | # Clone the frontend
14 | printf "Cloning the frontend\n"
15 | bash ./scripts/clone/frontend.sh
16 |
--------------------------------------------------------------------------------
/scripts/clone/frontend.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Import the utility functions
4 | source ./scripts/clone/utils.sh
5 |
6 | # Check if codebase/ directory exists and enter it
7 | if [[ ! -d "codebase" ]]; then
8 | mkdir codebase/
9 | fi
10 | cd codebase/
11 |
12 | # Reset the omniport-frontend/ directory and enter it
13 | if [[ -d "omniport\-frontend" ]]; then
14 | rm -rf omniport-frontend
15 | fi
16 | clonerepo "Frontend core" "omniport-frontend" "omniport-frontend"
17 | cd omniport-frontend/
18 |
19 | # Pass the cloning to the frontend's clone scripts
20 | bash ./scripts/clone/everything.sh
21 |
--------------------------------------------------------------------------------
/scripts/clone/utils.sh:
--------------------------------------------------------------------------------
1 | # Encore the given string to a URLencoded format
2 | #
3 | # Syntax: urlencode
4 | urlencode() {
5 | # Preserve current LC_COLLATE
6 | old_lc_collate=$LC_COLLATE
7 |
8 | LC_COLLATE=C
9 | local length="${#1}"
10 | for (( i = 0; i < length; i++ )); do
11 | local c="${1:i:1}"
12 | case $c in
13 | [a-zA-Z0-9.~_-]) printf "$c" ;;
14 | *) printf '%%%02X' "'$c" ;;
15 | esac
16 | done
17 |
18 | # Restore the original value
19 | LC_COLLATE=$old_lc_collate
20 | }
21 |
22 | # Clone the given repository from GitHub
23 | #
24 | # Syntax: clonerepo
25 | clonerepo() {
26 | # Setting required values from arguments
27 | DISPLAY_NAME=$1
28 | REPO_NAME=$2
29 | FOLDER_NAME=$3
30 |
31 | # Clone the given repository
32 | printf "Cloning ${DISPLAY_NAME}... "
33 | git clone https://github.com/IMGIITRoorkee/${REPO_NAME}.git ${FOLDER_NAME} &> /dev/null
34 | printf "done\n"
35 | }
36 |
--------------------------------------------------------------------------------
/scripts/start/development.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Run the scaffolding services
4 | docker-compose up -d \
5 | database \
6 | redis-gui \
7 | cache \
8 | message-broker
9 |
--------------------------------------------------------------------------------
/scripts/start/logs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Get a name for the container
4 | NAME=logs-$(date +"%s")
5 |
6 | # Run the container to explore and monitor logs
7 | docker run \
8 | --tty \
9 | --interactive \
10 | --rm \
11 | --mount type=volume,src=omniport-docker_reverse_proxy_logs,dst=/reverse_proxy_logs \
12 | --mount type=volume,src=omniport-docker_web_server_logs,dst=/web_server_logs \
13 | --name ${NAME} \
14 | bash:latest \
15 | bash
16 |
--------------------------------------------------------------------------------