<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Yusuf Yılmaz on Medium]]></title>
        <description><![CDATA[Stories by Yusuf Yılmaz on Medium]]></description>
        <link>https://medium.com/@yusufylmaz15?source=rss-ce940d966c4c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SS5dY26J5h_JU5FHWkmoog.jpeg</url>
            <title>Stories by Yusuf Yılmaz on Medium</title>
            <link>https://medium.com/@yusufylmaz15?source=rss-ce940d966c4c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 05:37:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yusufylmaz15/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Azure Web App Deployment Guide: Automation with GitHub Actions and Docker]]></title>
            <link>https://medium.com/@yusufylmaz15/azure-web-app-deployment-guide-automation-with-github-actions-and-docker-0c752f73727a?source=rss-ce940d966c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/0c752f73727a</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[frontend]]></category>
            <dc:creator><![CDATA[Yusuf Yılmaz]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 16:51:54 GMT</pubDate>
            <atom:updated>2026-03-09T16:51:54.080Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*l4ePrEHVG4S-nVGk86Eyyg.webp" /></figure><p>Hello! Today, we will explore how to Dockerize web applications built with Next.js, host them on Azure Container Registry (ACR), and deploy them within the Azure Web App ecosystem. Moreover, we will transform this entire process into a fully automated CI/CD pipeline using GitHub Actions.</p><h3>1. Azure App Registration Configuration</h3><p>We need to create an <strong>App Registration</strong> to securely access Azure resources through GitHub Actions. This registration will manage role-based authentication and authorization (RBAC) processes.</p><p>You can create the app registration via <strong>Azure portal &gt; App Registrations &gt; New registration</strong>. You can give it a name like gh-actions-loginWe will use this registration in the following steps.</p><h3>2. Azure Container Registry (ACR) Configuration</h3><p>We are creating an<strong> Azure Container Registry </strong>to securely store our Docker images. This ACR can be created under an existing Resource Group or within a new one. The ACR name must be globally unique and consist entirely of <strong>lowercase </strong>letters. (e.g.: myapp_container)</p><p>Since we will use this ACR for push and update operations through GitHub Actions, we need to add our <strong>App Registration</strong> to our container. Follow the steps below for this.</p><p><strong>Permission Assignment Steps:</strong></p><ol><li>Go to the <strong>Access Control (IAM)</strong> tab from the ACR menu.</li><li>Follow the path <strong>Add &gt; Add </strong>role assignment.</li><li>Under<strong> Privileged administrator roles</strong>, select the following roles: <strong>Contributor </strong>for resource management; <strong>AcrPush </strong>for image upload permissions.</li><li>In the Assign access to section, select the “<strong>User, group, or service principa</strong>l” option.</li><li>In the <strong>Select members</strong> section, search for and select the gh-actions-login application, then save.</li></ol><h3>3. Azure Web App (App Service) and Environment Configuration</h3><p>We are setting up a scalable and secure structure while creating the <strong>Azure Web App</strong> service where we will deploy our application. Choose a unique name (e.g.: myapp-prod). The publish type should be set to <strong>Container</strong>, and the operating system should be <strong>Linux</strong>.</p><blockquote>The most critical point to pay attention to here is configuring both the ACR and the Az<strong>ure Web App</strong> service in the same <strong>Resource Group</strong> and the same <strong>Region </strong>(e.g., West Europe) to minimize performance loss and latency. This strategy not only improves server response times for users accessing from Turkey’s location but also accelerates data traffic between Azure services themselves.</blockquote><p><strong>Deployment Slots:</strong> You can create different environments such as Test and Staging within a single App Service. This way, you can test new features independently from your main application (Production).</p><blockquote><em>A Standard or higher App Service Plan is required to use the slot feature. If you don’t have this plan, you can proceed by creating a separate Web App for testing.</em></blockquote><h4><strong>Requirement: ACR Access Permission (AcrPull)</strong></h4><p>Authorization through<strong> Managed Identity</strong> is mandatory for the Web App to pull Docker images from the ACR.</p><ul><li><strong>Identity Definition:</strong> Go to the Identity tab from the Web App menu. Set the System assigned status to “On” and save.</li><li><strong>Role Assignment (RBAC):</strong> Navigate to your ACR resource and follow this path:</li><li><strong>Access Control (IAM) &gt; Add role</strong> assignment.</li><li><strong>Role</strong>: <strong>AcrPull </strong>(under the Privileged tab).</li><li><strong>Assign access to</strong>: Managed Identity.</li><li><strong>Select Members</strong>: Search for and select your Web App name.</li></ul><blockquote><strong>Important:</strong> If you are using slots (Test/Staging), remember that you need to repeat this authorization process separately for each slot.</blockquote><h3>4. GitHub Secrets Configuration and Data Collection</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-TJsd6C1rwWMiiLJt5xxA.png" /></figure><p>For the automation to work smoothly, you need to securely define the identity and resource information from Azure in your GitHub repository. The table below summarizes which information to get from where and which key to store it under on the GitHub side.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8c14a7acf26adeef1f185c85b751602/href">https://medium.com/media/a8c14a7acf26adeef1f185c85b751602/href</a></iframe><blockquote>Update the variables according to your own project. You can see the required secret information and where to obtain them in the table above.</blockquote><h4><strong>Critical Note: Repository vs. Environment Secrets</strong></h4><p>If you use separate structures for both Test and Production in your project, you should do the following for Secret management:</p><ul><li><strong>Repository Secrets:</strong> Add variables that are common to all environments, such as ACR_LOGIN_SERVER, TENANT_ID, and TENANT_ID, to this section.</li><li><strong>Environment Secrets:</strong> Define environment-specific variables like NEXT_PUBLIC_API_URLunder the “Environments” (Test/Production) tab on GitHub. This way, you can run the same workflow file with different parameters for both environments.</li></ul><blockquote>In your GitHub repository, follow the path <strong>Settings &gt; Secrets and variables &gt; Actions</strong> and enter the above data using the “New repository secret” button.</blockquote><h3>5. Secure Authentication: Federated Credentials Configuration</h3><p>So far, we have created the App Registration, ACR, and Web App on Azure, completed region selections for high performance between services, and prepared our infrastructure for deployment by defining the necessary access permissions and secure credentials on the GitHub side.</p><p>Now, we will take this structure to a more secure level. Instead of dealing with traditional password (client secret) management, we will use Azure’s modern authentication method called <strong>Workload Identity Federation</strong>. Thanks to this method, we establish a fully secure connection between GitHub and Azure that works with passwordless, certificate-based, and temporary keys.</p><p>In short, in this step, we are enabling GitHub Actions to prove its identity “without using a password” when accessing our Azure resources.</p><h3><strong>Configuration Steps:</strong></h3><ol><li>Follow the path <strong>Azure Portal &gt; App Registrations</strong> and select the relevant registration.</li><li>From the left menu, go to<strong> Certificates &amp; secrets &gt; Federated credentials</strong> tab and click the<strong> Add credential</strong> button.</li><li>In the<strong> Federated credential </strong>scenario section, select the <strong>GitHub Actions deploying Azure</strong> resources option.</li></ol><h4>A. Environment-Based Authorization</h4><p>If you use environments like “Test” or “Production” in your GitHub repository:</p><ul><li><strong>Organization</strong>: Your GitHub username or organization name.</li><li><strong>Repository</strong>: Your project name.</li><li><strong>Entity type</strong>: Environment</li><li><strong>Environment Name</strong>: Test or Production.</li><li>You will see a path like repo:MyOrganization/MyRepository:ref:refs/environment:Production in the <strong>Subject Identifier</strong>.</li></ul><h4>B. Branch-Based Authorization</h4><p>To deploy main version images directly from a specific branch:</p><ul><li><strong>Entity Type</strong>: Branch</li><li><strong>Branch Name</strong>: The main branch name that will go live (e.g.: deployment).</li><li>You will see a path like repo:MyOrganization/MyRepository:ref:refs/heads/deployment in the <strong>Subject Identifier.</strong></li></ul><p><strong>Finally</strong></p><p>Give a descriptive name like production-env-auth-myapp and click the Add button.</p><blockquote><strong><em>Step A </em></strong><em>would have been sufficient for us, but since we will also manually tag the Production Image as </em><strong><em>Live </em></strong><em>through the </em><strong><em>GitHub workflow</em></strong><em>, we will create the branch with </em><strong><em>step B </em></strong><em>and perform this operation through it as well.</em></blockquote><h3>6. Dockerfile Configuration</h3><p>To run our Next.js application on Azure, we need to package the project into an image. The following Dockerfile minimizes image size and enhances security using the Multi-Stage Build method.</p><pre>FROM node:20.17.0-alpine AS builder<br>WORKDIR /usr/src/app<br><br>COPY package.json yarn.lock ./<br>RUN yarn install --frozen-lockfile<br><br>COPY . .<br><br>RUN yarn build<br><br>RUN yarn install --production --ignore-scripts --prefer-offline<br><br>FROM node:20.17.0-alpine AS runner<br>WORKDIR /usr/src/app<br><br>COPY --from=builder /usr/src/app/public ./public<br>COPY --from=builder /usr/src/app/.next ./.next<br>COPY --from=builder /usr/src/app/node_modules ./node_modules<br>COPY --from=builder /usr/src/app/package.json ./package.json<br><br>EXPOSE 8080<br>CMD [&quot;yarn&quot;, &quot;start&quot;]</pre><blockquote>Create the <strong>Dockerfile </strong>in the same directory as .env and add the content above. (Update the variables according to your own project)</blockquote><h4><strong>Why Do We Use This Structure?</strong></h4><ul><li><strong>Lightweight Image (Alpine):</strong> By using alpine as the base image, we occupy minimum space on the server.</li><li><strong>Multi-Stage Build:</strong> We don’t include unnecessary files used during compilation (source code, development packages, etc.) in the final image. We improve performance by only taking the .next, public, and node_modules folders.</li><li><strong>Security and Speed:</strong> With the yarn install — production command, we only keep packages needed at runtime, thus reducing security vulnerabilities and shortening the application startup time.</li></ul><p><strong>Important Reminder:</strong> Since Azure Web App listens on port 8080 by default, using EXPOSE 8080and running the application on this port is critically important for compatibility.</p><h3>7. GitHub Actions Workflow (.yml) Configuration</h3><p>We are creating our.github/workflows/deploy.yml file that ties the entire process together. This workflow is the main orchestrator that manages all stages from building the code to pushing it to ACR and deploying it to the relevant slots on Azure.</p><pre>name: Build &amp; Deploy (Smart Versioning)<br><br>on:<br>  push:<br>    branches:<br>      - production<br>      - test<br>  workflow_dispatch: # Manuel tetikleme için<br><br>permissions:<br>  id-token: write<br>  contents: read<br><br>jobs:<br>  # --- 1. JOB: BUILD (Push gelince çalışır) ---<br>  build:<br>    if: github.event_name == &#39;push&#39;<br>    runs-on: ubuntu-latest<br>    environment: ${{ github.ref == &#39;refs/heads/production&#39; &amp;&amp; &#39;Production&#39; || &#39;Test&#39; }}<br><br>    steps:<br>      - name: Checkout repository<br>        uses: actions/checkout@v4<br><br>      - name: Azure Login<br>        uses: azure/login@v2<br>        with:<br>          client-id: ${{ secrets.AZUREAPPSERVICE_CLIENT_ID }}<br>          tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANT_ID }}<br>          subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTION_ID }}<br><br>      - name: Login to Azure Container Registry<br>        run: az acr login --name ${{ secrets.ACR_LOGIN_SERVER }}<br><br>      - name: Create .env file<br>        run: |<br>          cat &lt;&lt;EOF &gt; .env<br>          NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }}<br>          NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=${{ secrets.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY }}<br>          NEXT_PUBLIC_GOOGLE_MAP_ID=${{ secrets.NEXT_PUBLIC_GOOGLE_MAP_ID }}<br>          EOF<br><br>      - name: Build and push Docker image<br>        uses: docker/build-push-action@v6<br>        with:<br>          context: .<br>          push: true<br>          provenance: false<br>          sbom: false<br>          file: ./Dockerfile<br>          tags: ${{ secrets.ACR_LOGIN_SERVER }}/${{ secrets.ACR_REPO_NAME }}:${{ github.ref_name }}-${{ github.sha }}<br><br>      - name: Clean up old images (Keep last 3)<br>        run: |<br>          KEEP=1<br><br>          if [ &quot;${{ github.ref_name }}&quot; == &quot;production&quot; ]; then<br>            KEEP=3<br>          fi<br><br>          echo &quot;Branch: ${{ github.ref_name }} | Keeping last $KEEP images.&quot;<br><br>          az acr repository show-manifests \<br>            --name ${{ secrets.ACR_LOGIN_SERVER }} \<br>            --repository ${{ secrets.ACR_REPO_NAME }} \<br>            --orderby time_desc \<br>            --query &quot;[?tags[?contains(@, &#39;${{ github.ref_name }}-&#39;)]].digest&quot; \<br>            -o tsv | awk &quot;NR&gt;$KEEP&quot; | xargs -I% az acr repository delete --name ${{ secrets.ACR_LOGIN_SERVER }} --image ${{ secrets.ACR_REPO_NAME }}@% --yes || true<br><br>  # --- 2. JOB: DEPLOY (Build bitince çalışır) ---<br>  deploy:<br>    if: github.event_name == &#39;push&#39;<br>    runs-on: ubuntu-latest<br>    needs: build<br>    environment: ${{ github.ref == &#39;refs/heads/production&#39; &amp;&amp; &#39;Production&#39; || &#39;Test&#39; }}<br><br>    steps:<br>      - name: Azure Login<br>        uses: azure/login@v2<br>        with:<br>          client-id: ${{ secrets.AZUREAPPSERVICE_CLIENT_ID }}<br>          tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANT_ID }}<br>          subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTION_ID }}<br><br>      - name: Deploy to Azure Web App (Staging/Test Slot)<br>        run: |<br>          SLOT_PARAM=&quot;&quot;<br>          if [ &quot;${{ github.ref_name }}&quot; == &quot;production&quot; ]; then<br>            SLOT_PARAM=&quot;--slot staging&quot;<br>          elif [ &quot;${{ github.ref_name }}&quot; == &quot;test&quot; ]; then<br>            SLOT_PARAM=&quot;--slot test&quot;<br>          else<br>            exit 1<br>          fi<br><br>          DOCKER_IMAGE_TAG=&quot;${{ secrets.ACR_LOGIN_SERVER }}/${{ secrets.ACR_REPO_NAME }}:${{ github.ref_name }}-${{ github.sha }}&quot;<br><br>          az webapp config set --name &quot;${{ secrets.WEBAPP_NAME }}&quot; \<br>            --resource-group &quot;${{ secrets.WEBAPP_RESOURCE_GROUP }}&quot; \<br>            $SLOT_PARAM \<br>            --generic-configurations &#39;{&quot;acrUseManagedIdentityCreds&quot;: true}&#39; \<br>            --always-on true<br><br>          az webapp config appsettings set --name &quot;${{ secrets.WEBAPP_NAME }}&quot; \<br>            --resource-group &quot;${{ secrets.WEBAPP_RESOURCE_GROUP }}&quot; \<br>            $SLOT_PARAM \<br>            --settings WEBSITES_PORT=8080 DOCKER_CUSTOM_IMAGE_NAME=&quot;$DOCKER_IMAGE_TAG&quot;<br><br>          az webapp config container set --name &quot;${{ secrets.WEBAPP_NAME }}&quot; \<br>            --resource-group &quot;${{ secrets.WEBAPP_RESOURCE_GROUP }}&quot; \<br>            $SLOT_PARAM \<br>            --docker-custom-image-name &quot;$DOCKER_IMAGE_TAG&quot; \<br>            --docker-registry-server-url &quot;https://${{ secrets.ACR_LOGIN_SERVER }}&quot;<br><br>      - name: Restart Slot<br>        run: |<br>          SLOT_PARAM=&quot;&quot;<br>          if [ &quot;${{ github.ref_name }}&quot; == &quot;production&quot; ]; then<br>            SLOT_PARAM=&quot;--slot staging&quot;<br>          elif [ &quot;${{ github.ref_name }}&quot; == &quot;test&quot; ]; then<br>            SLOT_PARAM=&quot;--slot test&quot;<br>          fi<br><br>          az webapp restart --name &quot;${{ secrets.WEBAPP_NAME }}&quot; \<br>            --resource-group &quot;${{ secrets.WEBAPP_RESOURCE_GROUP }}&quot; \<br>            $SLOT_PARAM<br><br>  # --- 3. JOB: PROMOTE TO LIVE (Sadece Butonla Çalışır) ---<br>  promote-to-live:<br>    if: github.event_name == &#39;workflow_dispatch&#39;<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Azure Login<br>        uses: azure/login@v2<br>        with:<br>          client-id: ${{ secrets.AZUREAPPSERVICE_CLIENT_ID }}<br>          tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANT_ID }}<br>          subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTION_ID }}<br><br>      - name: Tag and Seal Image as &#39;live&#39;<br>        run: |<br>          CURRENT_IMAGE=$(az webapp config appsettings list \<br>            --name &quot;${{ secrets.WEBAPP_NAME }}&quot; \<br>            --resource-group &quot;${{ secrets.WEBAPP_RESOURCE_GROUP }}&quot; \<br>            --query &quot;[?name==&#39;DOCKER_CUSTOM_IMAGE_NAME&#39;].value&quot; -o tsv)<br><br>          echo &quot;Production image being sealed: $CURRENT_IMAGE&quot;<br><br>          az acr import \<br>            --name ${{ secrets.ACR_LOGIN_SERVER }} \<br>            --source $CURRENT_IMAGE \<br>            --image ${{ secrets.ACR_REPO_NAME }}:live \<br>            --force<br><br>          az webapp config container set \<br>            --name &quot;${{ secrets.WEBAPP_NAME }}&quot; \<br>            --resource-group &quot;${{ secrets.WEBAPP_RESOURCE_GROUP }}&quot; \<br>            --docker-custom-image-name &quot;${{ secrets.ACR_LOGIN_SERVER }}/${{ secrets.ACR_REPO_NAME }}:live&quot;<br><br>          az webapp config appsettings set --name &quot;${{ secrets.WEBAPP_NAME }}&quot; \<br>            --resource-group &quot;${{ secrets.WEBAPP_RESOURCE_GROUP }}&quot; \<br>            --settings DOCKER_CUSTOM_IMAGE_NAME=&quot;${{ secrets.ACR_LOGIN_SERVER }}/${{ secrets.ACR_REPO_NAME }}:live&quot;</pre><h4><strong>Core Capabilities of the Workflow:</strong></h4><h4>JOB: Build (Build and Register)</h4><p>This stage runs only when code is pushed. Its purpose is to create the application’s Docker image and securely upload it to ACR.</p><ul><li><strong>Azure &amp; ACR Login:</strong> Connects to Azure passwordlessly using OIDC (Workload Identity).</li><li><strong>Dynamic .env Creation:</strong> Injects the API keys stored in GitHub Secrets (such as NEXT_PUBLIC_API_URL) into the Docker image during the build phase.</li><li><strong>Docker Build &amp; Push:</strong> Packages the application and sends it to ACR, tagging each image as branch-commit_id (e.g.:production-a1b2c3d).</li><li><strong>Smart Cleanup:</strong> To avoid unnecessary costs in ACR, it keeps only the last image in the testbranch and the last 3 images in the productionbranch (for rollback purposes); it automatically deletes older ones.</li></ul><h4>2. JOB: Deploy (Deployment)</h4><p>This kicks in after the image is successfully built. It determines the target based on which branch the code came from.</p><ul><li><strong>Dynamic Slot Management:</strong> If the code comes from the productionbranch, it is directed to the Staging slot; if from the testbranch, to the Test slot.</li><li><strong>Container Configuration:</strong> Instructs the Azure Web App: “This is the new image address, pull it from ACR using Managed Identity.”</li><li><strong>Port and Settings Update:</strong> Configures the WEBSITES_PORT=8080 setting required for the application to run and defines the new image.</li><li><strong>Slot Restart:</strong> Restarts the relevant slot for the settings to take effect and the new image to go live immediately.</li></ul><h4>3. JOB: Promote to Live (Go Live and Seal)</h4><p>This is the “smartest” part of the workflow. It only runs when manually triggered (via button).</p><ul><li><strong>Image Sealing (Live Tag):</strong> Finds the image currently running in the Staging slot that has been confirmed as successful. It re-tags (imports) this image with the :live label within ACR.</li><li><strong>Version Pinning:</strong> Updates the Web App to point to this:live tagged image.</li><li><strong>Security:</strong> This operation is restricted to run only from the production branch; thus, the possibility of accidentally pushing test-stage code to productionis technically prevented.</li></ul><blockquote><strong><em>Result:</em></strong><em> Thanks to this structure, when you push your code, it is first placed in a secure “waiting room” (Staging/Test), and your live environment (Production) remains protected until you give manual approval.</em></blockquote><h3>8. First Deployment (Push) and Deployment Center Configuration</h3><p>Now that the infrastructure is ready, we can start the process by pushing our code. While the process is automated for <strong>Test and Staging</strong> slots, a one-time manual synchronization is required for the <strong>Production </strong>(Live) environment. The fundamental reason for this is the requirement for both slots to be accessible and have compatible settings for a safe <strong>Swap </strong>operation.</p><h4>A. Deployment Center Settings</h4><p>Follow the steps below to specify which container image your web application will use:</p><ul><li><strong>Access: Azure Portal &gt; Web App &gt; Deployment Center</strong>.</li><li><strong>Source</strong>: Container Registry.</li><li><strong>Container Type</strong>: Single Container.</li><li><strong>Image Source</strong>: Azure Container Registry (ACR).</li><li><strong>Subscription &amp; Registry</strong>: Select your Azure subscription and the ACR name you created.</li><li><strong>Image &amp; Tag</strong>: Select the testor productiontag based on your branch structure (e.g.: production-commitsha).</li><li><strong>Completion</strong>: Save the settings by clicking “Finish”.</li></ul><h4>B. Environment Variables and Synchronization</h4><p>The .env data must be defined on the Azure side for your application to work properly:</p><ul><li><strong>Configuration: Go to the Web App &gt; Configuration &gt; Application</strong> Settings tab.</li><li><strong>Copy Strategy</strong>: Manually copy the successful settings from the Staging slot to the Production slot.</li><li><strong>Why Manual</strong>? We need to ensure that both slots have the same environment variables for the system to work stably during the first Swap operation. Once this is done, subsequent updates will be performed automatically through GitHub Actions.</li></ul><h4>C. Automatic Deployment Flow</h4><p>After the configuration is complete, the system will work as follows:</p><ul><li><strong>Test Branch:</strong> Push operations to this branch are deployed directly to the Test Slot. However, there is a small but critically important detail for the process to proceed smoothly, which we will address shortly.</li><li><strong>Production/Deployment Branch:</strong> Push operations to this branch are deployed to the Staging Slot. After successful testing, you can transfer the new version from Staging to Production (Live) within seconds using the “<strong>Swap</strong>” button.</li></ul><blockquote>The greatest advantage offered by the Swap mechanism is the ability to instantly <strong>Rollback </strong>to the previous version with a single click when an unexpected error is encountered in the live environment (Production). This way, you can release new updates with minimum risk and prevent system outages.</blockquote><h3>9. Advanced Security and Swap Configuration</h3><p>We have set up our system, but we need to make some critical “fine adjustments” to ensure the staging environment is closed to the outside world and swap operations are performed without errors.</p><h4>A. Microsoft Authentication for the Staging Environment</h4><p>Adding Microsoft Authentication is critical from a security perspective to ensure that only authorized people can access the staging environment (myapp-staging.azurewebsites.net):</p><ul><li><strong>Configuration:</strong> Add the “Microsoft” provider from the <strong>Web App </strong>&gt; <strong>Authentication </strong>tab.</li><li><strong>Variables:</strong> As a result of this operation, variables such as MICROSOFT_PROVIDER_AUTHENTICATION_SECRETand WEBSITE_AUTH_AAD_ALLOWED_TENANTS will be automatically created.</li><li><strong>Slot Setting:</strong> Make sure to check the “<strong>Deployment slot setting</strong>” checkbox next to these variables (set to <strong>true</strong>). This way, these settings will remain “pinned” to the staging slot; even if you perform a swap, they won’t be transferred to the live environment (Production), preventing an unexpected login screen from appearing on your live site.</li></ul><h4>B. Warm-up and Status Codes for Safe Swap</h4><p>When we add authentication to the staging environment, Azure may encounter a redirect or 401 (Unauthorized) error when checking the site during the swap process (warm-up). To prevent this from causing the swap to fail, we need to make the following setting:</p><ul><li><strong>Variable:</strong> WEBSITE_SWAP_WARMUP_PING_STATUSES</li><li><strong>Value:</strong> 200,301,302,401</li><li><strong>Purpose:</strong> Ensures that Azure considers the redirect or authentication codes it receives when trying to access the staging slot as “successful.” If this variable is not defined, the swap operation will fail with an error due to the login screen.</li></ul><h4>C. “Safety Lock” Against Erroneous Swap Operations</h4><p>We are adding a warning mechanism to prevent accidentally swapping the wrong slot (e.g., the Test slot) to production while working between Test, Staging, and Production slots:</p><ul><li><strong>Test Slot Setting:</strong> Add a variable named something like CAUTION_THIS_IS_TEST_SLOT_DO_NOT_SWAP to your Test slot&#39;s configuration and set its value to true.</li><li><strong>Critical Note:</strong> Also activate the “Deployment slot setting” option for this variable. This way, when you see this warning on the swap screen, you will have minimized the risk of performing an incorrect operation.</li></ul><h3>Result: Fully Automated Flow</h3><p>When all these settings are complete, your workflow will become seamless as follows:</p><p>When all these settings are complete, your workflow will become seamless as follows:</p><p><strong>Test Branch:</strong> When pushed, it goes directly to the <strong>Test Slot</strong>.</p><ul><li><strong>Production Branch:</strong> When pushed, it first goes to the <strong>Staging Slot</strong>.</li><li><strong>Swap:</strong> After performing final checks on Staging, Swap is manually initiated and the application transitions to production (Live) seamlessly within seconds.</li><li><strong>Tagging:</strong> After the Swap, you can complete your version tracking by tagging the last successful image as “<strong>Live</strong>” through GitHub.</li></ul><h3>Summary: Architectural Flow and Critical Checklist</h3><p>You can manage the lifecycle of your Next.js application on Azure within the framework of the following fundamental rules:</p><ul><li><strong>Automatic Deployment Logic:</strong> Push operations to the production branch are directed to the Staging Slot. Push operations to the test branch are deployed to an isolated environment, the Test Slot.</li><li><strong>Initial Setup Requirement:</strong> Before the first swap operation, you need to manually copy the configuration settings from the Staging slot to the Production slot. This is a one-time operation; subsequent processes will proceed automatically.</li><li><strong>Erroneous Operation Protection:</strong> Add the CAUTION_THIS_IS_TEST_SLOT_DO_NOT_SWAP variable to the Test slot and mark it as Deployment slot setting: true. This is a visual security barrier against the risk of accidentally pushing the test environment to production.</li><li><strong>Slot Security (Optional):</strong> Adding Microsoft Authentication is recommended to prevent unauthorized access to the Staging or Test environment. Set the Deployment slot setting of the variables created by this operation to true to ensure that the live environment (Production) is not affected by this restriction.</li><li><strong>Swap Solution:</strong> To prevent the swap operation from failing when authentication is active, assign the values 200,301,302,401 to the WEBSITE_SWAP_WARMUP_PING_STATUSES variable. This ensures that Azure considers login screen redirects as &quot;healthy.&quot;</li><li><strong>Storage and Rollback Strategy:</strong> To prevent unnecessary cost and complexity on the Container Registry, we keep Test images clean and store the last 3 images for Production. By tagging the most current image as live, we guarantee the ability to quickly Rollback to one of the previous 3 versions in case of a potential crisis.</li></ul><p>Today, we explored step by step how to Dockerize our Next.js applications and move them to a fully automated CI/CD pipeline with Azure and GitHub Actions. Together, we have built a secure and scalable structure offered by modern cloud architecture. Thank you for taking the time to read!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0c752f73727a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP, HTTPS, SSL/TLS,SSH]]></title>
            <link>https://medium.com/@yusufylmaz15/http-https-ssl-tls-ssh-c7126392e2b5?source=rss-ce940d966c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7126392e2b5</guid>
            <category><![CDATA[tls]]></category>
            <category><![CDATA[ssl]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[https]]></category>
            <category><![CDATA[http-request]]></category>
            <dc:creator><![CDATA[Yusuf Yılmaz]]></dc:creator>
            <pubDate>Thu, 28 Jul 2022 17:30:19 GMT</pubDate>
            <atom:updated>2022-07-29T14:04:55.037Z</atom:updated>
            <content:encoded><![CDATA[<h4>Web ve HTTP</h4><p>1990&#39;ların başına kadar İnternet öncelikle araştırmacılar, akademisyenler ve üniversite öğrencileri tarafından kullanılıyordu. uzak ana bilgisayarlarda oturum açmak, yerel ana bilgisayarlardan uzak ana bilgisayarlara dosya aktarmak ve bunun tam tersi için, haber göndermek ve almak, elektronik posta almak ve göndermek için kullanılıyordu.Ta ki <strong>WWW </strong>(Wordl Wide Web) sahneye çıkana kadar. <strong>Web</strong>, halkın dikkatini çeken ilk İnternet uygulamasıydı. İnsanların çalışma ortamlarının içinde ve dışında nasıl etkileşime girdiğini önemli ölçüde değiştirdi ve değiştirmeye devam ediyor. Belki de kullanıcılara en çok hitap eden şey, Web’in talep üzerine çalışmasıdır. Kullanıcılar istedikleri zaman istedikleri şeyleri alırlar.bu Tv ve Radyo yayınlarının tam tersidir.Web herkesi bir yayıncı hale getirdi.Arama motorları web okyanusunda gezinmemizi sağladı. Formlar, JavaScript, Java uygulamaları ve diğer birçok cihaz sayfalar ve sitelerle etkileşim kurmamızı sağlar. Ve Web protokolleri, YouTube, Web tabanlı e-posta (Gmail gibi) ve çoğu mobil İnternet uygulaması, Instagram ve Google Haritalar için bir platform görevi görür.</p><h4><strong>HTTP’ye genel bakış</strong></h4><p>Hyper Text Transfer Protokol(HTTP) web’in uygulama katmanında 80 port numarası ile çalışan bir prokoldür. Web’in kalbi diyebiliriz. Http 2 programda uygulanır: istemci(<strong>client</strong>) programı ve sunucu(<strong>server</strong>) programı. Server ve Client, uç sistemleri çalıştırarak, http mesajlarını birbirleri ile değiştirerek mesajlaşırlar. Bu mesajların yapısı HTTP tarafından tanımlanır. HTTP’nin detaylarına inmeden önce bazı web terminolojini inceleyelim. Bir Web sayfası (<strong>document </strong>de denebilir) <strong>object </strong>(nesne) lerden oluşur.Bir objectkısaca html, jpeg video-clip vb- kısaca single URL ile adreslenebilir bir dosyadır.</p><p>Çoğunlukla web sayfası temel bir HTML dosyasıdan ve birçok farklı objecten oluşur. Örnek olarak bir Web sayfasında 1 html 5 tane jpeg dosyası var ise bu web sayfasında toplmada 6 tane object vardır. Temel HTML dosyası, nesnelerin <strong>URL’leri </strong>ile sayfadaki diğer nesnelere başvurur.Her URL in 2 tane bileşeni vardır: hostname ve pathname. Örnek olarak: <a href="http://www.someschool.edu/someDepartment/picture.gif"><strong>http://www.someSchool.edu/someDepartment/picture.gif</strong></a> Bu URL <a href="http://www.someschool.edu/"><strong>www.someSchool.edu</strong></a><strong> </strong>hostname ,<strong> /someDepartment/picture.gif</strong> ise pathnamedir.Web Browserlar HTTP’nin Client tarafını uygularken, Web Serverlar Server Tarafını uygular. HTTP, Web clientların Web serverından Web sayfalarını nasıl talep ettiğini ve serverların Web sayfalarını clientlara nasıl aktardığını tanımlar. Client bir <strong>Request </strong>te bulunduğunda (bir linke tıklarsa mesela) Browser, sayfadaki objectler için server a HTTP Request mesajı gönderir. Server, request mesajını aldığında bu mesaj için browser a http response ile response mesajı gönderir.</p><p>HTTP, temel aktarım protokolü olarak <strong>TCP’yi </strong>kullanır. HTTP client i önce server ile bir TCP bağlantısı başlatır. Bağlantı kurulduğunda, browser ve server işlemleri TCP’ye kendi soket arayüzleri üzerinden erişim sağlar. Client tarafında, soket arabirimi, istemci işlemi ile TCP bağlantısı arasındaki kapıdır; server tarafında ise sunucu işlemi ile TCP bağlantısı arasındaki kapıdır. Client, HTTP istek mesajlarını soket arayüzüne gönderir ve HTTP yanıt mesajlarını soket arayüzünden alır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/302/1*vbGIMUWw501C9j4v1fU94g.png" /></figure><p>Benzer şekilde, HTTP server soket arayüzünden istek mesajları alır ve soket arayüzüne cevap mesajları gönderir. İstemci soket arayüzüne bir mesaj gönderdiğinde, mesaj artık clientın elinden çıkmış TCP’nin eline geçmiştir. TCP, HTTP’ye güvenilir bir veri aktarım hizmeti sağlar. Bu, şu anlama gelir: bir client işlemi tarafından gönderilen her HTTP istek mesajı, sonunda servera bozulmadan ulaşır; benzer şekilde, server işlemi tarafından gönderilen her HTTP yanıt mesajı, sonunda clienta eksiksiz olarak ulaşır. Burada katmanlı mimarini büyük bir avantajını görüyoruz. HTTP, datada oluşacak kayıp ile ilgilenmez, bu iş TCP tarafından gerçekleştirilir.</p><h4><strong>HTTP mesaj formatları</strong></h4><p>Response message ve Request message olmak üzere 2 farklı mesaj formatı vardır</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*KtRe3EoTD5pY5AK_i2Qkjg.png" /><figcaption><em>HTTP Request Message yapısı</em></figcaption></figure><p>Öncelikle mesajın sıradan <strong>ASCII </strong>metninde yazıldığını görüyoruz, Sırdan bir bilgisayar okur yazarı bile bunu okuyabilir. İkinci olarak, mesajın her biri bir satır başı ve bir satır içeriği olarak birbirini takipeden beş satırdan oluştuğunu görüyoruz.Bu request mesajı 5 satrıdan oluşuyor ama daha fazla mesajdanda oluşabilir.</p><p>HTTP request mesajını ilk satırı <strong>request</strong> satırı olarak adlandırılır.Sonraki satırlar ise <strong>Header</strong> Satırları olarak adlandırılır. Request satırı 3 alandan oluşur: Method alanı, URL alanı ve HTTP versiyon alanı.</p><p>Method alanı <em>GET,POST,PUT,DELETE,HEAD</em> gibi değerler alabilir. En çok kullanılan GET ve POST tur. <strong>GET</strong> browser bir object için requestte bulunduğunda kullanılır.</p><p><strong>PUT</strong>: Sunucudaki bir kaynağı güncellemek için kullanılır. Bu istekler de genellikle üzerilerinde değiştirilmek istenen bilgiyi taşırlar.</p><p><strong>PATCH:</strong> Bu metot da sunucudaki bir kaynağı değiştirmek için kullanılır. Put ile arasındaki fark ise Put sunucudaki kaynağı yeni bir kaynak ile değiştirmek için kullanılır iken, Patch bu kaynağında bir kısmını değiştirmeye yarar.</p><p><strong>DELETE:</strong> Sunucudaki bir kaynağı silmeye yarar.</p><p><strong>Daha az kullanılan metotlar ise aşağıdaki gibidir:</strong></p><p><strong>CONNECT:</strong> Sunucu ile bir bağlantı oluşturma isteği gönderir. Sunucu bağlantılarını minimum yük ile test etme olanağı sağlar.</p><p><strong>HEAD</strong> : Sunucuya aynı Get metodu gibi ancak sadece başlığı olan (Request Header), gövdesi olmayan(Request Body) bir istek gönderir. Genellikle sunucuda bir kaynak mevcut mu veya kaynağın en son güncellenme bilgisi için kullanılır.</p><p><strong>OPTİONS:</strong> Sunucunun desteklediği metotları kontrol etmek için kullanılır.</p><p><strong>TRACE:</strong> Bu metod ile bir sunucuya istek gönderdiğinizde, aradaki tüm vekil sunucular (Proxy, Gateway) isteğin başlığına kendi IP veya DNS biglilerini eklerler. Genellikle hata ayıklama/bakım işleri için kullanılır.</p><p>Yukarıdaki örnek requestte bulunulan object <strong>/somedir/page.html</strong> dir. Bu örnekte browser HTTP/1.1 versiyonunu kullanıyor.</p><p><strong>Header satırları;</strong></p><p><strong>Host: </strong><a href="http://www.someschool.edu/"><strong>www.someschool.edu:</strong></a> Objectin bulunduğu hostu belirtir.</p><p><strong>connection: close : </strong>Browser, sunucuya kalıcı bağlantılarla uğraşmak istemediğini söylüyor; istenen nesneyi gönderdikten sonra sunucunun bağlantıyı kapatmasını ister.</p><p><strong>User-Agent: </strong>Sunucuya istekte bulunan Browser türünü belirtir. Burada user-agent bir Firefox browserı olan Mozilla/5.0&#39;dır. Bu Header satırı faydalıdır çünkü server aslında aynı objectin farklı sürümlerini farklı türde user-agentlerına gönderebilir.</p><p><strong>Accept-language: </strong>başlık, sunucuda böyle bir nesne varsa, kullanıcının nesnenin Fransızca bir sürümünü almayı tercih ettiğini belirtir; aksi takdirde, sunucu varsayılan sürümünü göndermelidir.</p><p>Yukarıdaki örneği inceledikten sonra şimdi http requestin genel formatına bakalım.</p><p>ancak, başlık satırlarından (ve ek satır başı ve satır beslemesinden) sonra bir “entity body” vardır. Entity body, GET yöntemiyle boştur, ancak POST yöntemiyle kullanılır. Bir HTTP clientı, kullanıcı bir formu doldurduğunda (örneğin, bir kullanıcı bir arama motoruna arama sözcükleri yazdığında) genellikle POST yöntemini kullanır. Bir POST mesajıyla, kullanıcı hala bir serverdaki Web sayfasına istekte bulunuyor. Ancak Web sayfasının belirli içeriği kullanıcının form alanıne ne girdiğine bağlı. Eğer method değeri POST ise entitiy body kullanıcının girmiş olduğu değereleri barındırır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*Kry4k2RZXAcNwOHnkC7gCA.png" /></figure><p>HTML formları genellikle GET yöntemini kullanır ve girilen verileri (form alanlarında) istenen URL’ye dahil eder. Örneğin, bir form GET yöntemini kullanıyorsa, iki tane alana sahipse ve iki alana girişler monkeys ve bananas ise, URL şöyle bir yapıya sahip olacaktır. <a href="http://www.somesite.com/animalsearch?monkeys&amp;bananas"><strong>www.somesite.com/animalsearch?monkeys&amp;bananas</strong></a>.</p><p>Şimdi HTTP Response mesajını inceleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*NRW5KQB6vJH3lWmPwbE4hw.png" /></figure><p><strong>Durum</strong> satırında 3 farklı bölüm görüyoruz. 6 tane Header satırı ve son olarak entitiy body yi görüyoruz. Durum satırında üç alan vardır: protokol sürüm alanı, durum kodu ve ilgili durum mesajı.</p><p>Bu örnekte durum satırı, sunucunun HTTP/1.1 kullandığını ve her şeyin yolunda olduğunu (yani, sunucunun istenen nesneyi bulduğunu ve gönderdiğini) gösterir.</p><p>Header satırlarına bir göz atalım.</p><p><strong>Connection:close : </strong>Server burada clinet’a mesajı gönderdikten sonra TCP bağlantısını kapatacağını söylüyor.</p><p><strong>Date: </strong>HTTP yanıtının oluşturulduğu ve sunucu tarafından gönderildiği saati ve tarihi gösterir. unutmayın ki bu nesnenin oluşturulduğu veya en son değiştirildiği zaman değildir; serverın nesneyi dosya sisteminden aldığı, nesneyi yanıt mesajına eklediği ve yanıt mesajını gönderdiği zamandır.</p><p><strong>The Server: </strong>Mesajın bir Apache Web tarafından oluşturulduğunu gösterir sunucu; HTTP request mesajındaki <strong>User-agent</strong> başlık satırına benzer.</p><p><strong>Last-Modified:</strong> Üstbilgisi, nesne önbelleğe alma için kritiktir, hem</p><p>yerel istemci ve ağ önbellek sunucularında (proxy sunucuları olarak da bilinir).</p><p><strong>Content-Length:</strong> başlık satırı, gönderilen nesnedeki bayt sayısını gösterir.</p><p><strong>Content-Type:</strong> başlık satırı, varlık gövdesindeki nesnenin HTML metni olduğunu gösterir.</p><h4><strong>HTTP durum kodları</strong></h4><p><strong>1xx</strong> Bilgilendirici</p><p><strong>2xx </strong>Başarı</p><p><strong>3xx </strong>Yönlendirme</p><p><strong>4xx </strong>İstemci<strong> </strong>Hatası</p><p><strong>5xx</strong> Sunucu Hatası olduklarını temsil ederler. xx burada 00–99 arasında sayılardır.</p><p>En çok karşılaşılan kodlar aşağıdaki gibidir.</p><p><strong>HTTP Status Code 200 — OK.</strong></p><p><strong>HTTP Status Code 301 — Permanent Redirect.</strong></p><p><strong>HTTP Status Code 302 — Temporary Redirect.</strong></p><p><strong>HTTP Status Code 404 — Not Found.</strong></p><p><strong>HTTP Status Code 410 — Gone.</strong></p><p><strong>HTTP Status Code 500 — Internal Server Error.</strong></p><p><strong>HTTP Status Code 503 — Service Unavailable.</strong></p><h4><strong>HTTPS</strong></h4><p>Hypertext transfer protocol secure (HTTPS) bir web tarayıcısı ile bir web sitesi arasında veri göndermek için kullanılan birincil protokol olan HTTP’nin güvenli sürümüdür. Veri aktarımının güvenliğini artırmak için HTTPS şifrelenir. Bu, özellikle kullanıcılar bir banka hesabına, e-posta hizmetine veya sağlık sigortası sağlayıcısına giriş yapmak gibi hassas verileri iletirken önemlidir.</p><p>Herhangi bir web sitesi, özellikle oturum açma kimlik bilgileri gerektirenler, HTTPS kullanmalıdır. Chrome gibi modern web tarayıcılarında, HTTPS kullanmayan web siteleri, diğerlerinden farklı olarak işaretlenir. Web sayfasının güvenli olduğunu belirtmek için URL çubuğunda yeşil bir asma kilit arayın. Web tarayıcıları HTTPS’yi ciddiye alır; Google Chrome ve diğer tarayıcılar, HTTPS olmayan tüm web sitelerini güvenli değil olarak işaretler.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*_GwMh6hsx0Jpip03SmohRA.png" /></figure><p><strong>HTTPS nasıl çalışır?</strong></p><p>HTTPS, iletişimleri şifrelemek için bir şifreleme protokolü kullanır. Önceden Secure Sockets Layer (<strong>SSL</strong>) olarak bilinmesine rağmen, protokole Transport Layer Security (<strong>TLS</strong>) adı verilir. Bu protokol, asimetrik ortak anahtar altyapısı olarak bilinen şeyi kullanarak iletişimi güvence altına alır. Bu tür güvenlik sistemi, iki taraf arasındaki iletişimi şifrelemek için iki farklı anahtar kullanır:</p><p><strong>Private Key</strong> — Bu key, bir web sitesinin sahibi tarafından kontrol edilir ve okuyucunun tahmin ettiği gibi gizli tutulur. Bu key bir web sunucusunda bulunur ve public key tarafından şifrelenen bilgilerin şifresini çözmek için kullanılır.</p><p><strong>Public</strong> <strong>key</strong> — Bu key, sunucuyla güvenli bir şekilde etkileşim kurmak isteyen herkes tarafından kullanılabilir. Public key tarafından şifrelenen bilgilerin şifresi yalnızca private key tarafından çözülebilir.</p><p><strong>SSL nedir?</strong></p><p>SSL veya Secure Sockets Layer , şifreleme tabanlı bir İnternet güvenlik 443 portunda çalışan <strong>protokolüdür</strong>. İlk olarak 1995 yılında <strong>Netscape</strong> tarafından İnternet iletişiminde gizlilik, kimlik doğrulama ve veri bütünlüğünü sağlamak amacıyla geliştirilmiştir. SSL, günümüzde kullanılan modern <strong>TLS</strong> şifrelemesinin öncülüdür. SSL/TLS uygulayan bir web sitesinin URL’sinde “<strong>HTTP</strong>” yerine “<strong>HTTPS</strong>” bulunur.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*os3oWE05BaF1iFeJeiLW2g.png" /></figure><h4><strong>SSL/TLS nasıl çalışır?</strong></h4><ul><li>Yüksek derecede gizlilik sağlamak için SSL, web üzerinden iletilen verileri <strong>şifreler</strong>. Bunun anlamı,bu verileri ele geçirmeye çalışan herkesin yalnızca şifresini çözmesi neredeyse imkansız olan bozuk bir karakter karışımını göreceği anlamına gelir.</li><li>SSL, her iki cihazın da gerçekten iddia ettikleri kişi olduğundan emin olmak için iki iletişim cihazı arasında <strong>el sıkışma </strong>adı verilen bir kimlik doğrulama işlemi başlatır.</li><li>SSL ayrıca, veri bütünlüğünü sağlamak için verileri dijital olarak <strong>imzalar</strong> ve hedeflenen alıcıya ulaşmadan önce verilerin kurcalanmadığını doğrular.</li></ul><p>Her biri bir öncekinden daha güvenli olan birkaç SSL yinelemesi olmuştur. 1999&#39;da SSL, TLS olacak şekilde güncellendi.</p><h4><strong>SSL ve TLS aynı şeyler mi?</strong></h4><p>SSL, TLS (Transport Layer Security) adı verilen başka bir protokolün doğrudan öncülüdür. 1999&#39;da Internet Engineering Task Force (<strong>IETF</strong>) <strong>SSL</strong> için bir güncelleme önerdi. Bu güncelleme IETF tarafından geliştirildiğinden ve <strong>Netscape</strong> artık dahil olmadığı için adı <strong>TLS</strong> olarak değiştirildi. SSL’nin son sürümü (3.0) ile TLS’nin ilk sürümü arasındaki farklar çok büyük değildir; isim değişikliği, mülkiyet değişikliğini belirtmek için uygulandı.</p><p>Çok yakından ilişkili olduklarından, iki terim genellikle birbirinin yerine kullanılır ve karıştırılır. Bazı insanlar hala TLS’ye atıfta bulunmak için SSL kullanıyor, diğerleri ise <strong>“SSL/TLS şifrelemesi”</strong> terimini kullanıyor çünkü SSL hala çok fazla isim tanıma özelliğine sahip.</p><h4><strong>SSL Sertifikası nedir?</strong></h4><p>SSL yalnızca SSL sertifikasına (teknik olarak bir “TLS sertifikası”) sahip web siteleri tarafından uygulanabilir. SSL sertifikası, birinin söylediği kişi olduğunu kanıtlayan bir kimlik kartı veya rozet gibidir. SSL sertifikaları, bir web sitesinin veya uygulamanın sunucusu tarafından Web’de depolanır ve görüntülenir.</p><p>Bir SSL sertifikasındaki en önemli bilgilerden biri web sitesinin public keyidir. public key, şifrelemeyi mümkün kılar. Bir kullanıcının cihazı public key görüntüler ve bunu web sunucusuyla güvenli şifreleme anahtarları oluşturmak için kullanır. Bu arada web sunucusunun da gizli tutulan bir private key vardır; private key, public key ile şifrelenmiş verilerin şifresini çözer.</p><p>Sertifika yetkilileri (CA), SSL sertifikalarının verilmesinden sorumludur.</p><h4><strong>SSL Sertifika türleri nelerdir?</strong></h4><p>Birkaç farklı SSL sertifikası türü vardır. Bir sertifika, türüne bağlı olarak tek bir web sitesine veya birkaç web sitesine uygulanabilir:</p><ul><li><strong>Single-Domain:</strong> SSL sertifikası yalnızca bir domain için geçerlidir (“alan”, <a href="http://www.cloudflare.com/">www.cloudflare.com</a> gibi bir web sitesinin adıdır).</li><li><strong>Wildcard:</strong> bir SSL sertifikası yalnızca bir alan için geçerlidir. Ancak, o alanın alt alanlarını da içerir. Örneğin, bir wildcard sertifika <a href="http://www.cloudflare.com,/">www.cloudflare.com,</a> blog.cloudflare.com ve geliştiriciler.cloudflare.com’u kapsayabilirken, single-domain bir sertifika yalnızca ilkini kapsayabilir.</li><li><strong>Multi-Domain</strong>: Adından da anlaşılacağı gibi, çok alanlı SSL sertifikaları, birbiriyle alakasız birden çok alan adına uygulanabilir.</li></ul><p>SSL sertifikaları ayrıca farklı doğrulama seviyeleriyle gelir. Doğrulama seviyesi, arka plan kontrolü gibidir ve seviye, kontrolün eksiksizliğine bağlı olarak değişir.</p><ul><li><strong>Domain Validation:</strong> Bu, doğrulamanın en alt kat seviyesi ve en ucuzudur. Bir işletmenin yapması gereken tek şey, etki alanını kontrol ettiklerini kanıtlamaktır.</li><li><strong>Organization Validation:</strong> Bu daha uygulamalı bir süreçtir: CA, sertifikayı talep eden kişi veya işletmeyle doğrudan iletişime geçer. Bu sertifikalar kullanıcılar için daha güvenilirdir.</li><li><strong>Extended Validaton:</strong> Bu, SSL sertifikası verilmeden önce bir kuruluşun tam arka plan kontrolünü gerektirir.</li></ul><h4><strong>SSH</strong></h4><p>Secure Shell veya Secure Socket Shell olarak da bilinen SSH, kullanıcılara, özellikle sistem yöneticilerine, güvenli olmayan bir ağ üzerinden bir bilgisayara güvenli bir şekilde erişmelerini sağlayan bir ağ protokolüdür.</p><p>SSH ayrıca SSH protokolünü uygulayan yardımcı programlar paketini de ifade eder. Secure Shell, internet gibi açık bir ağ üzerinden bağlanan iki bilgisayar arasında şifreli veri iletişiminin yanı sıra <strong>güçlü</strong> <strong>parola</strong> kimlik doğrulaması ve <strong>public</strong> <strong>key</strong> kimlik doğrulaması sağlar.</p><p>Güçlü şifreleme sağlamanın yanı sıra SSH, ağ yöneticileri tarafından sistemleri ve uygulamaları uzaktan yönetmek için yaygın olarak kullanılır, bu da onların bir ağ üzerinden başka bir bilgisayarda oturum açmalarını, komutları yürütmelerini ve dosyaları bir bilgisayardan diğerine taşımalarını sağlar.</p><p>Bir SSH sunucusu, varsayılan olarak, standart Transmission Control Protocol (TCP) port <strong>22</strong>&#39;yi dinler.</p><h4><strong>SSH nasıl çalışır?</strong></h4><p>Secure Shell, Telnet, rlogin (remote login) ve rsh (remote shell) gibi güvenli olmayan terminal emulation veya login programlarının yerini almak için oluşturulmuştur. SSH aynı işlevleri etkinleştirir — uzak sistemlerde oturum açma ve terminal oturumlarını çalıştırma-. SSH ayrıca Dosya Aktarım Protokolü (FTP) ve rcp (remote copy) gibi dosya aktarım programlarının yerini alır.</p><p>SSH’nin en temel kullanımı, bir terminal oturumu için uzak bir ana bilgisayara bağlanmaktır. Bu komut aşağıdaki gibidir:</p><p><strong>ssh UserName@SSHserver.example.com</strong></p><p>Bu komut, istemcinin <strong>UserName</strong> kullanıcı kimliğini kullanarak <strong>server.example.com </strong>adlı servera bağlanmaya çalışmasına sebep olur. Local host ile server arasında ilk kez bir bağlantı oluşturulmak isteniyorsa, kullanıcıdan remote host a public key fingerprint izni istenir.</p><pre><strong>The authenticity of host &#39;sample.ssh.com&#39; cannot be established.</strong></pre><pre><strong> DSA key fingerprint is 01:23:45:67:89:ab:cd:ef:ff:fe:dc:ba:98:76:54:32:10.</strong></pre><pre><strong> Are you sure you want to continue connecting (yes/no)?</strong></pre><p>Komut istemine evet yanıtı vermek oturumun devam etmesine sağlar. ve hosy key local system’s known_hosts dosyasında saklanır. Bu, varsayılan olarak kullanıcının ana dizininde /.ssh/known_hosts adlı gizli bir dizinde depolanan gizli bir dosyadır. Host Key I bilinen_anasistemler dosyasında saklandıktan sonra, istemci sistemi herhangi bir onay gerekmeden doğrudan bu server a yeniden bağlanabilir; host key, bağlantı kimliğini doğrular.</p><h4><strong>SSH vs. SSL/TLS</strong></h4><p>Transport Layer Security (TLS) protokolü, — Secure Socekts Layer (SSL) protokolünün güncel hali- Transport katmanındaki ağ aktarımları için güvenlik sağlamak üzere tasarlanmıştır. SSH protokolü de transport katmanında veya hemen üstünde çalışır, ancak iki protokol arasında önemli farklılıklar vardır.</p><p>Her ikisi de ana bilgisayarların kimliğini doğrulamak için public/private key çiftlerine güvenirken, TLS kapsamında yalnızca serverın kimliği bir key çiftleri ile doğrulanır. SSH, her bağlantının kimliğini doğrulamak için ayrı bir key çiftlerini kullanır: local makineden remote makineye bağlantı için bir key çifti ve remote makineden local makineye bağlantının kimliğini doğrulamak için ikinci bir key çifti kullanılır.</p><p>SSH ve TLS arasındaki diğer bir fark, TLS’nin bağlantıların kimlik doğrulama olmadan şifrelenmesine veya şifreleme olmadan kimlik doğrulamasının yapılmasına olanak sağlamasıdır. SSH, tüm bağlantıları şifreler ve doğrular.</p><p>SSH, BT ve bilgi güvenliği (infosec) uzmanlarına, SSH istemcilerini uzaktan yönetmek için güvenli bir mekanizma sağlar. SSH client ve server arasında bir bağlantı başlatmak için parola doğrulaması gerektirmek yerine, SSH aygıtların kimliğini doğrular. Bu, BT personelinin uzak sistemlerle bağlantı kurmasına ve known_hosts dosyasındaki host key çiftlerini ekleme veya kaldırma dahil olmak üzere SSH yapılandırmalarını değiştirmesine olanak tanır.</p><h4>Kaynaklar</h4><p><strong><em>Book:</em></strong></p><p><strong>Computer Networking-A Top-Down Approach Seventh Edition — Kurose &amp; Ross</strong></p><p><strong><em>Websites:</em></strong></p><p><a href="https://www.cloudflare.com/learning/ssl/what-is-https/"><strong>https://www.cloudflare.com/learning/ssl/what-is-https/</strong></a></p><p><a href="https://mbilgil0.medium.com/http-metotlar%C4%B1-http-request-methods-90d57d574dfa"><strong>https://mbilgil0.medium.com/http-metotları-http-request-methods-90d57d574dfa</strong></a></p><p><a href="https://www.cloudflare.com/learning/ssl/what-is-ssl/"><strong>https://www.cloudflare.com/learning/ssl/what-is-ssl/</strong></a></p><p><a href="https://www.techtarget.com/searchsecurity/definition/Secure-Shell"><strong>https://www.techtarget.com/searchsecurity/definition/Secure-Shell</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7126392e2b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git]]></title>
            <link>https://medium.com/@yusufylmaz15/git-718e2963910?source=rss-ce940d966c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/718e2963910</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Yusuf Yılmaz]]></dc:creator>
            <pubDate>Mon, 25 Jul 2022 14:16:07 GMT</pubDate>
            <atom:updated>2022-07-25T14:16:07.924Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*U7UrL7PIs6nvfEv4m4PClw.png" /></figure><p><strong>Git Nedir?</strong></p><p>Git, Linus Torvalds tarafından Linux un çekirdeğini geliştirmek üzere tasarlanıp kullanılan bir versiyon kontrol sistemidir. bi dk o da ne demek?</p><p>Versiyon kontrol sistemleri, yazılım ekiplerinin zaman içinde yaptıkları değişikleri yönetmesine yarayan yazılım aracıdır. Yani projede yaptığınız değişikleri versiyonlama, Bu versiyonlar arasında dolaşmak için kullanılan bir yapıdır.</p><p><strong>Git i bu kadar popüler yapan şey ne peki?</strong></p><ul><li>Hızlı olması</li><li>Yüzlerce farklı branchde geliştirme ortamı sağlaması</li><li>Büyük çaplı projelerde rahatlıkla çalışması</li><li>Github gibi çok popüler bir yazılım mecrası tarafından kullanılması</li></ul><p>Git’i popüler yapan şeyler bunlar. Sende git kullanmayı öğrenmek istiyorsan hadi başlayalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*niH6ZP37J2JbZtd8q51dMg.gif" /><figcaption>wait wait wait</figcaption></figure><p>Başlamadan önce şu yapıyı öğrenirsek çok fazla işimize yarayacağına inanıyorum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*eW4fhpOAk5pn5JTd2XPTGQ.png" /></figure><p><strong>working directory</strong> e projemizin içinde olduğu klasör ortamı diyebiliriz.</p><p><strong>staging area</strong> ya ise .git directory sine atmadan önce değişikliklerimizi beklettiğimiz alan olarak düşünebiliriz.</p><p><strong>.git directory </strong>ise emin olduğumuz değişiklikleri içine atadığımız<strong>(commit)</strong> klasör diyebiliriz. daha sonra buradaki dosyalarımızı remote repolara atacağız tabi her şey burada bitmedi.</p><p>Dediğimiz gibi git bir versiyon kontrol sistemi, hangi değişikliği kim yaptı bunu takip etmek için git in <strong>config </strong>ayarlarını yapmamız gerekiyor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*WADI_bwsV4ODdGGJ9SrCkg.gif" /><figcaption>command line ımızı açıyoruz.</figcaption></figure><p>Öncelikle git bilgisayarlarınızda yüklü değilse <a href="https://git-scm.com/"><strong>bu</strong></a><strong> </strong>linkten download edip kurmanız gerekiyor.</p><h4><strong>git config</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*MixCL7g2aavDlvZjkFeF3w.png" /></figure><p>Yukarıda görüldüğü gibi git config ile email adresimizi git e söylemiş olduk.</p><p>Aynı şeyi name değişkeni içinde yapmamız lazım.</p><p><strong>git config — global user.name ‘yourname’</strong></p><h4>git init</h4><p>Bu komut artık çalıştığımız klasörün bir git tarafından takip edilebileceğini ifade eder. Bulunduğumuz klasör içine<strong> .git</strong> uzantılı gizli boş bir klasör açar(.git directory).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X15GZK1SCprUZymtFgDIEA.png" /><figcaption><strong>ls –a </strong>ile dizindeki tüm gizli ve açık içerikleri görmek istedik .<strong>git/</strong> klasörü de karşımıza çıktı.</figcaption></figure><h4><strong>git add &lt;filename&gt;</strong></h4><p>Bu komut ile WD de yapmış olduğumuz değişikleri SA ya (index) kaydederiz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xPZONL_hwuwmmW7XbAMUxA.png" /></figure><p><strong>touch </strong>komutu ile 3 adet .txt uzantılı dosya oluşturduk.Bunları index’e kaydetmek için tek tek de ekleyebilirdik ya da son satırda olduğu gibi<strong> ’ git add .’</strong> ile hepsini birden ekledik. Burada dikkat etmemiz gereken git in case sensitive olmasıdır.</p><h4><strong>.gitignore</strong></h4><p>Bu dosya hayati öneme sahip bir işlevsellik sağlıyor.bu dosya uzaktaki sunuculara yüklemek istemediğimiz dosyaların ve bilgileri mesela <strong>api keyimiz </strong>veya <strong>node modülelleri</strong> gibi dosyaların uzak sunuculara yüklenmesinin önüne geçmek için kullanılır.projemiz içinde <strong>.gitignore</strong> isimle bir file oluşturmamız, yüklenmesini istemediğimiz dosyların adını bu file içine yazmamız gerekmektedir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*WQnKKte6W3CSEseKMdOr5A.png" /><figcaption>git in artık bu dosyalar ile bir ilişkisi yok</figcaption></figure><h4><strong>git status</strong></h4><p>Bu komut ile yaptığımız değişiklerin staging area daki durumu hakkında bilgi ediniriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KSJ9_Dt3Vzv4jf6STa7pDA.png" /></figure><p>Görüldüğü gibi 3 yeni dosyayı index e eklemişim. birini silmiş diğer birini modifiye etmişim. Yukarıdaki açıklamalarda karşımıza iki öneri çıkıyor.</p><h4><strong>1.) git rm — -cached &lt;file&gt;</strong></h4><p>Komutunu kullanarak takip etmek istemediğimiz dosyayı unstage hale getirebiliriz. Eğer istersek tekrar git add komutunu kullanırız.</p><h4><strong>2.) git restore &lt;file&gt;</strong></h4><p>Komutunu kullanarak staged durumundaki dosyamızda yapmış olduğumuz değişikliği son committeki haline geri alabiliriz.</p><h4><strong>git commit</strong></h4><p><strong>git add </strong>ile WD den index e eklemiştik dosyalarımız. şimdi bu dosyaları git commit kullanarak local repoya(.git directory e) aktaracağız. Bu işleme commit etme işlemi denir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*0xfyc8jx3M_H8GtvZedRqg.png" /></figure><p><strong>-m </strong>ile commitimize mesaj özelliği ekleriz.</p><h4><strong>git log</strong></h4><p>Bu komut ile commit geçmişimize ulaşabiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zj99hDIL-jscn1vGEo_g3g.png" /><figcaption>commit işleminde yazdığımız mesaj burada gözüküyor.</figcaption></figure><p>Görüldüğü gibi commit mesajı ile birlikte commit tarihi ve commiti atan kişi hakkında bilgileri ediniyoruz. Yukarıda 3 farklı kavram ile karşılaşıyoruz.</p><p><strong>Hashcode:</strong> Her commitin uniqe bir hash değeri var ve biz bu hash değerleri ileride bahsedeceğim git’in <strong>diff</strong>, <strong>checkout</strong>, <strong>revert</strong>, <strong>reset </strong>vb. komutlarında kullanıyor olacağız.</p><p><strong>Head:</strong>Nerede olduğumuzu gösterir.Bu bize genel olarak son commiti point eder. Yani son yaptığımız değişiklik Head lable’ı ile vurgulanır.</p><p><strong>Branch: </strong>bu branchleri farklı bir çalışma klasörü olarak düşünebiliriz. Her projede birden fazla branch oluşturabilir bu branchlerde farklı yapılar geliştirebilir ve bu branchleri uygun anda (<strong>conflict </strong>olmadan) birleştirebiliriz(<strong>merge</strong>).</p><h4><strong>git branch</strong></h4><p>Komutu ile var olan branchleri görüntüleyebiliriz.</p><h4><strong>git branch &lt;branchname&gt;</strong></h4><p>Komutu ile yeni bir branch oluşturabilriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*ozwaj8zKtsVpJgXO55bV0Q.png" /></figure><h4><strong>git switch &lt;branchname&gt;</strong></h4><p>Komutu ile branchler arsında geçiş yapabiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*yC2UEFOBYUz22lHMzkSNmQ.png" /></figure><h4><strong>git branch -d &lt;branchname&gt;</strong></h4><p>Komutu ile açtığımız branchi delete edebiliriz</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*RcjzL0Y0nS4IWInHhsPrjA.png" /></figure><p>Çoğu zaman birden fazla ekip üyesi ile çalıştığımız için farklı branchte çalışırız ve bu branchleri projenin ana branchi ile birleştirmek istediğimiz zaman git merge özelliğini kullanmamız gerekir.Bu noktada çok dikkatli davranmamız gerekir. Çünkü oluşacak conflictler projemizi çöp edebilir.</p><h4><strong>Bu conflictler neler olabilir.?</strong></h4><p>Örnek olarak; master branchte açtığımız bir dosyayı feat branch inde değiştiririz ama bu dosyayı master içinde delete edersek bu bize bir conflict oluşturur. Git burada <strong>otomatik merge</strong> etme işlemini gerçekleştiremez. Bu conflicti yeni bir commit atarak düzeltebiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*59x9XQx1_ava9sA_xK3taA.png" /></figure><h4><strong>git merge</strong></h4><p>İki branchi biriyle birleştirmek için kullanılır.Eğer bir conflict yoksa merge işlemi başarılı olur.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*zZLLHuXnAv8mFjqkHDEwWA.png" /><figcaption>her harfi bir commit i her satırı bir branch i temsil eder.</figcaption></figure><p>Burada master branch de iken <strong>‘git merge feat’</strong> komutunu çalıştırısak feat branchimiz master ile birleşmiş olur ve aşağıdaki duruma gelir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/214/1*6b5gpYqIxRcT3gFasmy-Lg.png" /><figcaption>h adında bir merge commit oluştu</figcaption></figure><h4>Fast Forwad</h4><p>Yeni bir branch açıp orada commit atmaya devam edersek ve master branchinde hiçbir değişiklik yapmazsak ve eğer biz bu branchleri merge etmek istersek hiç conflict olmadan birleşecekleri için fast forwarding yapmış oluruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*jMwuYkXKKMGRV_iFchIkwA.png" /></figure><h4><strong>git stash</strong></h4><ul><li>Commit etmeye hazır olmadığımız durumlarda,</li><li>Branch değiştirmek zorunda olduğumuz durumlarda ve</li><li>Yaptığımız değişikleri kaydetmek istemediğimiz durumlarda</li></ul><p>Değişiklik yaptığımız bilginin kaybolmaması için bu komut kullanılır.Yapılan değişikleri <strong>stash </strong>adını verdiğimiz bir hafıza bölgesinde saklanır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*dFh2YUMioxKPbuq4fNEymQ.png" /></figure><h4><strong>git stash pop</strong></h4><p>Stash a eklediğimiz değişikliği geri getirmek için kullanılır.</p><h4>git stash list</h4><p>Bu komut ile stash deki tüm kayıtlarımıza erişebiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*16WSK-lvG3YiodafqowPCA.png" /></figure><h4>git stash apply</h4><p>Bu komut ile stash deki tüm kayıtlarımızı ekleyebiliriz. yada komutun sonuna stash id sini ekleyerek tek tek ekleyebiliriz.</p><h4>git stash clear</h4><p>Bu komut ile stash deki tüm kayıtlarımızı temizleyebiliriz.</p><h4>git checkout &lt;hashcode&gt;</h4><p>Daha önce git add ile yaptığımız işlemlere geri dönmeyi öğrendik. Bu kez commitlere geri dönmeyi göreceğiz.Bu komut attığımız commitlere geri dönmemizi sağlar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*0iP9pTJ7RraqId-BSLKyTw.png" /></figure><p>Checkoutun yanına dönmek istediğimiz commitin hashini yazdık ve head durumu değişti. Git burada bize <strong>detached Head</strong> durum olduğunu söylüyor ve bunu düzeltmemizi istiyor.</p><h4>Detached Head</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*R1uLTDZiNV5q3cS8vo0kmw.png" /></figure><p>Yukarıdaki şekilde görüldüğü gibi eğer biz C comitene dönersek Headimiz C yi point edecek ama D commiti bizim hala son commitimiz.</p><p>Bu durumda DH den kurtulmak için yapabileceğimiz 2 şey var.</p><p>1-master a geri dönerek bu durumu düzeltebiliriz. (git switch master)</p><p>2- yeni bir branch açıp yolumuza oradan devam edebiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/187/1*ZAej0dg1QLZ30DLg7LLk9g.png" /><figcaption>git branch feat &gt; git switch feat &gt; git add . &gt; git commit</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*OlP19sgo8i9sFq8qhdj1-A.png" /><figcaption>commit işlemlerinde geriye gitmek için bu log kayıtı takip edilmeli</figcaption></figure><h4>git reset &lt;hashcode&gt;</h4><p>Şuan 3. committeyim ve ben 2. ye dönmek istiyorum. Bu durumda=&gt; <strong>git reset</strong> geriye dönmek istediğim noktayı(yani 2.commit hasini) yazarak ikiden onceki commitleri logdan silmiş oluyorum.</p><p>Ama yaptığım değişikler hala dosyamın içinde kayıtlı halde duracak.Eğer her iki durumuda silmek istersem=&gt; <strong>git reset –-hard &lt;hashcode&gt;</strong> şeklinde kodumu çalıştırmam gerekir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*-93AMgX1vclgGASVQxgM2w.png" /><figcaption>B commitine döndüm</figcaption></figure><h4>git revert &lt;hashcode&gt;</h4><p>3 commiti geri almak istiyorum ama commit loguna karışmak istemiyorum ve üstelik aynı branchdan de devam etmek istiyorum . Bu durumda=&gt; <strong>git revert</strong> ‘geri almak istediğimiz commitin hasini (yani 3. commit hashi) ni yazarak geriye dönüp bunu yeni bir commit ile tamamlıyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*v30oDCCodtmqHBraJg0rgg.png" /><figcaption>c commitini geri aldım ama c commit kaydı silinmedi ve revert yaptığıma dair yeni bir commit oluştu.</figcaption></figure><h4>git diff</h4><ul><li>Hangi commitler arasında neleri değiştirdik,</li><li>Hangi commitler arasında ne olmuştu</li><li>Hangi branchler arasında ne olmuştu,</li><li>Working directory ve Staging area arasındaki farklar ne olmuştu gibi soruların cevabını görüntüleyebilmek için kullanılır.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*LXPgOCoIm-ZQCyYbIc91Tw.png" /><figcaption>önünde — işarerti olanalar çıkanları + olanlar ise eklenenleri temsil ediyor.</figcaption></figure><p><strong>git diff 1.hash 2. hash </strong>…. komutunu çalıştırarak commitler arasındaki farkı da görebiliriz.</p><p><strong>git diff Head</strong> ile son commite göre neleri değiştirdik onu görebiliriz.</p><h4>git rebase</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*oDjPN2-skI0oWV1MNv_orw.png" /></figure><p>Merge commitlerinden kurtulmak için kullanılan bir komuttur. repomuz yukarıdaki örnekteki gibi olmakta.</p><p>Şimdi <strong>githuba </strong>(ya da artık hangi uygulamayı kullanacaksanız) gidip orada yeni bir repo oluşturalım.</p><p>Projemize bir isim vermemiz gerekiyor ve visibility seviyesini belirlememiz gerekiyor. Burada 2 seçenek var <strong>Public </strong>ve <strong>Private</strong>. Adı üzere P<strong>ublic </strong>olanları tüm Internet kullanıcıları görüntüleyebilir. <strong>Private </strong>olanaları ise biz ve bizim izin verdiğimiz kişiler tarafından görüntülenebilir.</p><p>Ayrıca projeyi oluştururken bizden README.md uzantılı bir dosya eklmek istediğimizi sorar, bu dosya proje hakkında açıklamaları içeren bir dosyadır.</p><h4>git remote</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*Wh5THSj-uJzK5S9TEXhLMA.png" /></figure><p><strong>git remote add origin &lt;remoteUrl&gt; </strong>komutunu kullanarak artık localdeki branchlerimizi ve değişikliklerimizi uzak suncudaki bir repoya ekleyebilir,oradaki değişiklikleri locale getirebiliriz.</p><p>Burada origin kelimesi bir alias yani takma addır bizim url mizi temsil eder. push ve pull işlemlerinde kullanılır. Origin kelimesi yerine biz keyfi olarak farklı bir kelime de kullanabiliriz ama origin daha yaygın olduğu için onu kullanıyoruz.</p><h4>git push origin &lt;branchname&gt;</h4><p>Bu işlem local repodaki commitlerimizi remote repo ya transfer etmemizi sağlar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t5MMc0Nph7mqxLWcpJo5Dw.png" /><figcaption><strong>git push origin feat </strong>yaparak artık tüm değişikliklerimizi remotedaki feat branch ine aktarmış olduk.</figcaption></figure><p><strong>git branch –r</strong> ile remote daki branchlerimi görebiliriz.</p><p><strong>Pull Request</strong></p><p>Biz geliştirici olarak kendi branch imizde değikilikeler yaptık ve bunu ürünün ana branch i ile birleştirilmesini istiyoruz. githubda Pull request ya da gitlab da merge request açarak ana brnach in adminine bir talepte bulunuyoruz.Admin isterse kodları inceleyip merge edebilir veya PR ı kapatabilir.</p><p><strong><em>PR ın admin tarafından onaylandığını farz edelimi.</em></strong></p><h4>git pull /fetch</h4><p>Biz bu işlemi remote da yaptığımız için localdeki git işlemelerimiz remote dan geride kaldı. Bu durumda remote repomuz local repomuzun önüne geçmiş olacak. Bunları senkronize etmek için pull ve fetch komutlarını kullanmamız gerekiyor.</p><p><strong>Fetch: </strong>değişiklikleri locale getirip bizim görüntülememizi sağlarken.</p><p><strong>Pull: </strong>ise bu değişikilikleri hem locale getirir hem de merge işlemini gerçekleştirir.</p><h4><strong>git fetch</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/339/1*EP9S2PS6JNPJzyS2cWDlLw.png" /></figure><p>git fetch origin master dediğimde değişiklikler geliyor ama git log a baktığımızda Merge commitinin olmadığını görüyorum. Remotedaki origin master branchine Gidersem bunları görüntüleyebilirim.</p><p>Hadi gidelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*86gBs08dytmtYGYAAoXbjQ.png" /></figure><p>Öncelikle remote branchlerimizi Kontrol ediyoruz. <strong>git switch origin/master</strong> Yaptığımızda bize bunun remote bir branch olduğunu söylüyor. Şimdi checkoutun yeni kullanımını öğreniyoruz yani remote branchlere <strong>checkout </strong>ile geçmemiz lazım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*PRxtHnyMCLcy8T4wOZlq1w.png" /><figcaption><strong>git log</strong> yaparak merge commitini görüntüleyebiliriz.</figcaption></figure><h4>git pull</h4><p><strong>git pull= git fetch + git merge </strong>yani tüm değişiklikleri tamamıyla locale getirir. Bizim fetch kullanma sebebimiz bir sıkıntı var mı diye kontrol amaçlı olan bir durumdur.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*mS2GPZJhuZbm_i5pv0K8lw.png" /></figure><p>Yukarıda görüldüğü gibi pull işlemi ile remote daki değişiklikler geldi ve artık gitlab ve local imz ile senkron duruma geçiş yaptı.</p><h4>git pull — prune</h4><p>PR işleminde merge ettiğimiz branchin bir option olarak silindiğini düşünelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*xzRAggvnbaaW4a4uTfBwsw.png" /><figcaption>git branch –r yaptığımızda origin/feat branchi hala gözüküyor.</figcaption></figure><p>bunu <strong>git branch –d</strong> ile de silebiliriz. Ya da pull işlemini yaparken <strong>prune </strong>anahtar sözcüğünü kullanarak otomatik olarak fazla olan branchleri ortadan kaldırabiliriz.</p><h4>git clone</h4><p>github ı gezdik ve bir projeyi beğendik bunu localimize getirmek istiyoruz. Ya da ortak çalıştığımız bir repo var bu projeleri locale çekmek için kullanılır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*Jm4-0gOlAuEXgVFH2zdZog.png" /></figure><p><strong>git clone url </strong>şeklinde komutu çalıştırdık ve artık proje localimizde <strong>cd</strong> ile projenin içine geçebilir. Eğer bir iznimiz var ise bu projeye commit atabiliriz.</p><h4>Fork</h4><p>Projeyi beğendik. Değişiklik yapmak istiyoruz ama iznimiz yok.Yeni bir commit atmak için bu durumda projeyi <strong>fork</strong> ederek kendi repomuza kaydedebiliriz. Fork butonuna bastıktan sonar artık proje bizim repomuzda.</p><p><strong>git clone</strong> ile bunu locale getirebilir yeni commitler atabiliriz. Yeni commitleri projenin sahibine göstermek için pull/merge requestlerde bulunabiliriz. Böylelikle projede uzun yoldan katkı sağlamış oluruz.</p><h4>Issues</h4><p>Issues lar bulduğumuz buglar olabilir, yeni fikirler olabilir, ya da tartışmalar olabilir. Bunu yeni github veya gitlab üzerinden projenin issues bölümünden açarak başlatabiliriz.</p><p>Aşağıdaki Bu yazıyı hazırlarken kullandığı kaynakçalardan daha fazla ve detaylı bilgilere ulaşabilirsiniz.</p><p>Okuduğunuz için Teşekkürler.</p><p><a href="https://www.btkakademi.gov.tr/portal/course/versiyon-kontrolleri-git-ve-github-19439"></a></p><p><a href="https://git-scm.com/book/en/v2">https://git-scm.com/book/en/v2</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=718e2963910" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tmdb API sini kullanma]]></title>
            <link>https://medium.com/@yusufylmaz15/tmdb-api-sini-kullanma-1e9a69269417?source=rss-ce940d966c4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e9a69269417</guid>
            <category><![CDATA[json]]></category>
            <category><![CDATA[movies]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[tmdb]]></category>
            <category><![CDATA[js]]></category>
            <dc:creator><![CDATA[Yusuf Yılmaz]]></dc:creator>
            <pubDate>Tue, 05 Apr 2022 11:39:30 GMT</pubDate>
            <atom:updated>2022-04-05T11:39:30.658Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Tmdb API sini kullanmak</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*LwCwcK5p3lKttQBV7BUO-Q.png" /></figure><p>Merhaba, bu yazıda sizlere birlikte api kullanarak popüler filmleri listeleyen bir web sayfası tasarlayacağız. <br>Öncelikle kısaca API nedir ona bakalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K7nRo6jizsUaHdt7cvmJ-Q.png" /></figure><p>API iki uygulamanın birbiri ile veri alışverişi yapmasını, konuşmasını sağlar. Bir uygulamanın işlevselliğini başka uygulamalar tarafından kullanılmasını sağlar.<br>Telefonumuzdaki hava durumu uygulaması gibi. Hava durumu uygulaması bu bilgileri sağlayan uygulamanın server ile iletişime geçer ve bilgileri uygulama içinde gösterir.İşte bu olaya API deriz<br>ama biz web tabanlı API lere odaklanacağız.<br>Web API leri JSON yada XML formatında veriler geri döner biz bu geri dönen <br>verileri kullanarak uygulamalarımızı tasralarız.</p><p><strong>Hangi Api yi kullanacağız?</strong></p><p>Bu yazıda bir film API si kullanacağız ama sizler farklı APIler kullanmak isteyebilirsiniz. Şu github <a href="https://github.com/public-apis/public-apis">linkinden </a>kategorize edilmiş bir çok APIye erişebilirsiniz. Biz Tmdb APIsini kullanacağız. <br>Bazı APIler key istemezken bazıları key e sahip olabilirler. bizim kullanacağımız istiyor.</p><p><strong>TMDB API den key alma</strong></p><p>Tmdb APIsini kullanmak için öncelikle şu <a href="https://www.themoviedb.org/signup"><strong>linkten </strong></a>üye olmamız gerekir.<br>Daha sonra Ayarlar&gt;API ye tıklayarak key talebinde bulunalım ve sonra karşımıza developer olarak mı profesyonel olarak mı ihtiyaç duyuyoruz diye iki seçenek çıkacak. <strong>developer </strong>ı seçip şartları kabul edelim. En son olarak bizden nerede? niçin? kullanacağız gibi bilgiler isteyecek gerekli bilgileri dolduralım ve</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*ldNQ7ujhkedKY51xj8NzRw.gif" /></figure><p>artık key e sahibiz. Tmdb nin bize sağladığı bilgilerden istediklerimizi kullanarak uygulamamızı geliştirebiliriz. Buradaki <a href="https://developers.themoviedb.org/3/getting-started/introduction"><strong>linkten </strong></a><br>hangi verilere nasıl ulaşacağımızı görebiliriz.</p><p><strong>Şimdi tasarım</strong></p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=”en”&gt;<br> &lt;head&gt;<br> &lt;meta charset=”UTF-8&quot; /&gt;<br> &lt;meta http-equiv=”X-UA-Compatible” content=”IE=edge” /&gt;<br> &lt;meta name=”viewport” content=”width=device-width, initial-scale=1.0&quot; /&gt;<br> &lt;title&gt;my movie web site&lt;/title&gt;</pre><p><strong>Sitemizin güzel gözükmesi için css dosyasının yolunu belirtelim ve iconlar için cdn linkini ekleyelim</strong></p><pre>&lt;link rel=”stylesheet” href=”pop.css” /&gt;<br> &lt;link<br> rel=”stylesheet”<br> href=”<a href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.0/css/all.min.css">https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.0/css/all.min.css</a>&quot; /&gt;&lt;/head&gt;</pre><p>Tmdb verileri page (max 500)olarak gönderdiği ve her pagede de 20 film bilgisini gönderdiği için, bizim bu pageler arasında geçişimizi kolaylaştıracak butonları bodymizin içine ekleyelim. Bu butonları js tarafında manipule edeceğiz.</p><pre>&lt;body&gt;<br> &lt;div class=”control”&gt;<br> &lt;button id=”previous”&gt;&lt;i class=”fa-solid fa-angles-left”&gt;&lt;/i&gt;&lt;/button&gt;<br> &lt;div class=”images”&gt; <br> &lt;/div&gt;<br> &lt;button id=”next”&gt;&lt;i class=”fa-solid fa-angles-right”&gt;&lt;/i&gt;&lt;/button&gt;<br> &lt;/div&gt;<br> &lt;div id=”movie-details”class=”movie-details hide”&gt;<br> &lt;/div&gt; </pre><p>Fetch edeceğimiz veriler images classına sahip divin içinde olacak.</p><p>Js dosyasının yolunu belirttikten sonra js tarafına geçebiliriz.</p><pre>&lt;script src=”pop.js”&gt;&lt;/script&gt;<br> &lt;/body&gt;<br>&lt;/html&gt;</pre><p><strong>JavaScript kodları</strong></p><p>Şimdi apı keyimizi ve gerekli urlleri js dosyasına yazalım</p><pre>let page = 1;</pre><pre>const APIKEY = &quot;senin apı keyin&quot;;</pre><pre><strong>//populer filmlere ulaşacağımız url</strong><br>const URL = `https://api.themoviedb.org/3/movie/popular?api_key=${APIKEY}&amp;language=en-US&amp;page=${page}`;</pre><pre><strong>//film posterlerini gösterebilmek için gereken diğer url</strong></pre><pre>const IMGPATH = `https://image.tmdb.org/t/p/w1280/`;</pre><p><strong>Html taglerini pageleme kodlarını ekleyelim</strong></p><pre>//<strong>maniupule edeceğimiz html elementleri</strong><br>const images = document.querySelector(&quot;.images&quot;);<br>const nextBtn = document.getElementById(&quot;next&quot;);<br>const previousBtn = document.getElementById(&quot;previous&quot;);</pre><pre><em>// next page button</em></pre><pre>nextBtn.addEventListener(&quot;click&quot;, () =&gt; {<br>images.innerHTML = &quot;&quot;;<br>page++;</pre><pre>if (page &gt; 500) {<br>page = 1;<br>}</pre><pre>const URL = `https://api.themoviedb.org/3/movie/popular?api_key=${APIKEY}&amp;language=en-US&amp;page=${page}`;</pre><pre>getPopMovies(URL);<br><br>});</pre><pre>// previous page button<br>previousBtn.addEventListener(&quot;click&quot;, () =&gt; {<br>images.innerHTML = &quot;&quot;;<br>page--;</pre><pre>if (page &lt; 1) {<br>page = 500;<br>}</pre><pre>const URL = `https://api.themoviedb.org/3/movie/popular?api_key=${APIKEY}&amp;language=en-US&amp;page=${page}`;</pre><pre>getPopMovies(URL);</pre><pre>}<br>});</pre><p><strong>Şimdi url i fetch etme zamanı</strong></p><pre><em>// getting populer movies from apı<br></em>const getPopMovies = (url) =&gt; {<br>fetch(url).then(res=&gt;res.json()).then(data=&gt;{<br>showMovies(data);<br>})<br>};</pre><p>Yukarıda görüldüğü gibi url imizi <strong>fetch()</strong> komutu içine attık fetch()yöntemi, yanıt hazır olduğunda yerine getirilen bir <strong>promise </strong>döndürerek ağdan bir kaynak alma sürecini başlatır. Daha sonra gelen promise JSON formatında olmadığı için <strong>json() </strong>komutu ile onu JSON a çeviriyoruz. json() komutu bize ikinci bir promise döndürecek. Burada bu işlemeleri <strong>then() </strong>komutu ile gerçekleştiriyoruz then() gelen promise in başarılı(<strong>resolve</strong>) mı başarısız(<strong>reject</strong>) mı olduğunu belli eden bir promise göndermemizi sağlar.2. promise de başarılı ise +filmeleri ekranda göstereceğimiz ShowMovies() fonksiyonuna parametre olarak gönderiyoruz.</p><pre><em>// showing movies on body</em></pre><pre>const showMovies = (data) =&gt; {</pre><pre>if (data.results !== null) {<br>data.results.forEach((e) =&gt; {<br>const { title: t, poster_path: p, vote_average: v, release_date: d ,id:i} = e;<br>let box = document.createElement(“div”);</pre><pre>box.classList.add(“box”);</pre><pre>box.innerHTML = `<br>&lt;h1 id=”title”&gt;${t}&lt;/h1&gt;<br>&lt;button class=”savelater”&gt;&lt;i class=”fa-solid fa-bookmark”&gt;&lt;/i&gt;&lt;/button&gt;<br>&lt;img class=”all-images” src=”${IMGPATH + p}”<br>/&gt;<br>&lt;div class=”info”&gt;<br>&lt;h3 &gt;${d.slice(0, 4)}&lt;/h3&gt;<br>&lt;h3&gt;${v}&lt;/h3&gt;<br>&lt;/div&gt;<br>&lt;button class=”details up”&gt;&lt;i class=”fa-solid fa-angles-up”&gt;&lt;/i&gt;&lt;/button&gt;<br>&lt;/div&gt;<br>`;<br>})<br>images.appendChild(box);<br>});<br>}<br>};</pre><p>Önce <strong>getPopMovies()</strong> den aldığımız <strong>data </strong>parameterinin <strong>results </strong>propertyisinin null olup olmadığını kontrol ediyoruz. data.results ın içindeki verilere erişmek için foreach yapısının kullanıyoruz. verileri daha rahat erişmek için ise <strong>Object destructuring</strong> kullanarak filmin afişi,ismine,puanına ve vizyon tarihine erişiyoruz. Bu verileri create ettiğimiz divin içine <strong>innerHTML</strong> i kullanarak ekliyoruz. Önceden bahsettiğimiz imagesin içine bu html kodlarını eklemek için <strong>images.appendChild(box)</strong> diyerek verileri sayfaya ekliyoruz. Şimdi kodumuzu biraz css ile güzelleştirip son haline getirelim</p><p><strong>Sugar, spice and evreything nice</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*ZStXLtHtocGo_riT9o5HRg.gif" /></figure><p><strong>İşte sitemizin son hali</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Hoc3BEbm0IXhq1t7x2OI2A.gif" /></figure><p>Search özelliği genre filtreme vb özellikler ekleyerek daha efektif hale getirmek size kalmış:) Bu yazıda bana eşlik ettiğiniz için teşekkür eder ve iyi günler dilerim.</p><p><strong>kaynakça</strong></p><p><a href="https://developer.mozilla.org/en-US/">https://developer.mozilla.org/en-US/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e9a69269417" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>