├── .github
├── stale.yml
└── workflows
│ ├── master-build.yml
│ └── pull-request.yml
├── .gitignore
├── .mvn
└── wrapper
│ ├── maven-wrapper.jar
│ └── maven-wrapper.properties
├── Dockerfile
├── LICENSE
├── README.md
├── _config.yml
├── mvnw
├── mvnw.cmd
├── pom.xml
├── scripts
└── cleanup-branches.sh
├── src
├── main
│ ├── java
│ │ └── com
│ │ │ └── aakkus
│ │ │ └── dockercomposeinitializr
│ │ │ ├── DockerComposeInitializrApplication.java
│ │ │ ├── domain
│ │ │ ├── DockerComposeFileFacade.java
│ │ │ ├── DockerComposeFilePort.java
│ │ │ ├── FeedbackFacade.java
│ │ │ ├── FeedbackPort.java
│ │ │ └── model
│ │ │ │ ├── CreateDockerComposeFileCommand.java
│ │ │ │ ├── DockerComposeFile.java
│ │ │ │ ├── DockerComposeServiceDefinition.java
│ │ │ │ └── DockerComposeVersionDefinition.java
│ │ │ └── infra
│ │ │ ├── adapter
│ │ │ ├── DockerComposeFileAdapter.java
│ │ │ ├── FeedbackAdapter.java
│ │ │ └── model
│ │ │ │ └── DockerComposeService.java
│ │ │ ├── config
│ │ │ └── DockerComposeConfiguration.java
│ │ │ └── rest
│ │ │ ├── DockerComposeRestController.java
│ │ │ ├── FeedbackController.java
│ │ │ ├── model
│ │ │ ├── DockerComposeServiceDefinitionModel.java
│ │ │ └── DockerComposeVersionDefinitionModel.java
│ │ │ ├── request
│ │ │ └── CreateDockerComposeFileRequest.java
│ │ │ └── response
│ │ │ └── DockerComposeResponse.java
│ └── resources
│ │ ├── application.yml
│ │ └── static
│ │ ├── css
│ │ ├── app.css
│ │ ├── bootstrap.min.css
│ │ ├── fonts
│ │ │ ├── element-icons.ttf
│ │ │ └── element-icons.woff
│ │ └── vuetify.css
│ │ ├── images
│ │ └── docker.png
│ │ ├── index.html
│ │ └── js
│ │ ├── app.js
│ │ ├── bootstrap-vue.min.js
│ │ ├── bootstrap.min.js
│ │ ├── jquery.min.js
│ │ ├── popper.min.js
│ │ ├── vue-resource.js
│ │ ├── vue.js
│ │ └── vuetify.js
└── test
│ └── java
│ └── com
│ └── aakkus
│ └── dockercomposeinitializr
│ ├── IT.java
│ └── infra
│ ├── adapter
│ └── DockerComposeFileCreateAdapterTest.java
│ └── rest
│ └── DockerComposeRestControllerTest.java
└── system.properties
/.github/stale.yml:
--------------------------------------------------------------------------------
1 | # Number of days of inactivity before an issue becomes stale
2 | daysUntilStale: 60
3 | # Number of days of inactivity before a stale issue is closed
4 | daysUntilClose: 7
5 | # Issues with these labels will never be considered stale
6 | exemptLabels:
7 | - pinned
8 | - security
9 | # Label to use when marking an issue as stale
10 | staleLabel: wontfix
11 | # Comment to post when marking an issue as stale. Set to `false` to disable
12 | markComment: >
13 | This issue has been automatically marked as stale because it has not had
14 | recent activity. It will be closed if no further activity occurs. Thank you
15 | for your contributions.
16 | # Comment to post when closing a stale issue. Set to `false` to disable
17 | closeComment: false
18 |
--------------------------------------------------------------------------------
/.github/workflows/master-build.yml:
--------------------------------------------------------------------------------
1 | name: Java CI
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 |
8 | jobs:
9 | build:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - uses: actions/checkout@v1
13 | - name: Set up JDK 1.11
14 | uses: actions/setup-java@v1
15 | with:
16 | java-version: 1.11
17 | - name: Cache maven dependencies
18 | uses: actions/cache@v1
19 | with:
20 | path: ~/.m2 # maven cache files are stored in `~/.m2` on Linux/macOS
21 | key: ${{ runner.os }}-mvn-${{ hashFiles('**/pom.xml') }}
22 | restore-keys: |
23 | ${{ runner.os }}-build-${{ env.cache-name }}-
24 | ${{ runner.os }}-build-
25 | ${{ runner.os }}-
26 | - name: Build with Maven
27 | run: mvn -B package --file pom.xml
28 | - name: Build Docker Image
29 | if: success()
30 | run: |
31 | docker login docker.pkg.github.com -u alicanakkus -p ${{ secrets.TOKEN }}
32 | docker build -t docker.pkg.github.com/alicanakkus/docker-compose-initializr/dcomposerio:${GITHUB_SHA} .
33 | docker push docker.pkg.github.com/alicanakkus/docker-compose-initializr/dcomposerio:${GITHUB_SHA}
--------------------------------------------------------------------------------
/.github/workflows/pull-request.yml:
--------------------------------------------------------------------------------
1 | name: Java CI
2 |
3 | on: [pull_request]
4 |
5 | jobs:
6 | build:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - uses: actions/checkout@v1
10 | - name: Set up JDK 1.11
11 | uses: actions/setup-java@v1
12 | with:
13 | java-version: 1.11
14 | - name: Cache maven dependencies
15 | uses: actions/cache@v1
16 | with:
17 | path: ~/.m2 # maven cache files are stored in `~/.m2` on Linux/macOS
18 | key: ${{ runner.os }}-mvn-${{ hashFiles('**/pom.xml') }}
19 | restore-keys: |
20 | ${{ runner.os }}-build-${{ env.cache-name }}-
21 | ${{ runner.os }}-build-
22 | ${{ runner.os }}-
23 | - name: Build with Maven
24 | run: mvn clean test install
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 | .sts4-cache
12 |
13 | ### IntelliJ IDEA ###
14 | .idea
15 | *.iws
16 | *.iml
17 | *.ipr
18 |
19 | ### NetBeans ###
20 | /nbproject/private/
21 | /build/
22 | /nbbuild/
23 | /dist/
24 | /nbdist/
25 | /.nb-gradle/
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlicanAkkus/docker-compose-initializr/7455a4996fd07b697debd8d38b11d8b59277f078/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
2 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:11-jre-slim-sid
2 | LABEL maintainer=aakkus
3 |
4 | COPY target/docker-compose-initializr-0.0.1-SNAPSHOT.jar lib/docker-compose-initializr.jar
5 |
6 | ENTRYPOINT exec java -Djava.security.egd=file:/dev/./urandom $JAVA_OPTS -jar lib/docker-compose-initializr.jar
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year containerName of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Docker Compose Initializr 
2 |
3 | You can create your own docker compose. You can select a few official images or typing self-image for creating the **docker-compose.yml** file. After file created you can download and run it! It's just that.
4 |
5 |
6 | ## License
7 | Docker Compose Initializr is Open Source software released under the
8 | [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0.html)
9 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
--------------------------------------------------------------------------------
/mvnw:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # ----------------------------------------------------------------------------
3 | # Licensed to the Apache Software Foundation (ASF) under one
4 | # or more contributor license agreements. See the NOTICE file
5 | # distributed with this work for additional information
6 | # regarding copyright ownership. The ASF licenses this file
7 | # to you under the Apache License, Version 2.0 (the
8 | # "License"); you may not use this file except in compliance
9 | # with the License. You may obtain a copy of the License at
10 | #
11 | # http://www.apache.org/licenses/LICENSE-2.0
12 | #
13 | # Unless required by applicable law or agreed to in writing,
14 | # software distributed under the License is distributed on an
15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | # KIND, either express or implied. See the License for the
17 | # specific language governing permissions and limitations
18 | # under the License.
19 | # ----------------------------------------------------------------------------
20 |
21 | # ----------------------------------------------------------------------------
22 | # Maven2 Start Up Batch script
23 | #
24 | # Required ENV vars:
25 | # ------------------
26 | # JAVA_HOME - location of a JDK home dir
27 | #
28 | # Optional ENV vars
29 | # -----------------
30 | # M2_HOME - location of maven2's installed home dir
31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven
32 | # e.g. to debug Maven itself, use
33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files
35 | # ----------------------------------------------------------------------------
36 |
37 | if [ -z "$MAVEN_SKIP_RC" ] ; then
38 |
39 | if [ -f /etc/mavenrc ] ; then
40 | . /etc/mavenrc
41 | fi
42 |
43 | if [ -f "$HOME/.mavenrc" ] ; then
44 | . "$HOME/.mavenrc"
45 | fi
46 |
47 | fi
48 |
49 | # OS specific support. $var _must_ be set to either true or false.
50 | cygwin=false;
51 | darwin=false;
52 | mingw=false
53 | case "`uname`" in
54 | CYGWIN*) cygwin=true ;;
55 | MINGW*) mingw=true;;
56 | Darwin*) darwin=true
57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
59 | if [ -z "$JAVA_HOME" ]; then
60 | if [ -x "/usr/libexec/java_home" ]; then
61 | export JAVA_HOME="`/usr/libexec/java_home`"
62 | else
63 | export JAVA_HOME="/Library/Java/Home"
64 | fi
65 | fi
66 | ;;
67 | esac
68 |
69 | if [ -z "$JAVA_HOME" ] ; then
70 | if [ -r /etc/gentoo-release ] ; then
71 | JAVA_HOME=`java-config --jre-home`
72 | fi
73 | fi
74 |
75 | if [ -z "$M2_HOME" ] ; then
76 | ## resolve links - $0 may be a link to maven's home
77 | PRG="$0"
78 |
79 | # need this for relative symlinks
80 | while [ -h "$PRG" ] ; do
81 | ls=`ls -ld "$PRG"`
82 | link=`expr "$ls" : '.*-> \(.*\)$'`
83 | if expr "$link" : '/.*' > /dev/null; then
84 | PRG="$link"
85 | else
86 | PRG="`dirname "$PRG"`/$link"
87 | fi
88 | done
89 |
90 | saveddir=`pwd`
91 |
92 | M2_HOME=`dirname "$PRG"`/..
93 |
94 | # make it fully qualified
95 | M2_HOME=`cd "$M2_HOME" && pwd`
96 |
97 | cd "$saveddir"
98 | # echo Using m2 at $M2_HOME
99 | fi
100 |
101 | # For Cygwin, ensure paths are in UNIX format before anything is touched
102 | if $cygwin ; then
103 | [ -n "$M2_HOME" ] &&
104 | M2_HOME=`cygpath --unix "$M2_HOME"`
105 | [ -n "$JAVA_HOME" ] &&
106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
107 | [ -n "$CLASSPATH" ] &&
108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
109 | fi
110 |
111 | # For Mingw, ensure paths are in UNIX format before anything is touched
112 | if $mingw ; then
113 | [ -n "$M2_HOME" ] &&
114 | M2_HOME="`(cd "$M2_HOME"; pwd)`"
115 | [ -n "$JAVA_HOME" ] &&
116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
117 | # TODO classpath?
118 | fi
119 |
120 | if [ -z "$JAVA_HOME" ]; then
121 | javaExecutable="`which javac`"
122 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
123 | # readlink(1) is not available as standard on Solaris 10.
124 | readLink=`which readlink`
125 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
126 | if $darwin ; then
127 | javaHome="`dirname \"$javaExecutable\"`"
128 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
129 | else
130 | javaExecutable="`readlink -f \"$javaExecutable\"`"
131 | fi
132 | javaHome="`dirname \"$javaExecutable\"`"
133 | javaHome=`expr "$javaHome" : '\(.*\)/bin'`
134 | JAVA_HOME="$javaHome"
135 | export JAVA_HOME
136 | fi
137 | fi
138 | fi
139 |
140 | if [ -z "$JAVACMD" ] ; then
141 | if [ -n "$JAVA_HOME" ] ; then
142 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
143 | # IBM's JDK on AIX uses strange locations for the executables
144 | JAVACMD="$JAVA_HOME/jre/sh/java"
145 | else
146 | JAVACMD="$JAVA_HOME/bin/java"
147 | fi
148 | else
149 | JAVACMD="`which java`"
150 | fi
151 | fi
152 |
153 | if [ ! -x "$JAVACMD" ] ; then
154 | echo "Error: JAVA_HOME is not defined correctly." >&2
155 | echo " We cannot execute $JAVACMD" >&2
156 | exit 1
157 | fi
158 |
159 | if [ -z "$JAVA_HOME" ] ; then
160 | echo "Warning: JAVA_HOME environment variable is not set."
161 | fi
162 |
163 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
164 |
165 | # traverses directory structure from process work directory to filesystem root
166 | # first directory with .mvn subdirectory is considered project base directory
167 | find_maven_basedir() {
168 |
169 | if [ -z "$1" ]
170 | then
171 | echo "Path not specified to find_maven_basedir"
172 | return 1
173 | fi
174 |
175 | basedir="$1"
176 | wdir="$1"
177 | while [ "$wdir" != '/' ] ; do
178 | if [ -d "$wdir"/.mvn ] ; then
179 | basedir=$wdir
180 | break
181 | fi
182 | # workaround for JBEAP-8937 (on Solaris 10/Sparc)
183 | if [ -d "${wdir}" ]; then
184 | wdir=`cd "$wdir/.."; pwd`
185 | fi
186 | # end of workaround
187 | done
188 | echo "${basedir}"
189 | }
190 |
191 | # concatenates all lines of a file
192 | concat_lines() {
193 | if [ -f "$1" ]; then
194 | echo "$(tr -s '\n' ' ' < "$1")"
195 | fi
196 | }
197 |
198 | BASE_DIR=`find_maven_basedir "$(pwd)"`
199 | if [ -z "$BASE_DIR" ]; then
200 | exit 1;
201 | fi
202 |
203 | ##########################################################################################
204 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
205 | # This allows using the maven wrapper in projects that prohibit checking in binary data.
206 | ##########################################################################################
207 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
208 | if [ "$MVNW_VERBOSE" = true ]; then
209 | echo "Found .mvn/wrapper/maven-wrapper.jar"
210 | fi
211 | else
212 | if [ "$MVNW_VERBOSE" = true ]; then
213 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
214 | fi
215 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
216 | while IFS="=" read key value; do
217 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
218 | esac
219 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
220 | if [ "$MVNW_VERBOSE" = true ]; then
221 | echo "Downloading from: $jarUrl"
222 | fi
223 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
224 |
225 | if command -v wget > /dev/null; then
226 | if [ "$MVNW_VERBOSE" = true ]; then
227 | echo "Found wget ... using wget"
228 | fi
229 | wget "$jarUrl" -O "$wrapperJarPath"
230 | elif command -v curl > /dev/null; then
231 | if [ "$MVNW_VERBOSE" = true ]; then
232 | echo "Found curl ... using curl"
233 | fi
234 | curl -o "$wrapperJarPath" "$jarUrl"
235 | else
236 | if [ "$MVNW_VERBOSE" = true ]; then
237 | echo "Falling back to using Java to download"
238 | fi
239 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
240 | if [ -e "$javaClass" ]; then
241 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
242 | if [ "$MVNW_VERBOSE" = true ]; then
243 | echo " - Compiling MavenWrapperDownloader.java ..."
244 | fi
245 | # Compiling the Java class
246 | ("$JAVA_HOME/bin/javac" "$javaClass")
247 | fi
248 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
249 | # Running the downloader
250 | if [ "$MVNW_VERBOSE" = true ]; then
251 | echo " - Running MavenWrapperDownloader.java ..."
252 | fi
253 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
254 | fi
255 | fi
256 | fi
257 | fi
258 | ##########################################################################################
259 | # End of extension
260 | ##########################################################################################
261 |
262 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
263 | if [ "$MVNW_VERBOSE" = true ]; then
264 | echo $MAVEN_PROJECTBASEDIR
265 | fi
266 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
267 |
268 | # For Cygwin, switch paths to Windows format before running java
269 | if $cygwin; then
270 | [ -n "$M2_HOME" ] &&
271 | M2_HOME=`cygpath --path --windows "$M2_HOME"`
272 | [ -n "$JAVA_HOME" ] &&
273 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
274 | [ -n "$CLASSPATH" ] &&
275 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
276 | [ -n "$MAVEN_PROJECTBASEDIR" ] &&
277 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
278 | fi
279 |
280 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
281 |
282 | exec "$JAVACMD" \
283 | $MAVEN_OPTS \
284 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
285 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
286 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
287 |
--------------------------------------------------------------------------------
/mvnw.cmd:
--------------------------------------------------------------------------------
1 | @REM ----------------------------------------------------------------------------
2 | @REM Licensed to the Apache Software Foundation (ASF) under one
3 | @REM or more contributor license agreements. See the NOTICE file
4 | @REM distributed with this work for additional information
5 | @REM regarding copyright ownership. The ASF licenses this file
6 | @REM to you under the Apache License, Version 2.0 (the
7 | @REM "License"); you may not use this file except in compliance
8 | @REM with the License. You may obtain a copy of the License at
9 | @REM
10 | @REM http://www.apache.org/licenses/LICENSE-2.0
11 | @REM
12 | @REM Unless required by applicable law or agreed to in writing,
13 | @REM software distributed under the License is distributed on an
14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | @REM KIND, either express or implied. See the License for the
16 | @REM specific language governing permissions and limitations
17 | @REM under the License.
18 | @REM ----------------------------------------------------------------------------
19 |
20 | @REM ----------------------------------------------------------------------------
21 | @REM Maven2 Start Up Batch script
22 | @REM
23 | @REM Required ENV vars:
24 | @REM JAVA_HOME - location of a JDK home dir
25 | @REM
26 | @REM Optional ENV vars
27 | @REM M2_HOME - location of maven2's installed home dir
28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
31 | @REM e.g. to debug Maven itself, use
32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
34 | @REM ----------------------------------------------------------------------------
35 |
36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
37 | @echo off
38 | @REM set title of command window
39 | title %0
40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
42 |
43 | @REM set %HOME% to equivalent of $HOME
44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
45 |
46 | @REM Execute a user defined script before this one
47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending
49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
51 | :skipRcPre
52 |
53 | @setlocal
54 |
55 | set ERROR_CODE=0
56 |
57 | @REM To isolate internal variables from possible post scripts, we use another setlocal
58 | @setlocal
59 |
60 | @REM ==== START VALIDATION ====
61 | if not "%JAVA_HOME%" == "" goto OkJHome
62 |
63 | echo.
64 | echo Error: JAVA_HOME not found in your environment. >&2
65 | echo Please set the JAVA_HOME variable in your environment to match the >&2
66 | echo location of your Java installation. >&2
67 | echo.
68 | goto error
69 |
70 | :OkJHome
71 | if exist "%JAVA_HOME%\bin\java.exe" goto init
72 |
73 | echo.
74 | echo Error: JAVA_HOME is set to an invalid directory. >&2
75 | echo JAVA_HOME = "%JAVA_HOME%" >&2
76 | echo Please set the JAVA_HOME variable in your environment to match the >&2
77 | echo location of your Java installation. >&2
78 | echo.
79 | goto error
80 |
81 | @REM ==== END VALIDATION ====
82 |
83 | :init
84 |
85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
86 | @REM Fallback to current working directory if not found.
87 |
88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
90 |
91 | set EXEC_DIR=%CD%
92 | set WDIR=%EXEC_DIR%
93 | :findBaseDir
94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound
95 | cd ..
96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound
97 | set WDIR=%CD%
98 | goto findBaseDir
99 |
100 | :baseDirFound
101 | set MAVEN_PROJECTBASEDIR=%WDIR%
102 | cd "%EXEC_DIR%"
103 | goto endDetectBaseDir
104 |
105 | :baseDirNotFound
106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
107 | cd "%EXEC_DIR%"
108 |
109 | :endDetectBaseDir
110 |
111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
112 |
113 | @setlocal EnableExtensions EnableDelayedExpansion
114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
116 |
117 | :endReadAdditionalConfig
118 |
119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
122 |
123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
126 | )
127 |
128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
130 | if exist %WRAPPER_JAR% (
131 | echo Found %WRAPPER_JAR%
132 | ) else (
133 | echo Couldn't find %WRAPPER_JAR%, downloading it ...
134 | echo Downloading from: %DOWNLOAD_URL%
135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
136 | echo Finished downloading %WRAPPER_JAR%
137 | )
138 | @REM End of extension
139 |
140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
141 | if ERRORLEVEL 1 goto error
142 | goto end
143 |
144 | :error
145 | set ERROR_CODE=1
146 |
147 | :end
148 | @endlocal & set ERROR_CODE=%ERROR_CODE%
149 |
150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending
152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
154 | :skipRcPost
155 |
156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause
158 |
159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
160 |
161 | exit /B %ERROR_CODE%
162 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.aakkus
7 | docker-compose-initializr
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | docker-compose-initializr
12 | docker-compose-initializr
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.1.0.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 11
25 | 2.10.1
26 | 2.6
27 | 2.22.1
28 | 1.3.2
29 |
30 |
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-web
35 |
36 |
37 | org.springframework.boot
38 | spring-boot-starter-aop
39 |
40 |
41 | org.springframework.boot
42 | spring-boot-starter-mail
43 |
44 |
45 | org.springframework.retry
46 | spring-retry
47 |
48 |
49 | com.fasterxml.jackson.dataformat
50 | jackson-dataformat-yaml
51 | ${jackson-dataformat-yaml.version}
52 |
53 |
54 | com.fasterxml.jackson.core
55 | jackson-databind
56 | ${jackson-dataformat-yaml.version}
57 |
58 |
59 | com.fasterxml.jackson.core
60 | jackson-core
61 | ${jackson-dataformat-yaml.version}
62 |
63 |
64 | commons-io
65 | commons-io
66 | ${commons-io.version}
67 |
68 |
69 | org.springframework.boot
70 | spring-boot-configuration-processor
71 | true
72 |
73 |
74 | org.projectlombok
75 | lombok
76 | true
77 |
78 |
79 | org.springframework.boot
80 | spring-boot-starter-test
81 | test
82 |
83 |
84 | org.springframework.boot
85 | spring-boot-devtools
86 |
87 |
88 | org.junit.jupiter
89 | junit-jupiter-api
90 | test
91 |
92 |
93 | org.junit.jupiter
94 | junit-jupiter-engine
95 | test
96 |
97 |
98 |
99 |
100 |
101 |
102 | org.springframework.boot
103 | spring-boot-maven-plugin
104 |
105 |
106 | org.apache.maven.plugins
107 | maven-surefire-plugin
108 | ${maven-surefire-plugin.version}
109 |
110 |
111 | org.junit.platform
112 | junit-platform-surefire-provider
113 | ${junit-platform-surefire-provider.version}
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | spring-milestones
123 | Spring Milestones
124 | https://repo.spring.io/milestone
125 |
126 | false
127 |
128 |
129 |
130 |
131 |
132 |
--------------------------------------------------------------------------------
/scripts/cleanup-branches.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | read -p "Are you ready to delete all local branches except master, and delete unused tracking branches from your local (y/n)?" CONT
4 | if [ "$CONT" = "y" ]; then
5 | git branch | grep -v master | xargs git branch -D
6 | git fetch origin --prune
7 | else
8 | echo "Skipped. See you next time.";
9 | fi
10 |
11 |
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/DockerComposeInitializrApplication.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.retry.annotation.EnableRetry;
6 | import org.springframework.scheduling.annotation.EnableAsync;
7 |
8 | @EnableAsync
9 | @EnableRetry
10 | @SpringBootApplication
11 | public class DockerComposeInitializrApplication {
12 |
13 | public static void main(String[] args) {
14 | SpringApplication.run(DockerComposeInitializrApplication.class, args);
15 | }
16 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/domain/DockerComposeFileFacade.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.domain;
2 |
3 | import com.aakkus.dockercomposeinitializr.domain.model.CreateDockerComposeFileCommand;
4 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeFile;
5 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeServiceDefinition;
6 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeVersionDefinition;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 |
11 | @Service
12 | public class DockerComposeFileFacade {
13 |
14 | private final DockerComposeFilePort dockerComposeFilePort;
15 |
16 | public DockerComposeFileFacade(DockerComposeFilePort dockerComposeFilePort) {
17 | this.dockerComposeFilePort = dockerComposeFilePort;
18 | }
19 |
20 | public DockerComposeFile create(CreateDockerComposeFileCommand createDockerComposeFileCommand) {
21 | return dockerComposeFilePort.create(createDockerComposeFileCommand);
22 | }
23 |
24 | public List retrieveVersions() {
25 | return dockerComposeFilePort.retrieveDockerComposeVersions();
26 | }
27 |
28 | public List retrieveServices() {
29 | return dockerComposeFilePort.retrieveDockerComposeServices();
30 | }
31 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/domain/DockerComposeFilePort.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.domain;
2 |
3 | import com.aakkus.dockercomposeinitializr.domain.model.CreateDockerComposeFileCommand;
4 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeFile;
5 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeServiceDefinition;
6 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeVersionDefinition;
7 |
8 | import java.util.List;
9 |
10 | public interface DockerComposeFilePort {
11 |
12 | DockerComposeFile create(CreateDockerComposeFileCommand createDockerComposeFileCommand);
13 |
14 | List retrieveDockerComposeVersions();
15 |
16 | List retrieveDockerComposeServices();
17 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/domain/FeedbackFacade.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.domain;
2 |
3 | import org.springframework.stereotype.Service;
4 |
5 | @Service
6 | public class FeedbackFacade {
7 |
8 | private final FeedbackPort feedbackPort;
9 |
10 | public FeedbackFacade(FeedbackPort feedbackPort) {
11 | this.feedbackPort = feedbackPort;
12 | }
13 |
14 | public void sendFeedback(String feedback) {
15 | feedbackPort.send(feedback);
16 | }
17 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/domain/FeedbackPort.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.domain;
2 |
3 | public interface FeedbackPort {
4 |
5 | void send(String feedback);
6 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/domain/model/CreateDockerComposeFileCommand.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.domain.model;
2 |
3 | import java.util.List;
4 |
5 | public class CreateDockerComposeFileCommand {
6 |
7 | private String version;
8 | private List services;
9 |
10 | public CreateDockerComposeFileCommand() {
11 | }
12 |
13 | private CreateDockerComposeFileCommand(Builder builder) {
14 | this.version = builder.version;
15 | this.services = builder.services;
16 | }
17 |
18 | public static Builder builder() {
19 | return new Builder();
20 | }
21 |
22 | public String getVersion() {
23 | return version;
24 | }
25 |
26 | public void setVersion(String version) {
27 | this.version = version;
28 | }
29 |
30 | public List getServices() {
31 | return services;
32 | }
33 |
34 | public void setServices(List services) {
35 | this.services = services;
36 | }
37 |
38 | public static final class Builder {
39 | private String version;
40 | private List services;
41 |
42 | private Builder() {
43 | }
44 |
45 | public CreateDockerComposeFileCommand build() {
46 | return new CreateDockerComposeFileCommand(this);
47 | }
48 |
49 | public Builder version(String version) {
50 | this.version = version;
51 | return this;
52 | }
53 |
54 | public Builder services(List services) {
55 | this.services = services;
56 | return this;
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/domain/model/DockerComposeFile.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.domain.model;
2 |
3 | import java.util.List;
4 |
5 | public class DockerComposeFile {
6 |
7 | private String version;
8 | private List services;
9 | private String composeFileContent;
10 |
11 | public DockerComposeFile() {
12 | }
13 |
14 | private DockerComposeFile(Builder builder) {
15 | this.version = builder.version;
16 | this.services = builder.services;
17 | this.composeFileContent = builder.composeFileContent;
18 | }
19 |
20 | public static Builder builder() {
21 | return new Builder();
22 | }
23 |
24 | public String getVersion() {
25 | return version;
26 | }
27 |
28 | public void setVersion(String version) {
29 | this.version = version;
30 | }
31 |
32 | public List getServices() {
33 | return services;
34 | }
35 |
36 | public void setServices(List services) {
37 | this.services = services;
38 | }
39 |
40 | public String getComposeFileContent() {
41 | return composeFileContent;
42 | }
43 |
44 | public void setComposeFileContent(String composeFileContent) {
45 | this.composeFileContent = composeFileContent;
46 | }
47 |
48 | public static final class Builder {
49 | private String version;
50 | private List services;
51 | private String composeFileContent;
52 |
53 | private Builder() {
54 | }
55 |
56 | public DockerComposeFile build() {
57 | return new DockerComposeFile(this);
58 | }
59 |
60 | public Builder version(String version) {
61 | this.version = version;
62 | return this;
63 | }
64 |
65 | public Builder services(List services) {
66 | this.services = services;
67 | return this;
68 | }
69 |
70 | public Builder composeFileContent(String composeFileContent) {
71 | this.composeFileContent = composeFileContent;
72 | return this;
73 | }
74 | }
75 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/domain/model/DockerComposeServiceDefinition.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.domain.model;
2 |
3 | import java.util.Map;
4 |
5 | public class DockerComposeServiceDefinition {
6 |
7 | private String name;
8 | private String command;
9 | private String image;
10 | private String restartCondition;
11 | private String[] ports;
12 | private Map environments = Map.of();
13 |
14 | public String getName() {
15 | return name;
16 | }
17 |
18 | public void setName(String name) {
19 | this.name = name;
20 | }
21 |
22 | public String getCommand() {
23 | return command;
24 | }
25 |
26 | public void setCommand(String command) {
27 | this.command = command;
28 | }
29 |
30 | public String getImage() {
31 | return image;
32 | }
33 |
34 | public void setImage(String image) {
35 | this.image = image;
36 | }
37 |
38 | public String getRestartCondition() {
39 | return restartCondition;
40 | }
41 |
42 | public void setRestartCondition(String restartCondition) {
43 | this.restartCondition = restartCondition;
44 | }
45 |
46 | public String[] getPorts() {
47 | return ports;
48 | }
49 |
50 | public void setPorts(String[] ports) {
51 | this.ports = ports;
52 | }
53 |
54 | public Map getEnvironments() {
55 | return environments;
56 | }
57 |
58 | public void setEnvironments(Map environments) {
59 | this.environments = environments;
60 | }
61 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/domain/model/DockerComposeVersionDefinition.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.domain.model;
2 |
3 | public class DockerComposeVersionDefinition {
4 |
5 | private String name;
6 | private String version;
7 |
8 | public DockerComposeVersionDefinition() {
9 | }
10 |
11 | private DockerComposeVersionDefinition(Builder builder) {
12 | this.name = builder.name;
13 | this.version = builder.version;
14 | }
15 |
16 | public static Builder builder() {
17 | return new Builder();
18 | }
19 |
20 | public String getName() {
21 | return name;
22 | }
23 |
24 | public void setName(String name) {
25 | this.name = name;
26 | }
27 |
28 | public String getVersion() {
29 | return version;
30 | }
31 |
32 | public void setVersion(String version) {
33 | this.version = version;
34 | }
35 |
36 | public static final class Builder {
37 | private String name;
38 | private String version;
39 |
40 | private Builder() {
41 | }
42 |
43 | public DockerComposeVersionDefinition build() {
44 | return new DockerComposeVersionDefinition(this);
45 | }
46 |
47 | public Builder name(String name) {
48 | this.name = name;
49 | return this;
50 | }
51 |
52 | public Builder version(String version) {
53 | this.version = version;
54 | return this;
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/infra/adapter/DockerComposeFileAdapter.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.infra.adapter;
2 |
3 | import com.aakkus.dockercomposeinitializr.domain.DockerComposeFilePort;
4 | import com.aakkus.dockercomposeinitializr.domain.model.CreateDockerComposeFileCommand;
5 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeFile;
6 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeServiceDefinition;
7 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeVersionDefinition;
8 | import com.aakkus.dockercomposeinitializr.infra.adapter.model.DockerComposeService;
9 | import com.aakkus.dockercomposeinitializr.infra.config.DockerComposeConfiguration;
10 | import com.fasterxml.jackson.annotation.JsonInclude;
11 | import com.fasterxml.jackson.databind.MapperFeature;
12 | import com.fasterxml.jackson.databind.ObjectMapper;
13 | import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
14 | import org.slf4j.Logger;
15 | import org.slf4j.LoggerFactory;
16 | import org.springframework.beans.factory.annotation.Value;
17 | import org.springframework.stereotype.Service;
18 |
19 | import java.util.*;
20 | import java.util.function.Function;
21 | import java.util.stream.Collectors;
22 |
23 | @Service
24 | public class DockerComposeFileAdapter implements DockerComposeFilePort {
25 |
26 | private static final Logger logger = LoggerFactory.getLogger(DockerComposeFileAdapter.class);
27 |
28 | private final ObjectMapper objectMapper;
29 | private final DockerComposeConfiguration dockerComposeConfiguration;
30 | private final String containerNamePrefix;
31 |
32 | public DockerComposeFileAdapter(DockerComposeConfiguration dockerComposeConfiguration, @Value("${spring.application.name}") String containerNamePrefix) {
33 | this.objectMapper = new ObjectMapper(new YAMLFactory());
34 | this.objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
35 | this.objectMapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, false);
36 | this.dockerComposeConfiguration = dockerComposeConfiguration;
37 | this.containerNamePrefix = containerNamePrefix.concat("-");
38 | }
39 |
40 | @Override
41 | public DockerComposeFile create(CreateDockerComposeFileCommand createDockerComposeFileCommand) {
42 | Map serviceMap = createServiceMap(createDockerComposeFileCommand);
43 | DockerComposeVersionDefinition versionDefinition = createServiceDefinition(createDockerComposeFileCommand);
44 |
45 | Map composeFileMap = Map.of("version", versionDefinition.getVersion(), "services", serviceMap);
46 | String composeFileContent = createDockerComposeFileContent(composeFileMap);
47 |
48 | logger.info("Docker compose file created successfully. Version: {} and Services: {}", versionDefinition.getVersion(), createDockerComposeFileCommand.getServices());
49 | return DockerComposeFile.builder()
50 | .services(createDockerComposeFileCommand.getServices())
51 | .version(versionDefinition.getVersion())
52 | .composeFileContent(composeFileContent)
53 | .build();
54 | }
55 |
56 | @Override
57 | public List retrieveDockerComposeVersions() {
58 | return dockerComposeConfiguration.getVersions();
59 | }
60 |
61 | @Override
62 | public List retrieveDockerComposeServices() {
63 | return dockerComposeConfiguration.getServices()
64 | .stream()
65 | .sorted(Comparator.comparing(DockerComposeServiceDefinition::getName))
66 | .collect(Collectors.toList());
67 | }
68 |
69 | private Map createServiceMap(CreateDockerComposeFileCommand createDockerComposeFileCommand) {
70 | List dockerComposeServices = createDockerComposeFileCommand.getServices().stream()
71 | .map(service -> dockerComposeConfiguration.getServices().stream().filter(s -> service.equalsIgnoreCase(s.getName())).findFirst())
72 | .map(this::convertToDockerComposeService)
73 | .filter(Objects::nonNull)
74 | .collect(Collectors.toList());
75 |
76 | return dockerComposeServices
77 | .stream()
78 | .collect(Collectors.toMap(DockerComposeService::getServiceName, Function.identity()));
79 | }
80 |
81 | private DockerComposeVersionDefinition createServiceDefinition(CreateDockerComposeFileCommand createDockerComposeFileCommand) {
82 | return dockerComposeConfiguration.getVersions()
83 | .stream()
84 | .filter(service -> createDockerComposeFileCommand.getVersion().equalsIgnoreCase(service.getVersion()))
85 | .findAny()
86 | .orElse(dockerComposeConfiguration.getVersions().get(0));
87 | }
88 |
89 | private String createDockerComposeFileContent(Map map) {
90 | try {
91 | return objectMapper.writeValueAsString(map).replaceFirst("---\\n","");
92 | } catch (Exception e) {
93 | throw new RuntimeException(e);
94 | }
95 | }
96 |
97 | private DockerComposeService convertToDockerComposeService(Optional dockerComposeServiceDefinition) {
98 | return dockerComposeServiceDefinition
99 | .map(definition -> DockerComposeService.builder()
100 | .serviceName(definition.getName().replaceAll("/", "-"))
101 | .containerName(containerNamePrefix.concat(definition.getName().replaceAll("/", "-")))
102 | .restart(definition.getRestartCondition())
103 | .ports(definition.getPorts())
104 | .image(definition.getImage())
105 | .command(definition.getCommand())
106 | .environment(definition.getEnvironments())
107 | .build())
108 | .orElse(null);
109 | }
110 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/infra/adapter/FeedbackAdapter.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.infra.adapter;
2 |
3 | import com.aakkus.dockercomposeinitializr.domain.FeedbackPort;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 | import org.springframework.boot.autoconfigure.mail.MailProperties;
7 | import org.springframework.mail.MailSender;
8 | import org.springframework.mail.SimpleMailMessage;
9 | import org.springframework.retry.annotation.Backoff;
10 | import org.springframework.retry.annotation.Recover;
11 | import org.springframework.retry.annotation.Retryable;
12 | import org.springframework.scheduling.annotation.Async;
13 | import org.springframework.stereotype.Service;
14 |
15 | @Service
16 | public class FeedbackAdapter implements FeedbackPort {
17 |
18 | private final static Logger logger = LoggerFactory.getLogger(FeedbackAdapter.class);
19 |
20 | private final MailSender mailSender;
21 | private final MailProperties mailProperties;
22 |
23 | public FeedbackAdapter(MailSender mailSender, MailProperties mailProperties) {
24 | this.mailSender = mailSender;
25 | this.mailProperties = mailProperties;
26 | }
27 |
28 | @Async
29 | @Override
30 | @Retryable(backoff = @Backoff(value = 3000L))
31 | public void send(String feedback) {
32 | SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
33 |
34 | simpleMailMessage.setText(feedback);
35 | simpleMailMessage.setTo(retrieveMailProperty("to"));
36 | simpleMailMessage.setSubject(retrieveMailProperty("subject"));
37 |
38 | mailSender.send(simpleMailMessage);
39 |
40 | logger.info("Feedback sent: {}", simpleMailMessage);
41 | }
42 |
43 | @Recover
44 | private void feedbackSendRecover(Exception e, String feedback) {
45 | logger.error("An error occurred while sending feedback: {}, Exception: {}", feedback, e);
46 | }
47 |
48 | private String retrieveMailProperty(String property) {
49 | return mailProperties.getProperties().get(property);
50 | }
51 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/infra/adapter/model/DockerComposeService.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.infra.adapter.model;
2 |
3 | import com.fasterxml.jackson.annotation.JsonIgnore;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 |
6 | import java.util.Map;
7 |
8 | public class DockerComposeService {
9 |
10 | @JsonIgnore
11 | private String serviceName;
12 |
13 | @JsonProperty("container_name")
14 | private String containerName;
15 | private String image;
16 | private String command;
17 | private String restart;
18 | private String[] ports;
19 | private Map environment;
20 |
21 | public DockerComposeService() {
22 | }
23 |
24 | private DockerComposeService(Builder builder) {
25 | this.serviceName = builder.serviceName;
26 | this.containerName = builder.containerName;
27 | this.image = builder.image;
28 | this.command = builder.command;
29 | this.restart = builder.restart;
30 | this.ports = builder.ports;
31 | this.environment = builder.environment;
32 | }
33 |
34 | public static Builder builder() {
35 | return new Builder();
36 | }
37 |
38 | public String getServiceName() {
39 | return serviceName;
40 | }
41 |
42 | public void setServiceName(String serviceName) {
43 | this.serviceName = serviceName;
44 | }
45 |
46 | public String getContainerName() {
47 | return containerName;
48 | }
49 |
50 | public void setContainerName(String containerName) {
51 | this.containerName = containerName;
52 | }
53 |
54 | public String getImage() {
55 | return image;
56 | }
57 |
58 | public void setImage(String image) {
59 | this.image = image;
60 | }
61 |
62 | public String getCommand() {
63 | return command;
64 | }
65 |
66 | public void setCommand(String command) {
67 | this.command = command;
68 | }
69 |
70 | public String getRestart() {
71 | return restart;
72 | }
73 |
74 | public void setRestart(String restart) {
75 | this.restart = restart;
76 | }
77 |
78 | public String[] getPorts() {
79 | return ports;
80 | }
81 |
82 | public void setPorts(String[] ports) {
83 | this.ports = ports;
84 | }
85 |
86 | public Map getEnvironment() {
87 | return environment;
88 | }
89 |
90 | public void setEnvironment(Map environment) {
91 | this.environment = environment;
92 | }
93 |
94 | public static final class Builder {
95 | private String serviceName;
96 | private String containerName;
97 | private String image;
98 | private String command;
99 | private String restart;
100 | private String[] ports;
101 | private Map environment;
102 |
103 | private Builder() {
104 | }
105 |
106 | public DockerComposeService build() {
107 | return new DockerComposeService(this);
108 | }
109 |
110 | public Builder serviceName(String serviceName) {
111 | this.serviceName = serviceName;
112 | return this;
113 | }
114 |
115 | public Builder containerName(String containerName) {
116 | this.containerName = containerName;
117 | return this;
118 | }
119 |
120 | public Builder image(String image) {
121 | this.image = image;
122 | return this;
123 | }
124 |
125 |
126 | public Builder command(String command) {
127 | this.command = command;
128 | return this;
129 | }
130 |
131 | public Builder restart(String restart) {
132 | this.restart = restart;
133 | return this;
134 | }
135 |
136 | public Builder ports(String[] ports) {
137 | this.ports = ports;
138 | return this;
139 | }
140 |
141 | public Builder environment(Map environment) {
142 | this.environment = environment;
143 | return this;
144 | }
145 | }
146 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/infra/config/DockerComposeConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.infra.config;
2 |
3 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeServiceDefinition;
4 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeVersionDefinition;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | import java.util.List;
9 |
10 | @Configuration
11 | @ConfigurationProperties(prefix = "docker.compose")
12 | public class DockerComposeConfiguration {
13 |
14 | private List versions;
15 | private List services;
16 |
17 | public List getVersions() {
18 | return versions;
19 | }
20 |
21 | public void setVersions(List versions) {
22 | this.versions = versions;
23 | }
24 |
25 | public List getServices() {
26 | return services;
27 | }
28 |
29 | public void setServices(List services) {
30 | this.services = services;
31 | }
32 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/infra/rest/DockerComposeRestController.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.infra.rest;
2 |
3 | import com.aakkus.dockercomposeinitializr.domain.DockerComposeFileFacade;
4 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeFile;
5 | import com.aakkus.dockercomposeinitializr.infra.rest.model.DockerComposeServiceDefinitionModel;
6 | import com.aakkus.dockercomposeinitializr.infra.rest.model.DockerComposeVersionDefinitionModel;
7 | import com.aakkus.dockercomposeinitializr.infra.rest.request.CreateDockerComposeFileRequest;
8 | import com.aakkus.dockercomposeinitializr.infra.rest.response.DockerComposeResponse;
9 | import org.springframework.http.ResponseEntity;
10 | import org.springframework.web.bind.annotation.*;
11 |
12 | import java.util.List;
13 | import java.util.stream.Collectors;
14 |
15 | @RestController
16 | @RequestMapping("/api/v1/docker-compose")
17 | public class DockerComposeRestController {
18 |
19 | private final DockerComposeFileFacade dockerComposeFileFacade;
20 |
21 | public DockerComposeRestController(DockerComposeFileFacade dockerComposeFileFacade) {
22 | this.dockerComposeFileFacade = dockerComposeFileFacade;
23 | }
24 |
25 | @GetMapping
26 | public ResponseEntity retrieveDockerComposeMetadata() {
27 | List versions = dockerComposeFileFacade.retrieveVersions()
28 | .stream()
29 | .map(DockerComposeVersionDefinitionModel::toModel)
30 | .collect(Collectors.toList());
31 |
32 | List services = dockerComposeFileFacade.retrieveServices()
33 | .stream()
34 | .map(DockerComposeServiceDefinitionModel::toModel)
35 | .collect(Collectors.toList());
36 |
37 | return ResponseEntity.ok(new DockerComposeResponse(versions, services));
38 | }
39 |
40 | @PostMapping
41 | public ResponseEntity createDockerComposeFile(@RequestBody CreateDockerComposeFileRequest createDockerComposeFileRequest) {
42 | DockerComposeFile dockerComposeFile = dockerComposeFileFacade.create(createDockerComposeFileRequest.toCommand());
43 | return ResponseEntity.ok(dockerComposeFile);
44 | }
45 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/infra/rest/FeedbackController.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.infra.rest;
2 |
3 | import com.aakkus.dockercomposeinitializr.domain.FeedbackFacade;
4 | import org.springframework.http.ResponseEntity;
5 | import org.springframework.web.bind.annotation.PostMapping;
6 | import org.springframework.web.bind.annotation.RequestBody;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | @RestController
11 | @RequestMapping("/api/v1/feedback")
12 | public class FeedbackController {
13 |
14 | private final FeedbackFacade feedbackFacade;
15 |
16 | public FeedbackController(FeedbackFacade feedbackFacade) {
17 | this.feedbackFacade = feedbackFacade;
18 | }
19 |
20 | @PostMapping
21 | public ResponseEntity sendFeedback(@RequestBody String feedback) {
22 | feedbackFacade.sendFeedback(feedback);
23 | return ResponseEntity.ok().build();
24 | }
25 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/infra/rest/model/DockerComposeServiceDefinitionModel.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.infra.rest.model;
2 |
3 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeServiceDefinition;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 |
6 | public class DockerComposeServiceDefinitionModel {
7 |
8 | @JsonProperty("value")
9 | private String name;
10 |
11 | public DockerComposeServiceDefinitionModel() {
12 | }
13 |
14 | private DockerComposeServiceDefinitionModel(String name) {
15 | this.name = name;
16 | }
17 |
18 | public static DockerComposeServiceDefinitionModel toModel(DockerComposeServiceDefinition definition) {
19 | return new DockerComposeServiceDefinitionModel(definition.getName());
20 | }
21 |
22 | public String getName() {
23 | return name;
24 | }
25 |
26 | public void setName(String name) {
27 | this.name = name;
28 | }
29 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/infra/rest/model/DockerComposeVersionDefinitionModel.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.infra.rest.model;
2 |
3 | import com.aakkus.dockercomposeinitializr.domain.model.DockerComposeVersionDefinition;
4 |
5 | public class DockerComposeVersionDefinitionModel {
6 |
7 | private String name;
8 | private String version;
9 |
10 | public DockerComposeVersionDefinitionModel() {
11 | }
12 |
13 | private DockerComposeVersionDefinitionModel(String name, String version) {
14 | this.name = name;
15 | this.version = version;
16 | }
17 |
18 | public String getName() {
19 | return name;
20 | }
21 |
22 | public void setName(String name) {
23 | this.name = name;
24 | }
25 |
26 | public String getVersion() {
27 | return version;
28 | }
29 |
30 | public void setVersion(String version) {
31 | this.version = version;
32 | }
33 |
34 | public static DockerComposeVersionDefinitionModel toModel(DockerComposeVersionDefinition definition) {
35 | return new DockerComposeVersionDefinitionModel(definition.getName(), definition.getVersion());
36 | }
37 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/infra/rest/request/CreateDockerComposeFileRequest.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.infra.rest.request;
2 |
3 | import com.aakkus.dockercomposeinitializr.domain.model.CreateDockerComposeFileCommand;
4 |
5 | import java.util.List;
6 |
7 | public class CreateDockerComposeFileRequest {
8 |
9 | private String version;
10 | private List services;
11 |
12 | public String getVersion() {
13 | return version;
14 | }
15 |
16 | public void setVersion(String version) {
17 | this.version = version;
18 | }
19 |
20 | public List getServices() {
21 | return services;
22 | }
23 |
24 | public void setServices(List services) {
25 | this.services = services;
26 | }
27 |
28 | public CreateDockerComposeFileCommand toCommand() {
29 | return CreateDockerComposeFileCommand.builder()
30 | .services(services)
31 | .version(version)
32 | .build();
33 | }
34 | }
--------------------------------------------------------------------------------
/src/main/java/com/aakkus/dockercomposeinitializr/infra/rest/response/DockerComposeResponse.java:
--------------------------------------------------------------------------------
1 | package com.aakkus.dockercomposeinitializr.infra.rest.response;
2 |
3 | import com.aakkus.dockercomposeinitializr.infra.rest.model.DockerComposeServiceDefinitionModel;
4 | import com.aakkus.dockercomposeinitializr.infra.rest.model.DockerComposeVersionDefinitionModel;
5 |
6 | import java.util.List;
7 |
8 | public class DockerComposeResponse {
9 |
10 | private List versions;
11 | private List services;
12 |
13 | public DockerComposeResponse() {
14 | }
15 |
16 | public DockerComposeResponse(List versions, List services) {
17 | this.versions = versions;
18 | this.services = services;
19 | }
20 |
21 | public List getVersions() {
22 | return versions;
23 | }
24 |
25 | public void setVersions(List versions) {
26 | this.versions = versions;
27 | }
28 |
29 | public List getServices() {
30 | return services;
31 | }
32 |
33 | public void setServices(List services) {
34 | this.services = services;
35 | }
36 | }
--------------------------------------------------------------------------------
/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: docker-compose-initializr
4 | mail:
5 | host: smtp.gmail.com
6 | port: 587
7 | username: ${mail-username}
8 | password: ${mail-password}
9 | protocol: smtp
10 | defaultEncoding: UTF-8
11 | properties:
12 | subject: ${mail-subject}
13 | to: ${mail-to}
14 | mail.smtp.auth: true
15 | mail.smtp.starttls.enable: true
16 | mail.smtp.starttls.required: true
17 |
18 | docker:
19 | compose:
20 | versions:
21 | -
22 | version: '3.0'
23 | name: 'Version 3.0 for Docker 1.13.0+'
24 | -
25 | version: '3.1'
26 | name: 'Version 3.1 for Docker 1.13.1+'
27 | -
28 | version: '3.5'
29 | name: 'Version 3.5 for Docker 17.12.0+'
30 | -
31 | version: '3.6'
32 | name: 'Version 3.6 for Docker 18.02.0+'
33 | -
34 | version: '3.7'
35 | name: 'Version 3.7 for Docker 18.06.0+'
36 | services:
37 | -
38 | name: 'redis'
39 | image: 'redis:latest'
40 | restartCondition: 'on-failure'
41 | ports:
42 | - '6379:6379'
43 | -
44 | name: 'mongo'
45 | image: 'mongo:latest'
46 | restartCondition: 'on-failure'
47 | ports:
48 | - '27017:27017'
49 | environments:
50 | MONGO_INITDB_ROOT_USERNAME: root
51 | MONGO_INITDB_ROOT_PASSWORD: password
52 | -
53 | name: 'confluent/kafka'
54 | image: 'confluent/kafka:latest'
55 | restartCondition: 'on-failure'
56 | ports:
57 | - '9092:9092'
58 | environments:
59 | KAFKA_BROKER_ID: 1
60 | KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
61 | KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
62 | KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
63 | KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
64 | KAFKA_AUTO_CREATE_TOPICS_ENABLE: true
65 | -
66 | name: 'postgres'
67 | image: 'postgres:latest'
68 | restartCondition: 'on-failure'
69 | ports:
70 | - '5432:5432'
71 | environments:
72 | POSTGRES_PASSWORD: password
73 | -
74 | name: 'nginx'
75 | image: 'nginx:latest'
76 | restartCondition: 'on-failure'
77 | ports:
78 | - '8080:80'
79 | environments:
80 | NGINX_PORT: 80
81 | -
82 | name: 'mysql'
83 | command: --default-authentication-plugin=mysql_native_password
84 | image: 'mysql:latest'
85 | restartCondition: 'on-failure'
86 | ports:
87 | - '3306:3306'
88 | environments:
89 | MYSQL_ROOT_PASSWORD: password
90 | -
91 | name: 'mariadb'
92 | image: 'mariadb:latest'
93 | restartCondition: 'on-failure'
94 | ports:
95 | - '3306:3306'
96 | environments:
97 | MYSQL_ROOT_PASSWORD: password
98 | -
99 | name: 'memcached'
100 | image: 'memcached:latest'
101 | restartCondition: 'on-failure'
102 | ports:
103 | - '11211:11211'
104 | -
105 | name: 'registry'
106 | image: 'registry:latest'
107 | restartCondition: 'on-failure'
108 | ports:
109 | - '5000:5000'
110 | -
111 | name: 'rabbitmq'
112 | image: 'rabbitmq:latest'
113 | restartCondition: 'on-failure'
114 | ports:
115 | - '5672:5672'
116 | environments:
117 | RABBITMQ_DEFAULT_USER: user
118 | RABBITMQ_DEFAULT_PASS: password
119 | -
120 | name: 'rabbitmq management'
121 | image: 'rabbitmq:3-management'
122 | restartCondition: 'on-failure'
123 | ports:
124 | - '8080:15672'
125 | -
126 | name: 'wordpress'
127 | image: 'wordpress:latest'
128 | restartCondition: 'on-failure'
129 | ports:
130 | - '8080:80'
131 | environments:
132 | WORDPRESS_DB_HOST: db
133 | WORDPRESS_DB_USER: user
134 | WORDPRESS_DB_PASSWORD: password
135 | WORDPRESS_DB_NAME: name
136 | -
137 | name: 'elasticsearch'
138 | image: 'elasticsearch:6.5.1'
139 | restartCondition: 'on-failure'
140 | ports:
141 | - '9200:9200'
142 | - '9300:9300'
143 | environments:
144 | DISCOVERY_TYPE: single-node
145 | -
146 | name: 'influxdb'
147 | image: 'influxdb:latest'
148 | restartCondition: 'on-failure'
149 | ports:
150 | - '8086:8086'
151 | -
152 | name: 'tomcat'
153 | image: 'tomcat:latest'
154 | restartCondition: 'on-failure'
155 | ports:
156 | - '8888:8080'
157 | -
158 | name: 'jenkins'
159 | image: 'jenkins:latest'
160 | restartCondition: 'on-failure'
161 | ports:
162 | - '8080:8080'
163 | - '50000:50000'
164 | -
165 | name: 'ghost'
166 | image: 'ghost:latest'
167 | restartCondition: 'on-failure'
168 | ports:
169 | - '2368:2368'
170 | -
171 | name: 'kibana'
172 | image: 'kibana:latest'
173 | restartCondition: 'on-failure'
174 | ports:
175 | - '5601:5601'
176 | -
177 | name: 'drupal'
178 | image: 'drupal:latest'
179 | restartCondition: 'on-failure'
180 | ports:
181 | - '8080:80'
182 | -
183 | name: 'cassandra'
184 | image: 'cassandra:latest'
185 | restartCondition: 'on-failure'
186 | ports:
187 | - '7000:7000'
188 | - '7001:7001'
189 | - '7199:7199'
190 | - '9042:9042'
191 | - '9160:9160'
192 | -
193 | name: 'sonarqube'
194 | image: 'sonarqube:latest'
195 | restartCondition: 'on-failure'
196 | ports:
197 | - '9000:9000'
198 | - '9092:9092'
199 | - '7199:7199'
200 | - '9042:9042'
201 | - '9160:9160'
202 | environments:
203 | SONARQUBE_JDBC_USERNAME: sonar
204 | SONARQUBE_JDBC_PASSWORD: sonar
205 | SONARQUBE_JDBC_URL: jdbc:postgresql://localhost/sonar
206 | -
207 | name: 'vault'
208 | image: 'vault:latest'
209 | restartCondition: 'on-failure'
210 | ports:
211 | - '8200:8200'
212 | environments:
213 | VAULT_ADDR: http://127.0.0.1:8200
214 | -
215 | name: 'neo4j'
216 | image: 'neo4j:latest'
217 | restartCondition: 'on-failure'
218 | ports:
219 | - '7474:7474'
220 | - '7687:7687'
221 | -
222 | name: 'owncloud'
223 | image: 'owncloud:latest'
224 | restartCondition: 'on-failure'
225 | ports:
226 | - '80:80'
227 | -
228 | name: 'solr'
229 | image: 'solr:latest'
230 | restartCondition: 'on-failure'
231 | ports:
232 | - '8983:8983'
233 | -
234 | name: 'rethinkdb'
235 | image: 'rethinkdb:latest'
236 | restartCondition: 'on-failure'
237 | ports:
238 | - '28015:28015'
239 | - '29015:29015'
240 | - '8080:8080'
241 | -
242 | name: 'chronograf'
243 | image: 'chronograf:latest'
244 | restartCondition: 'on-failure'
245 | ports:
246 | - '8888:8888'
247 | -
248 | name: 'zookeeper'
249 | image: 'zookeeper:latest'
250 | restartCondition: 'on-failure'
251 | ports:
252 | - '2181:2181'
253 | - '2888:2888'
254 | - '3888:3888'
255 | environments:
256 | ZOOKEEPER_CLIENT_PORT: 2181
257 | ZOOKEEPER_TICK_TIME: 2000
258 | -
259 | name: 'couchdb'
260 | image: 'couchdb:latest'
261 | restartCondition: 'on-failure'
262 | ports:
263 | - '5984:5984'
264 | -
265 | name: 'joomla'
266 | image: 'joomla:latest'
267 | restartCondition: 'on-failure'
268 | ports:
269 | - '8080:80'
270 | environments:
271 | JOOMLA_DB_HOST: joomladb
272 | JOOMLA_DB_PASSWORD: password
273 | -
274 | name: 'adminer'
275 | image: 'adminer:latest'
276 | restartCondition: 'on-failure'
277 | ports:
278 | - '8080:8080'
279 | -
280 | name: 'jetty'
281 | image: 'jetty:latest'
282 | restartCondition: 'on-failure'
283 | ports:
284 | - '8080:8080'
285 | - '8443:8443'
286 | -
287 | name: 'redmine'
288 | image: 'redmine:latest'
289 | restartCondition: 'on-failure'
290 | ports:
291 | - '8080:3000'
292 | -
293 | name: 'couchbase'
294 | image: 'couchbase:latest'
295 | restartCondition: 'on-failure'
296 | ports:
297 | - '8091-8094:8091-8094'
298 | - '11210:11210'
299 | -
300 | name: 'kapacitor'
301 | image: 'kapacitor:latest'
302 | restartCondition: 'on-failure'
303 | ports:
304 | - '9092:9092'
305 | -
306 | name: 'crate'
307 | image: 'crate:latest'
308 | restartCondition: 'on-failure'
309 | ports:
310 | - '4200:4200'
311 | -
312 | name: 'odoo'
313 | image: 'odoo:latest'
314 | restartCondition: 'on-failure'
315 | ports:
316 | - '8069:8069'
317 | environments:
318 | HOST: odoodb
319 | USER: odoo
320 | PASSWORD: password
321 | -
322 | name: 'arangodb'
323 | image: 'arangodb:latest'
324 | restartCondition: 'on-failure'
325 | ports:
326 | - '8529:8529'
327 | -
328 | name: 'nextcloud'
329 | image: 'nextcloud:latest'
330 | restartCondition: 'on-failure'
331 | ports:
332 | - '8080:80'
333 | -
334 | name: 'kong'
335 | image: 'kong:latest'
336 | restartCondition: 'on-failure'
337 | ports:
338 | - '8000:8000'
339 | - '8443:8443'
340 | - '8001:8001'
341 | - '8444:8444'
342 | environments:
343 | KONG_DATABASE: cassandra
344 | KONG_CASSANDRA_CONTACT_POINTS: kong-database
345 | KONG_PROXY_ACCESS_LOG: /dev/stdout
346 | KONG_ADMIN_ACCESS_LOG: /dev/stdout
347 | KONG_PROXY_ERROR_LOG: /dev/stderr
348 | KONG_ADMIN_ERROR_LOG: /dev/stderr
349 | KONG_ADMIN_LISTEN: 0.0.0.0:8001
350 | KONG_ADMIN_LISTEN_SSL: 0.0.0.0:8444
351 | -
352 | name: 'hazelcast'
353 | image: 'hazelcast/hazelcast:latest'
354 | restartCondition: 'on-failure'
355 | ports:
356 | - '5701:5701'
357 | environments:
358 | JAVA_OPTS: '-Dhazelcast.local.publicAddress=CHANGE_THIS_WITH_HOST_IP:5701'
359 | -
360 | name: 'hazelcast-management-center'
361 | image: 'hazelcast/management-center:latest'
362 | restartCondition: 'on-failure'
363 | ports:
364 | - '8080:8080'
365 |
--------------------------------------------------------------------------------
/src/main/resources/static/css/app.css:
--------------------------------------------------------------------------------
1 | @import url("//unpkg.com/element-ui@2.4.11/lib/theme-chalk/index.css");
2 | .el-header, .el-footer {
3 | background-color: #B3C0D1;
4 | color: #333;
5 | text-align: center;
6 | line-height: 60px;
7 | }
8 |
9 | .el-aside {
10 | background-color: #D3DCE6;
11 | color: #333;
12 | text-align: center;
13 | line-height: 200px;
14 | }
15 |
16 | .el-main {
17 | background-color: #E9EEF3;
18 | color: #333;
19 | text-align: center;
20 | line-height: 160px;
21 | }
22 |
23 | body > .el-container {
24 | margin-bottom: 40px;
25 | }
26 |
27 | .el-container:nth-child(5) .el-aside,
28 | .el-container:nth-child(6) .el-aside {
29 | line-height: 260px;
30 | }
31 |
32 | .el-container:nth-child(7) .el-aside {
33 | line-height: 320px;
34 | }
35 |
36 | .navbar-nav.navbar-center {
37 | position: absolute;
38 | left: 50%;
39 | transform: translatex(-50%);
40 | }
41 |
42 | .footer {
43 | position: absolute;
44 | bottom: 0;
45 | width: 100%;
46 | /* Set the fixed height of the footer here */
47 | height: 60px;
48 | line-height: 60px; /* Vertically center the text there */
49 | background-color: #f5f5f5;
50 | }
51 |
52 | .footer > .container {
53 | padding-right: 15px;
54 | padding-left: 15px;
55 | }
56 |
57 | [v-cloak] { display: none; }
--------------------------------------------------------------------------------
/src/main/resources/static/css/fonts/element-icons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlicanAkkus/docker-compose-initializr/7455a4996fd07b697debd8d38b11d8b59277f078/src/main/resources/static/css/fonts/element-icons.ttf
--------------------------------------------------------------------------------
/src/main/resources/static/css/fonts/element-icons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlicanAkkus/docker-compose-initializr/7455a4996fd07b697debd8d38b11d8b59277f078/src/main/resources/static/css/fonts/element-icons.woff
--------------------------------------------------------------------------------
/src/main/resources/static/images/docker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlicanAkkus/docker-compose-initializr/7455a4996fd07b697debd8d38b11d8b59277f078/src/main/resources/static/images/docker.png
--------------------------------------------------------------------------------
/src/main/resources/static/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
43 |
44 | Docker Compose Initializr
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | Add docker services to your infrastructure
91 |
92 |