-
Notifications
You must be signed in to change notification settings - Fork 0
/
rss.xml
444 lines (436 loc) · 43.1 KB
/
rss.xml
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title></title>
<link>undefined</link>
<description>undefined</description>
<lastBuildDate>Sun, 08 Sep 2024 22:54:51 GMT</lastBuildDate>
<docs>https://validator.w3.org/feed/docs/rss2.html</docs>
<generator>Joplin Pages Publisher</generator>
<item>
<title><![CDATA[SonarCloud]]></title>
<guid>6ce014eb577949b2ba2702f0b88ce343</guid>
<pubDate>Fri, 25 Dec 2020 19:11:13 GMT</pubDate>
<content:encoded><![CDATA[<h1 id="sonarcloud-integration">SonarCloud integration</h1>
<p>This article as a reminder on how to integrate your project into SonarCloud.</p>
<p><a title="https://sonarcloud.io/projects" href="https://sonarcloud.io/projects">https://sonarcloud.io/projects</a></p>
<h2 id="maven">Maven</h2>
<p>In the pom.xml add:</p>
<div><pre class="hljs"><code> <span class="hljs-tag"><<span class="hljs-name">properties</span>></span>
<span class="hljs-tag"><<span class="hljs-name">sonar.projectKey</span>></span>blablanumerodeux_kayak<span class="hljs-tag"></<span class="hljs-name">sonar.projectKey</span>></span>
<span class="hljs-tag"><<span class="hljs-name">sonar.organization</span>></span>blablanumerodeux<span class="hljs-tag"></<span class="hljs-name">sonar.organization</span>></span>
<span class="hljs-tag"><<span class="hljs-name">sonar.host.url</span>></span>https://sonarcloud.io<span class="hljs-tag"></<span class="hljs-name">sonar.host.url</span>></span>
<span class="hljs-comment"><!-- this should not be committed--></span>
<span class="hljs-tag"><<span class="hljs-name">sonar.login</span>></span>d0d909736d1c196a530e6f3f26e62bee1a81cd7f<span class="hljs-tag"></<span class="hljs-name">sonar.login</span>></span>
<span class="hljs-tag"></<span class="hljs-name">properties</span>></span>
</code></pre></div>
<p>Use this maven command only if you're the only dev in the team, otherwise you may override the scan of others:</p>
<div><pre class="hljs"><code>mvnw verify sonar:sonar -DskipTests -f pom.xml</code></pre></div>
<h3 id="nb">NB</h3>
<p>you can also specify these params from the mvn command line that will be launched by jenkins for example -> see below at the end</p>
<h2 id="circleci">CircleCi</h2>
<p>If you're not alone on your project, then set your token within an environment variable called :<br />
<strong>SONAR_TOKEN</strong></p>
<p><a title="https://www.baeldung.com/sonar-qube" href="https://www.baeldung.com/sonar-qube">https://www.baeldung.com/sonar-qube</a></p>
<p><a title="https://docs.sonarqube.org/latest/analysis/gitlab-cicd/" href="https://docs.sonarqube.org/latest/analysis/gitlab-cicd/">https://docs.sonarqube.org/latest/analysis/gitlab-cicd/</a></p>
<p>Also <strong>SONAR_HOST_URL</strong> can also be set as an environment variable.</p>
<p>Finally, here is another example of maven command that you can use within your circleci config file:</p>
<div><pre class="hljs"><code>mvnw <span class="hljs-built_in">source</span>:jar javadoc:jar install -DcreateChecksum=<span class="hljs-literal">true</span> -e sonar:sonar</code></pre></div>
<p>Also, don't forget to include your environment variables (via the context features) with your workflows on your circleci config file like such:</p>
<div><pre class="hljs"><code>
<span class="hljs-attr">workflows:</span>
<span class="hljs-attr">version:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">just-build:</span>
<span class="hljs-attr">jobs:</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">build:</span>
<span class="hljs-attr">context:</span> <span class="hljs-string">SonarCloud</span>
</code></pre></div>
<h2 id="more-doc-on-how-the-sonar-maven-plugin-works">More doc on how the sonar maven plugin works</h2>
<p><a title="https://stackoverflow.com/questions/14979530/why-does-the-maven-command-mvn-sonarsonar-work-without-any-plugin-configurati" href="https://stackoverflow.com/questions/14979530/why-does-the-maven-command-mvn-sonarsonar-work-without-any-plugin-configurati">https://stackoverflow.com/questions/14979530/why-does-the-maven-command-mvn-sonarsonar-work-without-any-plugin-configurati</a></p>
<p><a title="https://blog.sonarsource.com/we-had-a-dream-mvn-sonarsonar/" href="https://blog.sonarsource.com/we-had-a-dream-mvn-sonarsonar/">https://blog.sonarsource.com/we-had-a-dream-mvn-sonarsonar/</a></p>
<h2 id="intellij-idea-plugins">IntelliJ IDEA plugins</h2>
<h3 id="sonarlint">SonarLint</h3>
<p>Go on your SonarCloud profile and generate a new token.<br />
Use it to connect to SonarCloud with SonarLint so that your SonarCloud connection within SonarLint will have access to all your organisations and repo.<br />
So that you won't need to regernate 1 token per repo.</p>
<p>Then "Update binding".<br />
Done.<br />
then Ctrl-Shift-S to analyse a specific file. Also more options are available in the SonalLint Bar (at the bottom) or in the Analyze menu.</p>
<h3 id="sonarqube">SonarQube</h3>
<p>Configure your SonarCloud account on the IntelliJ IDEA params.<br />
Then Analyze menu -> Inspect code (Ctrl-Alt-Shift-I) -> inspection profile Sonar -> ok.</p>
<p>Done</p>
<p>NB: use this plugin only if you're alone on the project.<br />
Otherwise you may override the scan of others</p>
<h2 id="project-badge">Project badge</h2>
<p>Once you sent your project to SonarCloud, on the right bottom corner you can generate your badge and paste it on your README.md file.</p>
<p>example of a badge:</p>
<div><pre class="hljs"><code>[<span class="hljs-string">![Quality Gate Status</span>](<span class="hljs-link">https://sonarcloud.io/api/project_badges/measure?project=dans-la-rue_homeless&metric=alert_status</span>)](<span class="hljs-link">https://sonarcloud.io/dashboard?id=dans-la-rue_homeless</span>)</code></pre></div>
<h2 id="jenkins-with-maven">Jenkins with maven</h2>
<p>Jenkinsfile</p>
<div><pre class="hljs"><code><span class="hljs-comment">// sh 'mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar \</span>
sh <span class="hljs-string">"""./mvnw sonar:sonar \
-Dsonar.host.url=${codeQualityManagementConfig.api_url} \
-Dsonar.projectKey=${sonarProjectName} \
-Dsonar.projectName=${sonarProjectName} \
-Dsonar.login=${bncSonarCredentials.credentials.username} \
-Dsonar.password=${bncSonarCredentials.credentials.password} \
-Dsonar.branch.name=${env.BRANCH_NAME} \
"""</span>
<span class="hljs-comment">// -Dsonar.branch.target=${targetBranch}"""</span>
</code></pre></div>
<h2 id="add-those-for-sonar-to-differenciate-the-tests-from-the-src">add those for sonar to differenciate the tests from the src</h2>
<p>sonar-project.properties</p>
<div><pre class="hljs"><code><span class="hljs-attr">sonar.sources</span>=<span class="hljs-string">./src/main/java</span>
<span class="hljs-attr">sonar.tests</span>=<span class="hljs-string">./src/test/java</span>
</code></pre></div>
<h2 id="or-sonarqube-with-jacoco-for-test-coverage">or sonarqube with jacoco for test coverage</h2>
<div><pre class="hljs"><code>utils.shWithNoTrace <span class="hljs-string">"""./mvnw sonar:sonar \
-Dsonar.host.url=${codeQualityManagementConfig.api_url} \
-Dsonar.projectKey=${sonarProjectName} \
-Dsonar.projectName=${sonarProjectName} \
-Dsonar.login=${bncSonarCredentials.credentials.username} \
-Dsonar.password=${bncSonarCredentials.credentials.password} \
-Dsonar.branch.name=${env.BRANCH_NAME} \
-Dsonar.coverage.jacoco.xmlReportPaths=target/jacoco.exec \
"""</span>
<span class="hljs-comment">// -Dsonar.branch.target=${targetBranch}"""</span>
<span class="hljs-comment">// }</span></code></pre></div>
<p><a title="https://docs.sonarqube.org/pages/viewpage.action?pageId=1442166" href="https://docs.sonarqube.org/pages/viewpage.action?pageId=1442166">https://docs.sonarqube.org/pages/viewpage.action?pageId=1442166</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[gh-pages]]></title>
<guid>672be4ec486c4a599e1f5b5b1d989e8f</guid>
<pubDate>Fri, 25 Dec 2020 19:11:13 GMT</pubDate>
<content:encoded><![CDATA[<h1 id="host-your-angular-app-on-github">Host your angular app on github</h1>
<h2 id="cname-record">CNAME record</h2>
<p>On your domain provider, create a new CNAME record such as:<br />
<code>dakar.project.lambla.eu.-> dakarinternational.github.io.</code></p>
<p>In your src folder create a CNAME file and write your custom domain in it.<br />
then, inside angular.json file add this line:</p>
<div><pre class="hljs"><code><span class="hljs-attr">"assets"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
<span class="hljs-string">"src/favicon.ico"</span><span class="hljs-punctuation">,</span>
<span class="hljs-string">"src/assets"</span><span class="hljs-punctuation">,</span>
<span class="hljs-string">"src/CNAME"</span> <span class="hljs-comment">// This is the change you need to make. </span>
<span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span></code></pre></div>
<p><a title="https://github.com/tschaub/gh-pages/issues/236" href="https://github.com/tschaub/gh-pages/issues/236">https://github.com/tschaub/gh-pages/issues/236</a></p>
<h2 id="angular-build">Angular build</h2>
<div><pre class="hljs"><code>npm run ng build -- --prod --base-href <span class="hljs-string">"https://dakarinternational.github.io/DaKar-ngFront/"</span></code></pre></div>
<p>or more important if you want to use your domain:</p>
<div><pre class="hljs"><code>npm run ng build -- --prod --base-href <span class="hljs-string">"https://dakar.project.lambla.eu/"</span></code></pre></div>
<p>otherwise you may have:</p>
<p><code>Mixed Content: The page at ‘<your_gpages_remote_url>’ was loaded over HTTPS, but requested an insecure stylesheet ‘<url_provided_with_http_prefix_while_deploying>/styles.acb808cb000123f5c6ec.css'. This request has been blocked; the content must be served over HTTPS.</code></p>
<h2 id="angular-cli-deploy">Angular CLI deploy</h2>
<div><pre class="hljs"><code>npx ngh --dir=dist/DaKar-ngFront
or
npx angular-cli-ghpages --dir=dist/homeless-front</code></pre></div>
<p><a title="https://medium.com/tech-insights/how-to-deploy-angular-apps-to-github-pages-gh-pages-896c4e10f9b4" href="https://medium.com/tech-insights/how-to-deploy-angular-apps-to-github-pages-gh-pages-896c4e10f9b4">https://medium.com/tech-insights/how-to-deploy-angular-apps-to-github-pages-gh-pages-896c4e10f9b4</a></p>
<h2 id="github-pages-config">Github pages config</h2>
<p><a title="https://github.com/DaKarInternational/DaKar-ngFront/settings" href="https://github.com/DaKarInternational/DaKar-ngFront/settings">https://github.com/DaKarInternational/DaKar-ngFront/settings</a></p>
<p>in Settings -> Options -> Github Pages :<br />
put your custom domain such as : <em>dakar.project.lambla.eu</em><br />
enforce https.<br />
done</p>
<h2 id="github-actions-setup">Github Actions setup</h2>
<div><pre class="hljs"><code><span class="hljs-bullet">1.</span> First login to [<span class="hljs-string">https://github.com</span>](<span class="hljs-link">https://github.com</span>)
<span class="hljs-bullet">2.</span> Go to [<span class="hljs-string">https://github.com/setting/profile</span>](<span class="hljs-link">https://github.com/setting/profile</span>)
<span class="hljs-bullet">3.</span> Now click on to the <span class="hljs-code">`Developer settings`</span>
<span class="hljs-bullet">4.</span> Click on <span class="hljs-code">`Personal access tokens`</span> and generate a token
<span class="hljs-bullet">5.</span> 1. Go to your repository <span class="hljs-code">`Settings`</span>
<span class="hljs-bullet">6.</span> Click on <span class="hljs-code">`Secrets`</span>
<span class="hljs-bullet">7.</span> Click on <span class="hljs-code">`Add new secret`</span>
<span class="hljs-bullet">8.</span> Put <span class="hljs-code">`ACCESS_TOKEN`</span> for name and <span class="hljs-code">`your github token that you had copy`</span> as value. Now click on <span class="hljs-code">`Add secret`</span> button. A secret with name <span class="hljs-code">`ACCESS_TOKEN`</span> is saved in your repository.
<span class="hljs-bullet">9.</span> in your repository's <span class="hljs-code">`Action`</span> tab, set up workflow using these code
main.yaml</code></pre></div>
<div><pre class="hljs"><code><span class="hljs-attr">name:</span> <span class="hljs-string">CI</span>
<span class="hljs-attr">on:</span> [<span class="hljs-string">push</span>]
<span class="hljs-attr">jobs:</span>
<span class="hljs-attr">build:</span>
<span class="hljs-attr">runs-on:</span> <span class="hljs-string">ubuntu-18.04</span>
<span class="hljs-attr">steps:</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">uses:</span> <span class="hljs-string">actions/checkout@v1</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Use</span> <span class="hljs-string">Node.js</span> <span class="hljs-number">8.15</span><span class="hljs-number">.1</span>
<span class="hljs-attr">uses:</span> <span class="hljs-string">actions/setup-node@v1</span>
<span class="hljs-attr">with:</span>
<span class="hljs-attr">node-version:</span> <span class="hljs-number">8.15</span><span class="hljs-number">.1</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Build</span> <span class="hljs-string">and</span> <span class="hljs-string">Deploy</span>
<span class="hljs-attr">uses:</span> <span class="hljs-string">JamesIves/github-pages-deploy-action@releases/v2</span>
<span class="hljs-attr">env:</span>
<span class="hljs-attr">ACCESS_TOKEN:</span> <span class="hljs-string">${{</span> <span class="hljs-string">secrets.ACCESS_TOKEN</span> <span class="hljs-string">}}</span>
<span class="hljs-attr">BASE_BRANCH:</span> <span class="hljs-string">develop</span>
<span class="hljs-attr">BRANCH:</span> <span class="hljs-string">gh-pages</span>
<span class="hljs-attr">FOLDER:</span> <span class="hljs-string">dist/homeless-front</span>
<span class="hljs-attr">BUILD_SCRIPT:</span> <span class="hljs-string">npm</span> <span class="hljs-string">install</span> <span class="hljs-string">&&</span> <span class="hljs-string">npm</span> <span class="hljs-string">run</span> <span class="hljs-string">ng</span> <span class="hljs-string">build</span> <span class="hljs-string">--</span> <span class="hljs-string">--prod</span> <span class="hljs-string">--base-href</span> <span class="hljs-string">"https://homeless.project.lambla.eu/"</span></code></pre></div>
<p><a title="https://uxworks.org/how-to-deploy-angular-app-on-github-pages-using-github-actions" href="https://uxworks.org/how-to-deploy-angular-app-on-github-pages-using-github-actions">https://uxworks.org/how-to-deploy-angular-app-on-github-pages-using-github-actions</a></p>
<h2 id="sources">Sources</h2>
<p><a title="https://angular.io/guide/deployment" href="https://angular.io/guide/deployment">https://angular.io/guide/deployment</a></p>
<p><a title="https://dev.to/apdharshi/deploying-your-angular-application-to-github-pages-4laf" href="https://dev.to/apdharshi/deploying-your-angular-application-to-github-pages-4laf">https://dev.to/apdharshi/deploying-your-angular-application-to-github-pages-4laf</a></p>
<p><a title="https://help.github.com/en/github/working-with-github-pages/securing-your-github-pages-site-with-https" href="https://help.github.com/en/github/working-with-github-pages/securing-your-github-pages-site-with-https">https://help.github.com/en/github/working-with-github-pages/securing-your-github-pages-site-with-https</a></p>
<p>Other things to explore:</p>
<p><a title="https://www.codementor.io/@landonpatmore/how-to-setup-a-static-website-using-github-pages-and-cloudflare-with-your-own-domain-name-jb99nbuoe" href="https://www.codementor.io/@landonpatmore/how-to-setup-a-static-website-using-github-pages-and-cloudflare-with-your-own-domain-name-jb99nbuoe">https://www.codementor.io/@landonpatmore/how-to-setup-a-static-website-using-github-pages-and-cloudflare-with-your-own-domain-name-jb99nbuoe</a></p>
<p><a title="https://hackernoon.com/set-up-ssl-on-github-pages-with-custom-domains-for-free-a576bdf51bc" href="https://hackernoon.com/set-up-ssl-on-github-pages-with-custom-domains-for-free-a576bdf51bc">https://hackernoon.com/set-up-ssl-on-github-pages-with-custom-domains-for-free-a576bdf51bc</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[JFrog Bintray]]></title>
<guid>2741b8d51fba4d618750d2be995856f0</guid>
<pubDate>Fri, 25 Dec 2020 19:11:13 GMT</pubDate>
<content:encoded><![CDATA[<hr />
<h2 id="title-maven-deploy-to-oss-jfrog-to-maven-centraldate-2019-11-10t205332-0400draft-false">title: "Maven deploy to OSS JFrog to Maven Central"<br />
date: 2019-11-10T20:53:32-04:00<br />
draft: false</h2>
<h1 id="maven-deploy-to-oss-jfrog-to-maven-central">Maven deploy to OSS JFrog to Maven Central</h1>
<h2 id="jfrog-bintray">JFrog BinTray</h2>
<p>Begin by creating an organisation and a package on <a title="https://bintray.com/dakarinternational" href="https://bintray.com/dakarinternational">JFrog BinTray</a>.<br />
Edit your package and request that your package be <a title="https://www.jfrog.com/confluence/display/RTF/Deploying+Snapshots+to+oss.jfrog.org" href="https://www.jfrog.com/confluence/display/RTF/Deploying+Snapshots+to+oss.jfrog.org">added to JCenter</a><br />
Don't forgot to tick the option : <em>Host my snapshot build artifacts on the OSS Artifactory</em><br />
Wait for your request to be granted.</p>
<p>Then, Edit your profile and find your API key.</p>
<h2 id="oss-jfrog">OSS JFrog</h2>
<p>Use that key as your password to connect in <a title="https://oss.jfrog.org/artifactory/webapp/#/home" href="https://oss.jfrog.org/artifactory/webapp/#/home">OSS-JFrog</a>.<br />
Use your BinTray profile name as your username to connect in OSS-JFrog.</p>
<h2 id="maven">Maven</h2>
<p>Then in your pom.xml add this directly under <code><project></code>:</p>
<div><pre class="hljs"><code> <span class="hljs-comment"><!--this to push directly a release into bintray, does not work for snapshot though--></span>
<span class="hljs-comment"><!-- <distributionManagement>
<repository>
<id>bintray-blablanumerodeux-dakar</id>
<name>blablanumerodeux-dakar</name>
<url>https://api.bintray.com/maven/dakarinternational/dakar/dakar/;publish=1</url>
</repository>
</distributionManagement>--></span>
<span class="hljs-comment"><!--this to push to OSS --></span>
<span class="hljs-tag"><<span class="hljs-name">distributionManagement</span>></span>
<span class="hljs-tag"><<span class="hljs-name">repository</span>></span>
<span class="hljs-tag"><<span class="hljs-name">id</span>></span>central<span class="hljs-tag"></<span class="hljs-name">id</span>></span>
<span class="hljs-tag"><<span class="hljs-name">name</span>></span>oss-jfrog-artifactory-releases<span class="hljs-tag"></<span class="hljs-name">name</span>></span>
<span class="hljs-tag"><<span class="hljs-name">url</span>></span>https://oss.jfrog.org/artifactory/oss-release-local<span class="hljs-tag"></<span class="hljs-name">url</span>></span>
<span class="hljs-tag"></<span class="hljs-name">repository</span>></span>
<span class="hljs-tag"><<span class="hljs-name">snapshotRepository</span>></span>
<span class="hljs-tag"><<span class="hljs-name">id</span>></span>snapshots<span class="hljs-tag"></<span class="hljs-name">id</span>></span>
<span class="hljs-tag"><<span class="hljs-name">name</span>></span>oss-jfrog-artifactory-snapshots<span class="hljs-tag"></<span class="hljs-name">name</span>></span>
<span class="hljs-tag"><<span class="hljs-name">url</span>></span>https://oss.jfrog.org/artifactory/oss-snapshot-local<span class="hljs-tag"></<span class="hljs-name">url</span>></span>
<span class="hljs-tag"></<span class="hljs-name">snapshotRepository</span>></span>
<span class="hljs-tag"></<span class="hljs-name">distributionManagement</span>></span></code></pre></div>
<p>please note the <code><id>central</id></code> and <code><id>snapshots</id></code>, we'll use these below.</p>
<p>also be sure to configure correctly this part :</p>
<div><pre class="hljs"><code> <span class="hljs-tag"><<span class="hljs-name">groupId</span>></span>dans-la-rue<span class="hljs-tag"></<span class="hljs-name">groupId</span>></span>
<span class="hljs-tag"><<span class="hljs-name">artifactId</span>></span>homeless<span class="hljs-tag"></<span class="hljs-name">artifactId</span>></span>
<span class="hljs-tag"><<span class="hljs-name">version</span>></span>0.0.1-SNAPSHOT<span class="hljs-tag"></<span class="hljs-name">version</span>></span>
<span class="hljs-tag"><<span class="hljs-name">packaging</span>></span>jar<span class="hljs-tag"></<span class="hljs-name">packaging</span>></span></code></pre></div>
<p>Now that your project is configured, go in your settings.xml file which should be somewhere here: <code>~/.m2/settings.xml</code><br />
And make sure to <strong>add</strong> the servers config like that:</p>
<div><pre class="hljs"><code><span class="hljs-meta"><?xml version='1.0' encoding='UTF-8'?></span>
<span class="hljs-tag"><<span class="hljs-name">settings</span> <span class="hljs-attr">xsi:schemaLocation</span>=<span class="hljs-string">'http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'</span>
<span class="hljs-attr">xmlns</span>=<span class="hljs-string">'http://maven.apache.org/SETTINGS/1.0.0'</span> <span class="hljs-attr">xmlns:xsi</span>=<span class="hljs-string">'http://www.w3.org/2001/XMLSchema-instance'</span>></span>
<span class="hljs-tag"><<span class="hljs-name">servers</span>></span>
<span class="hljs-tag"><<span class="hljs-name">server</span>></span>
<span class="hljs-tag"><<span class="hljs-name">id</span>></span>bintray-blablanumerodeux-dakar<span class="hljs-tag"></<span class="hljs-name">id</span>></span>
<span class="hljs-tag"><<span class="hljs-name">username</span>></span>blablanumerodeux<span class="hljs-tag"></<span class="hljs-name">username</span>></span>
<span class="hljs-tag"><<span class="hljs-name">password</span>></span>${env.BINTRAY_API_KEY}<span class="hljs-tag"></<span class="hljs-name">password</span>></span>
<span class="hljs-tag"></<span class="hljs-name">server</span>></span>
<span class="hljs-tag"><<span class="hljs-name">server</span>></span>
<span class="hljs-tag"><<span class="hljs-name">id</span>></span>central<span class="hljs-tag"></<span class="hljs-name">id</span>></span>
<span class="hljs-tag"><<span class="hljs-name">username</span>></span>blablanumerodeux<span class="hljs-tag"></<span class="hljs-name">username</span>></span>
<span class="hljs-tag"><<span class="hljs-name">password</span>></span>${env.JFROG_API_KEY}<span class="hljs-tag"></<span class="hljs-name">password</span>></span>
<span class="hljs-tag"></<span class="hljs-name">server</span>></span>
<span class="hljs-tag"><<span class="hljs-name">server</span>></span>
<span class="hljs-tag"><<span class="hljs-name">id</span>></span>snapshots<span class="hljs-tag"></<span class="hljs-name">id</span>></span>
<span class="hljs-tag"><<span class="hljs-name">username</span>></span>blablanumerodeux<span class="hljs-tag"></<span class="hljs-name">username</span>></span>
<span class="hljs-tag"><<span class="hljs-name">password</span>></span>${env.JFROG_API_KEY}<span class="hljs-tag"></<span class="hljs-name">password</span>></span>
<span class="hljs-tag"></<span class="hljs-name">server</span>></span>
<span class="hljs-tag"></<span class="hljs-name">servers</span>></span>
<span class="hljs-tag"></<span class="hljs-name">settings</span>></span></code></pre></div>
<p>Note again the <code><id>central</id></code> and <code><id>snapshots</id></code> that match the one above.</p>
<p>Then you can deploy your SNAPSHOT or RELEASE with maven: <code>mvn clean source:jar javadoc:jar deploy -DskipTests -DcreateChecksum=true</code></p>
<p>If you want to publish your package into the Maven Central repo, then you need to make sure that your java source files are inside your JAR file.<br />
To do that you can configure your maven build with the <code><resources></code> tag like that:</p>
<div><pre class="hljs"><code> <span class="hljs-tag"><<span class="hljs-name">build</span>></span>
<span class="hljs-tag"><<span class="hljs-name">resources</span>></span>
<span class="hljs-tag"><<span class="hljs-name">resource</span>></span>
<span class="hljs-tag"><<span class="hljs-name">directory</span>></span>src/main/resources<span class="hljs-tag"></<span class="hljs-name">directory</span>></span>
<span class="hljs-tag"></<span class="hljs-name">resource</span>></span>
<span class="hljs-tag"><<span class="hljs-name">resource</span>></span>
<span class="hljs-tag"><<span class="hljs-name">directory</span>></span>src/main/java<span class="hljs-tag"></<span class="hljs-name">directory</span>></span>
<span class="hljs-tag"><<span class="hljs-name">includes</span>></span>
<span class="hljs-tag"><<span class="hljs-name">include</span>></span>**/*.java<span class="hljs-tag"></<span class="hljs-name">include</span>></span>
<span class="hljs-tag"></<span class="hljs-name">includes</span>></span>
<span class="hljs-tag"></<span class="hljs-name">resource</span>></span>
<span class="hljs-tag"></<span class="hljs-name">resources</span>></span>
<span class="hljs-tag"><<span class="hljs-name">plugins</span>></span>
<span class="hljs-tag"><<span class="hljs-name">plugin</span>></span>
<span class="hljs-tag"><<span class="hljs-name">groupId</span>></span>org.apache.maven.plugins<span class="hljs-tag"></<span class="hljs-name">groupId</span>></span>
<span class="hljs-tag"><<span class="hljs-name">artifactId</span>></span>maven-javadoc-plugin<span class="hljs-tag"></<span class="hljs-name">artifactId</span>></span>
<span class="hljs-tag"><<span class="hljs-name">version</span>></span>3.0.1<span class="hljs-tag"></<span class="hljs-name">version</span>></span>
<span class="hljs-tag"><<span class="hljs-name">configuration</span>></span>
<span class="hljs-tag"></<span class="hljs-name">configuration</span>></span>
<span class="hljs-tag"></<span class="hljs-name">plugin</span>></span>
<span class="hljs-tag"><<span class="hljs-name">plugin</span>></span>
<span class="hljs-tag"><<span class="hljs-name">groupId</span>></span>org.apache.maven.plugins<span class="hljs-tag"></<span class="hljs-name">groupId</span>></span>
<span class="hljs-tag"><<span class="hljs-name">artifactId</span>></span>maven-jar-plugin<span class="hljs-tag"></<span class="hljs-name">artifactId</span>></span>
<span class="hljs-tag"><<span class="hljs-name">version</span>></span>2.3.2<span class="hljs-tag"></<span class="hljs-name">version</span>></span>
<span class="hljs-tag"></<span class="hljs-name">plugin</span>></span>
<span class="hljs-tag"><<span class="hljs-name">plugin</span>></span>
<span class="hljs-tag"><<span class="hljs-name">groupId</span>></span>org.apache.maven.plugins<span class="hljs-tag"></<span class="hljs-name">groupId</span>></span>
<span class="hljs-tag"><<span class="hljs-name">artifactId</span>></span>maven-source-plugin<span class="hljs-tag"></<span class="hljs-name">artifactId</span>></span>
<span class="hljs-tag"><<span class="hljs-name">version</span>></span>2.1.2<span class="hljs-tag"></<span class="hljs-name">version</span>></span>
<span class="hljs-tag"></<span class="hljs-name">plugin</span>></span>
<span class="hljs-tag"></<span class="hljs-name">plugins</span>></span>
<span class="hljs-tag"></<span class="hljs-name">build</span>></span>
</code></pre></div>
<h2 id="glossary">Glossary</h2>
<ul>
<li>OJO: Oss.Jfrog.Org</li>
<li>OSS: Open Source Solutions from JFrog</li>
<li>BinTray: Website used to manage users, organisations, repos,packages,versions,and promot versions to JCenter and Maven Central</li>
<li>JCenter: One of the public repo where you can host freely your open source software</li>
<li>Maven Central: The most famous public repo to host freely your open source software</li>
<li>Artifactory: One of the 3 main repository management tool (Sonartype Nexus, JFrog Artifactory, and NPM)</li>
<li></li>
</ul>
]]></content:encoded>
</item>
<item>
<title><![CDATA[deploy]]></title>
<guid>3762b108b599481280ce8c10729656fe</guid>
<pubDate>Fri, 25 Dec 2020 19:11:13 GMT</pubDate>
<content:encoded><![CDATA[<hr />
<h2 id="title-hugodate-2019-10-17t205332-0400draft-false">title: "HUGO"<br />
date: 2019-10-17T20:53:32-04:00<br />
draft: false</h2>
<h2 id="hugo">HUGO</h2>
<h3 id="create-a-new-site">create a new site</h3>
<p><code>hugo new site me</code></p>
<h3 id="install-theme">install theme</h3>
<p>go here <a title="https://themes.gohugo.io/minimal/" href="https://themes.gohugo.io/minimal/">minimal</a> and follow the instructions:</p>
<div><pre class="hljs"><code>git submodule add https:<span class="hljs-regexp">//gi</span>thub.com<span class="hljs-regexp">/calintat/mi</span>nimal.git themes/minimal
git submodule init
git submodule update
git submodule update --remote themes/minimal
cp themes<span class="hljs-regexp">/minimal/</span>exampleSite/config.toml </code></pre></div>
<p>in the file config.toml set all your params, and:</p>
<div><pre class="hljs"><code>baseurl = <span class="hljs-string">"http://examplesite"</span> <- Change to https:<span class="hljs-regexp">//y</span>ourgithubusername.github.io</code></pre></div>
<h3 id="push-on-your-github">push on your github</h3>
<p>On branch <em>master</em> you have the public folder (built version)<br />
And on the <em>hugo</em> branch you put the hugo project</p>
<p>Checkout the hugo branch</p>
<p><code>hugo serve</code> -> to test localy<br />
<code>hugo -d ../blablanumerodeux.github.io/</code> -> to build the static version in the folder blablanumerodeux.github.io</p>
<p>blablanumerodeux.github.io folder is used to push the public folder (wich contains the static version of the website) without the hugo files (we could have make 2 different repos and a submodule)</p>
<p><code>git push origin master -u</code><br />
<code>git push origin hugo -u</code></p>
<h3 id="some-good-themes">some good themes:</h3>
<p><a title="https://themes.gohugo.io/hugo-coder/" href="https://themes.gohugo.io/hugo-coder/">https://themes.gohugo.io/hugo-coder/</a><br />
<a title="https://themes.gohugo.io/minimal/" href="https://themes.gohugo.io/minimal/">https://themes.gohugo.io/minimal/</a></p>
<h3 id="sources">sources:</h3>
<p><a title="https://dev.to/michalbryxi/simplify-pushing-to-git-32g6" href="https://dev.to/michalbryxi/simplify-pushing-to-git-32g6">https://dev.to/michalbryxi/simplify-pushing-to-git-32g6</a><br />
<a title="https://dev.to/dgavlock/creating-a-hugo-site-on-github-pages-3cjo" href="https://dev.to/dgavlock/creating-a-hugo-site-on-github-pages-3cjo">https://dev.to/dgavlock/creating-a-hugo-site-on-github-pages-3cjo</a><br />
<a title="https://themes.gohugo.io/minimal/" href="https://themes.gohugo.io/minimal/">https://themes.gohugo.io/minimal/</a><br />
<a title="https://github.com/calintat/minimal/" href="https://github.com/calintat/minimal/">https://github.com/calintat/minimal/</a><br />
<a title="https://gohugo.io/hosting-and-deployment/hosting-on-github/" href="https://gohugo.io/hosting-and-deployment/hosting-on-github/">https://gohugo.io/hosting-and-deployment/hosting-on-github/</a><br />
<a title="https://gohugo.io/hosting-and-deployment/hosting-on-github/#use-a-custom-domain" href="https://gohugo.io/hosting-and-deployment/hosting-on-github/#use-a-custom-domain">https://gohugo.io/hosting-and-deployment/hosting-on-github/#use-a-custom-domain</a><br />
<a title="https://themes.gohugo.io//theme/minimal/post/" href="https://themes.gohugo.io//theme/minimal/post/">https://themes.gohugo.io//theme/minimal/post/</a></p>
<p><a title="https://support.circleci.com/hc/en-us/articles/360018860473-How-to-push-a-commit-back-to-the-same-repository-as-part-of-the-CircleCI-job" href="https://support.circleci.com/hc/en-us/articles/360018860473-How-to-push-a-commit-back-to-the-same-repository-as-part-of-the-CircleCI-job">circleci git</a></p>
<p><a title="https://circleci.com/docs/2.0/gh-bb-integration/#creating-a-github-deploy-key" href="https://circleci.com/docs/2.0/gh-bb-integration/#creating-a-github-deploy-key">circleci ssh key</a></p>
<p><a title="https://hub.docker.com/r/jguyomard/hugo-builder/" href="https://hub.docker.com/r/jguyomard/hugo-builder/">hugo docker image</a></p>
<h3 id="inspiration">inspiration</h3>
<p><a title="https://tomlicha.github.io/" href="https://tomlicha.github.io/">https://tomlicha.github.io/</a><br />
<a title="https://github.com/tomlicha/tomlicha.github.io" href="https://github.com/tomlicha/tomlicha.github.io">https://github.com/tomlicha/tomlicha.github.io</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[properties files and secrets managers]]></title>
<guid>9f2c5bcec3144c96a5fc588fe2bc8021</guid>
<pubDate>Fri, 25 Dec 2020 19:11:13 GMT</pubDate>
<content:encoded><![CDATA[<hr />
<h2 id="title-secrets-and-properties-managementdate-2019-10-17t205332-0400draft-false">title: "Secrets and properties management"<br />
date: 2019-10-17T20:53:32-04:00<br />
draft: false</h2>
<h1 id="secrets-and-properties-management">Secrets and properties management</h1>
<h2 id="properties-files-with-spring-boot">Properties files with Spring boot</h2>
<p>Specify different profiles (for the different DB for example) like this in the default application.properties file:</p>
<div><pre class="hljs"><code><span class="hljs-attr">spring.profiles.active</span>=local</code></pre></div>
<p>or at runtime like that:</p>
<div><pre class="hljs"><code>java -Dspring.profiles.active=<span class="hljs-built_in">local</span> -jar yourApplication.jar </code></pre></div>
<p><em><strong>please note the -D params are set BEFORE the -jar</strong></em></p>
<p>It will automatically take the corresponding properties file in the classpath application-<strong>local</strong>.propertie</p>
<h2 id="secrets-with-spring-boot">Secrets with Spring boot</h2>
<p>When you have to specify a secret, just define a placeholder instead:</p>
<div><pre class="hljs"><code><span class="hljs-attr">spring.datasource.password</span>=<span class="hljs-variable">${db-password}</span></code></pre></div>
<p>and pass the value at runtime with a Java -D variable:</p>
<div><pre class="hljs"><code><span class="hljs-attr">-Ddb-password</span>=example</code></pre></div>
<p>Or you can also externalize your config folder or just a properties file:<br />
<a title="https://www.baeldung.com/spring-properties-file-outside-jar" href="https://www.baeldung.com/spring-properties-file-outside-jar">Spring Properties File Outside jar</a><br />
and also pass the locations at runtime with an environment variable or just a java -D variable.</p>
<h2 id="environment-and-java-variables">Environment and Java variables</h2>
<p>Problem is how to pass the environment variables or the java -D variables when your jar is embeded inside a docker image ?</p>
<h3 id="dockerfile">Dockerfile</h3>
<div><pre class="hljs"><code><span class="hljs-comment">#https://docs.docker.com/engine/reference/builder/#using-arg-variables </span>
<span class="hljs-keyword">FROM</span> openjdk:<span class="hljs-number">8</span>-jdk-alpine
<span class="hljs-keyword">ARG</span> JAR_FILE
<span class="hljs-keyword">ADD</span><span class="language-bash"> <span class="hljs-variable">${JAR_FILE}</span> app.jar </span>
<span class="hljs-keyword">ENTRYPOINT</span><span class="language-bash"> [<span class="hljs-string">"java"</span>, <span class="hljs-string">"-jar"</span>, <span class="hljs-string">"-Dspring.profiles.active=<span class="hljs-variable">${PROFILE}</span>"</span>, <span class="hljs-string">"/app.jar"</span>]</span></code></pre></div>
<p><code>${PROFILE}</code> is referencing an environment variable that will be resolved at the runtime only, not during the build time.</p>
<p><code>${JAR_FILE}</code> is referencing an argument passed within the docker build command (launched from <strong>docker-compose</strong> or <strong>maven</strong>). This variable is not used anymore after the build is done.</p>
<p><a title="https://vsupalov.com/docker-arg-env-variable-guide/#the-dot-env-file-env" href="https://vsupalov.com/docker-arg-env-variable-guide/#the-dot-env-file-env">more info on the env variables here</a></p>
<h3 id="docker-compose">Docker-compose</h3>
<div><pre class="hljs"><code><span class="hljs-attribute">app</span><span class="hljs-punctuation">: </span>
<span class="hljs-attribute">image</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"dakarinternational/dakar:latest" </span>
<span class="hljs-attribute">env_file</span><span class="hljs-punctuation">:</span> <span class="hljs-string">.env </span>
<span class="hljs-attribute">build</span><span class="hljs-punctuation">: </span>
<span class="hljs-attribute">dockerfile</span><span class="hljs-punctuation">:</span> <span class="hljs-string">Dockerfile </span>
<span class="hljs-attribute">context</span><span class="hljs-punctuation">:</span> <span class="hljs-string">. </span>
<span class="hljs-attribute">args</span><span class="hljs-punctuation">: </span>
<span class="hljs-attribute">JAR_FILE</span><span class="hljs-punctuation">:</span> <span class="hljs-string">$JAR_FILE </span>
<span class="hljs-attribute">ports</span><span class="hljs-punctuation">: </span>
<span class="hljs-bullet">-</span> <span class="hljs-string">"8080:8080" </span>
<span class="hljs-attribute">container_name</span><span class="hljs-punctuation">:</span> <span class="hljs-string">'app-dakar' </span>
<span class="hljs-attribute">depends_on</span><span class="hljs-punctuation">: </span>
<span class="hljs-bullet">-</span> <span class="hljs-string">"couch"</span></code></pre></div>
<p>Here is the .env file:</p>
<div><pre class="hljs"><code>PROFILE=prod
JAR_FILE=target/dakar-<span class="hljs-number">0.0</span>.<span class="hljs-number">3</span>.jar</code></pre></div>
<p>NB: <em>Please note that the JAR_FILE could (and should) be put directly in the args section.<br />
No need for such an environment variable just for the build time, it's here just to demonstrate how we can use env variables within the docker-compose file.</em></p>
<p>Another way to do the same thing is like this:</p>
<div><pre class="hljs"><code> app:
image: <span class="hljs-string">"danslarue/homeless:latest"</span>
build: .
ports:
- <span class="hljs-string">"9090:8080"</span>
container_name: <span class="hljs-string">'app-homeless'</span>
environment:
- db-password=example</code></pre></div>
<p>Note the <em>environment</em> part</p>
<h2 id="maven">Maven</h2>
<p>Here is the config for the docker plugin:</p>
<div><pre class="hljs"><code> <span class="hljs-tag"><<span class="hljs-name">plugin</span>></span>
<span class="hljs-tag"><<span class="hljs-name">groupId</span>></span>com.spotify<span class="hljs-tag"></<span class="hljs-name">groupId</span>></span>
<span class="hljs-tag"><<span class="hljs-name">artifactId</span>></span>dockerfile-maven-plugin<span class="hljs-tag"></<span class="hljs-name">artifactId</span>></span>
<span class="hljs-tag"><<span class="hljs-name">version</span>></span>1.4.10<span class="hljs-tag"></<span class="hljs-name">version</span>></span>
<span class="hljs-tag"><<span class="hljs-name">configuration</span>></span>
<span class="hljs-comment"><!--<serverId>docker-hub</serverId>--></span>
<span class="hljs-tag"><<span class="hljs-name">useMavenSettingsForAuth</span>></span>true<span class="hljs-tag"></<span class="hljs-name">useMavenSettingsForAuth</span>></span>
<span class="hljs-comment"><!--<registryUrl>https://index.docker.io/v1/</registryUrl>--></span>
<span class="hljs-tag"><<span class="hljs-name">repository</span>></span>dakarinternational/dakar<span class="hljs-tag"></<span class="hljs-name">repository</span>></span>
<span class="hljs-tag"><<span class="hljs-name">buildArgs</span>></span>
<span class="hljs-tag"><<span class="hljs-name">JAR_FILE</span>></span>target/${project.build.finalName}.jar<span class="hljs-tag"></<span class="hljs-name">JAR_FILE</span>></span>
<span class="hljs-tag"></<span class="hljs-name">buildArgs</span>></span>
<span class="hljs-tag"></<span class="hljs-name">configuration</span>></span>
<span class="hljs-tag"></<span class="hljs-name">plugin</span>></span>
</code></pre></div>
<p>Notice the <code><JAR_FILE></code> build argument.</p>
<h2 id="circleci">CircleCI</h2>
<p>If you don't want to use Docker-compose environment variables, then you can also pass directly <em>circleci secret environment variable</em> like this:</p>
<div><pre class="hljs"><code>- run:
name: java <span class="hljs-built_in">command</span>
<span class="hljs-built_in">command</span>: |
java -Ddb-password=<span class="hljs-variable">$DB_PWD</span> -jar blabla.jar </code></pre></div>
<p>Notice the <code>$DB_PWD</code> circleci secret environment variable</p>
<h2 id="vault-by-hashicorp">Vault by HashiCorp</h2>
<p>Another solution to avoid all these variables transmissions is to use Vault.</p>
]]></content:encoded>
</item>
</channel>
</rss>