<?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">&lt;<span class="hljs-name">properties</span>&gt;</span>         
        <span class="hljs-tag">&lt;<span class="hljs-name">sonar.projectKey</span>&gt;</span>blablanumerodeux_kayak<span class="hljs-tag">&lt;/<span class="hljs-name">sonar.projectKey</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">sonar.organization</span>&gt;</span>blablanumerodeux<span class="hljs-tag">&lt;/<span class="hljs-name">sonar.organization</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">sonar.host.url</span>&gt;</span>https://sonarcloud.io<span class="hljs-tag">&lt;/<span class="hljs-name">sonar.host.url</span>&gt;</span>
<span class="hljs-comment">&lt;!--        this should not be committed--&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">sonar.login</span>&gt;</span>d0d909736d1c196a530e6f3f26e62bee1a81cd7f<span class="hljs-tag">&lt;/<span class="hljs-name">sonar.login</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">properties</span>&gt;</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 -&gt; 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 -&gt; Inspect code (Ctrl-Alt-Shift-I) -&gt; inspection profile Sonar -&gt; 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&amp;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.-&gt; 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 ‘&lt;your_gpages_remote_url&gt;’ was loaded over HTTPS, but requested an insecure stylesheet ‘&lt;url_provided_with_http_prefix_while_deploying&gt;/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 -&gt; Options -&gt; 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">&amp;&amp;</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>&lt;project&gt;</code>:</p>
<div><pre class="hljs"><code>    <span class="hljs-comment">&lt;!--this to push directly a release into bintray, does not work for snapshot though--&gt;</span>
<span class="hljs-comment">&lt;!--	&lt;distributionManagement&gt;
        &lt;repository&gt;
            &lt;id&gt;bintray-blablanumerodeux-dakar&lt;/id&gt;
            &lt;name&gt;blablanumerodeux-dakar&lt;/name&gt;
            &lt;url&gt;https://api.bintray.com/maven/dakarinternational/dakar/dakar/;publish=1&lt;/url&gt;
        &lt;/repository&gt;
    &lt;/distributionManagement&gt;--&gt;</span>

    <span class="hljs-comment">&lt;!--this to push to OSS --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">distributionManagement</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">repository</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">id</span>&gt;</span>central<span class="hljs-tag">&lt;/<span class="hljs-name">id</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>oss-jfrog-artifactory-releases<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">url</span>&gt;</span>https://oss.jfrog.org/artifactory/oss-release-local<span class="hljs-tag">&lt;/<span class="hljs-name">url</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">repository</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">snapshotRepository</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">id</span>&gt;</span>snapshots<span class="hljs-tag">&lt;/<span class="hljs-name">id</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>oss-jfrog-artifactory-snapshots<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">url</span>&gt;</span>https://oss.jfrog.org/artifactory/oss-snapshot-local<span class="hljs-tag">&lt;/<span class="hljs-name">url</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">snapshotRepository</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">distributionManagement</span>&gt;</span></code></pre></div>
<p>please note the <code>&lt;id&gt;central&lt;/id&gt;</code> and <code>&lt;id&gt;snapshots&lt;/id&gt;</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">&lt;<span class="hljs-name">groupId</span>&gt;</span>dans-la-rue<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>homeless<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>0.0.1-SNAPSHOT<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">packaging</span>&gt;</span>jar<span class="hljs-tag">&lt;/<span class="hljs-name">packaging</span>&gt;</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">&lt;?xml version='1.0' encoding='UTF-8'?&gt;</span>
<span class="hljs-tag">&lt;<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>&gt;</span>
   <span class="hljs-tag">&lt;<span class="hljs-name">servers</span>&gt;</span>
       <span class="hljs-tag">&lt;<span class="hljs-name">server</span>&gt;</span>
           <span class="hljs-tag">&lt;<span class="hljs-name">id</span>&gt;</span>bintray-blablanumerodeux-dakar<span class="hljs-tag">&lt;/<span class="hljs-name">id</span>&gt;</span>
           <span class="hljs-tag">&lt;<span class="hljs-name">username</span>&gt;</span>blablanumerodeux<span class="hljs-tag">&lt;/<span class="hljs-name">username</span>&gt;</span>
           <span class="hljs-tag">&lt;<span class="hljs-name">password</span>&gt;</span>${env.BINTRAY_API_KEY}<span class="hljs-tag">&lt;/<span class="hljs-name">password</span>&gt;</span>
       <span class="hljs-tag">&lt;/<span class="hljs-name">server</span>&gt;</span>
       <span class="hljs-tag">&lt;<span class="hljs-name">server</span>&gt;</span>
           <span class="hljs-tag">&lt;<span class="hljs-name">id</span>&gt;</span>central<span class="hljs-tag">&lt;/<span class="hljs-name">id</span>&gt;</span>
           <span class="hljs-tag">&lt;<span class="hljs-name">username</span>&gt;</span>blablanumerodeux<span class="hljs-tag">&lt;/<span class="hljs-name">username</span>&gt;</span>
           <span class="hljs-tag">&lt;<span class="hljs-name">password</span>&gt;</span>${env.JFROG_API_KEY}<span class="hljs-tag">&lt;/<span class="hljs-name">password</span>&gt;</span>
       <span class="hljs-tag">&lt;/<span class="hljs-name">server</span>&gt;</span>
       <span class="hljs-tag">&lt;<span class="hljs-name">server</span>&gt;</span>
           <span class="hljs-tag">&lt;<span class="hljs-name">id</span>&gt;</span>snapshots<span class="hljs-tag">&lt;/<span class="hljs-name">id</span>&gt;</span>
           <span class="hljs-tag">&lt;<span class="hljs-name">username</span>&gt;</span>blablanumerodeux<span class="hljs-tag">&lt;/<span class="hljs-name">username</span>&gt;</span>
           <span class="hljs-tag">&lt;<span class="hljs-name">password</span>&gt;</span>${env.JFROG_API_KEY}<span class="hljs-tag">&lt;/<span class="hljs-name">password</span>&gt;</span>
       <span class="hljs-tag">&lt;/<span class="hljs-name">server</span>&gt;</span>
   <span class="hljs-tag">&lt;/<span class="hljs-name">servers</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">settings</span>&gt;</span></code></pre></div>
<p>Note again the <code>&lt;id&gt;central&lt;/id&gt;</code> and  <code>&lt;id&gt;snapshots&lt;/id&gt;</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>&lt;resources&gt;</code> tag like that:</p>
<div><pre class="hljs"><code>    <span class="hljs-tag">&lt;<span class="hljs-name">build</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">resources</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">resource</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">directory</span>&gt;</span>src/main/resources<span class="hljs-tag">&lt;/<span class="hljs-name">directory</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-name">resource</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">resource</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">directory</span>&gt;</span>src/main/java<span class="hljs-tag">&lt;/<span class="hljs-name">directory</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">includes</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-name">include</span>&gt;</span>**/*.java<span class="hljs-tag">&lt;/<span class="hljs-name">include</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-name">includes</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-name">resource</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">resources</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">plugins</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">plugin</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.apache.maven.plugins<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>maven-javadoc-plugin<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>3.0.1<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">configuration</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-name">configuration</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-name">plugin</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">plugin</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.apache.maven.plugins<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>maven-jar-plugin<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>2.3.2<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-name">plugin</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">plugin</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.apache.maven.plugins<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>maven-source-plugin<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>2.1.2<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-name">plugin</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">plugins</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">build</span>&gt;</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> &lt;- 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> -&gt; to test localy<br />
<code>hugo -d ../blablanumerodeux.github.io/</code> -&gt; 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">&lt;<span class="hljs-name">plugin</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>com.spotify<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>dockerfile-maven-plugin<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>1.4.10<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">configuration</span>&gt;</span>
                    <span class="hljs-comment">&lt;!--&lt;serverId&gt;docker-hub&lt;/serverId&gt;--&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-name">useMavenSettingsForAuth</span>&gt;</span>true<span class="hljs-tag">&lt;/<span class="hljs-name">useMavenSettingsForAuth</span>&gt;</span>
                    <span class="hljs-comment">&lt;!--&lt;registryUrl&gt;https://index.docker.io/v1/&lt;/registryUrl&gt;--&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-name">repository</span>&gt;</span>dakarinternational/dakar<span class="hljs-tag">&lt;/<span class="hljs-name">repository</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-name">buildArgs</span>&gt;</span>
                        <span class="hljs-tag">&lt;<span class="hljs-name">JAR_FILE</span>&gt;</span>target/${project.build.finalName}.jar<span class="hljs-tag">&lt;/<span class="hljs-name">JAR_FILE</span>&gt;</span>
                    <span class="hljs-tag">&lt;/<span class="hljs-name">buildArgs</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-name">configuration</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-name">plugin</span>&gt;</span>
</code></pre></div>
<p>Notice the <code>&lt;JAR_FILE&gt;</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>