Category: Blog

  • nextjs-project

    This is a Next.js project bootstrapped with create-next-app.

    Getting Started

    First, run the development server:

    npm run dev
    # or
    yarn dev
    # or
    pnpm dev

    Open http://localhost:3000 with your browser to see the result.

    You can start editing the page by modifying pages/index.tsx. The page auto-updates as you edit the file.

    API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.ts,

    The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

    This project uses next/font to automatically optimize and load Inter, a custom Google Font.

    Learn More

    To learn more about Next.js, take a look at the following resources:

    You can check out the Next.js GitHub repository – your feedback and contributions are welcome!

    Deploy on Vercel

    The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

    Check out our Next.js deployment documentation for more details.

    Visit original content creator repository
    https://github.com/M-Orziboyev/nextjs-project

  • react-audio-tracks

    Summary

    • A light-weight solution to manage audio tracks and captions in front-end web projects.
    • Provides handy custom react hooks to listen to audio tracks’ state and captions.

    Demo

    Demo source code

    Example

    Initialize the main class RATM (React Audio Track Manager) with parameters.

    import { RATM } from "react-audio-tracks"
    import Subtitles from "./Subtitles.json"
    
    RATM.initialize({
      debug: true,
      subtitlesJSON: Subtitles,
      trackLength: 3,
      masterVolume: 0.7,
      defaultAudioOptions: {
        locale: "fr",
      },
      fallbackLocale: "fr",
      supportedLocales: ["en", "fr", "ko"],
    })
    
    //recommended settings for tracks
    RATM.updateAllTracks({ autoPlay: true, allowDuplicates: true })

    Example using the custom react hook

    import React, { useEffect, useRef } from "react"
    import {
      RATM,
      useAudiotracks,
      useTrackStream,
    } from "react-audio-tracks"
    
    const TestScreen = () => {
      // listen to the global state
      const state = useAudiotracks()
    
      // listen to the individual track stream state of the track index #0
      const [stream, trackInstance] = useTrackStream(0)
      const audioRef = useRef<Array<HTMLAudioElement | null>>([])
    
      useEffect(() => {
        if (state) {
          const { tracks, masterVolume, globalMuted, ...rest } = state
          // state of every tracks
          tracks.forEach((track, idx) => {
            const { queue, isPlaying, volume, muted } = track
            // same thing as `trackInstance.getState()`
            console.log(
              `Track [${idx}] - volume: ${volume} muted: ${muted} is ${
                isPlaying ? "playing" : "not playing"
              }`
            )
          })
        }
      }, [state])
    
      useEffect(() => {
        if (stream) {
          const { caption, audioItemState, innerAudioState } = stream
          if (caption) {
            console.log(`Track [#0] is displaying caption: ${caption.text}`)
          }
          const currentAudioState = audioItemState
          // same thing as `trackInstance?.getCurrentAudio()`
    
          const nextAudioState = trackInstance?.getNextAudio()
          // state of the AudioItem class
          if (currentAudioState) {
            const { src, filename, paused, ended, started } = currentAudioState
            console.log(
              `Track [#0] is currently playing audio item state ${JSON.stringify(
                currentAudioState
              )}`
            )
          }
          if (nextAudioState) {
            const { src, filename, paused, ended, started } = nextAudioState
            console.log(
              `Track [#0]'s current audio item state ${JSON.stringify(
                nextAudioState
              )}`
            )
          }
          // state of the inner HTMLAudioElement
          if (innerAudioState) {
            console.log(
              `Track [#0]'s inner HTMLAudioElement state ${JSON.stringify(
                innerAudioState
              )}`
            )
          }
        }
      }, [stream])
    
      const loopAudioOnTrack0 = () => {
        RATM.purgeTrack(0)
        RATM.registerAudio("/audios/drumline1.mp3", {
          trackIdx: 0,
          onPlay: () => {
            console.log("Drumline part 1 started")
          },
          onEnd: () => {
            console.log("Drumline part 1 ended")
          },
        })
        RATM.registerAudio("/audios/drumline2.mp3", {
          trackIdx: 0,
          loop: true,
          onPlay: () => {
            console.log("Drumline part 2 started")
          },
        })
      }
    
      const playAudioOnTrack1 = () => {
        RATM.registerAudio("/audios/bassline1.mp3", {
          trackIdx: 1,
          onEnd: () => {
            console.log("Bassline ended")
          },
        })
      }
    
      const playWithoutTrack = () => {
        // not assigning any tracks
        const audio: HTMLAudioElement = RATM.playAudio(
          "/audios/guitar1.mp3",
          {
            onEnd: () => {
              audioRef.current[0] = null
            },
          }
        )
        audioRef.current[0] = audio
      }
    
      const pauseTrack = () => {
        trackInstance?.togglePlay(false)
      }
    
      const resumeTrack = () => {
        trackInstance?.resumeTrack()
      }
    
      const playTrack = () => {
        trackInstance?.togglePlay(true)
      }
    
      const togglePlayTrack = () => {
        trackInstance?.togglePlay()
      }
    
      const stopGuitar = () => {
        // will stop the audio and leave it to the garbage collector to clean up.
        if (audioRef.current[0]) {
          audioRef.current[0].dispatchEvent(new Event("ended"))
        }
      }
    
      const changemasterVolume = RATM.setMasterVolume
    
      return <></>
    }

    Maintenance

    I am using changeset to make versioning easier.

    pnpm changeset

    How it’s made

    pnpm add react
    pnpm add -D typescript tsup @types/react @changesets/cli
    git init
    pnpm run lint
    pnpm run build
    pnpm changeset init

    License

    React-audio-track is licensed under the MIT License.

    Visit original content creator repository
    https://github.com/andy-leezard/react-audio-tracks

  • client-events

    Common Module for Event-driven Architecture

    Supports commands and events (CQRS).

    Overview

    This package serves as a shared library for all message interfaces, commands and events in the system. It ensures consistency and correctness while implementing the event data model across Applications, Microservices, Aggregators and various programming languages.

    How it works

    Client’s event data model is exported as command and event enums, and message interfaces, to enable easy lookup of the available identifiers in the system.

    import { Commands, Events } from "@devpie/client-events";
    
    console.log(Commands.EnableAccounting);
    // EnableAccounting
    
    console.log(Events.MembershipAdded);
    // MembershipAdded

    Existing interfaces allow us to type check the message body being sent, ensuring correctness of implementation.

    export interface MembershipAddedEvent {
      id: string;
      type: Events.MembershipAdded;
      metadata: Metadata;
      data: {
        MemberId: string;
        TeamId: string;
        UserId: string;
        Role: string;
        Created: string;
      };
    }

    Messaging

    Messaging systems allow Microservices to exchange messages without coupling them together. Some Microservices emit messages, while others listen to the messages they subscribe to.

    A message is a generic term for data that could be either a command or an event. Commands are messages that trigger something to happen (in the future). Events are messages that notify listeners about something that has happened (in the past). Publishers send commands or events without knowing the consumers that may be listening.

    Language Support

    This package is written in TypeScript but converted to language targets. Each supported language has its own package.

    Supported languages include:

    Development

    Modify src/events.ts, the source of truth, then re-build to update all packages.

    npm run build
    

    Release

    Here’s the steps to perform a manual release for Typescript and Go packages (needs to be automated). Publishing Go modules relies on git tags. https://blog.golang.org/publishing-go-modules

    # 1. npm run build
    # 2. update ./package.json version
    # 3. commit changes to git
    # 4. create a new tag for release
    git tag v0.0.1
    # 5. push new tag
    git push origin v0.0.1
    # 6. push changes to remote repository
    git push origin main
    # 7. publish npm module
    npm publish

    Visit original content creator repository
    https://github.com/ivorscott/client-events

  • kubectl

    kubectl

    And. That. Is. It.

    Adding new versions

    1. Add new versions workflow will create a PR,
    2. A CODEOWNER will need to review and approve the PR,
    3. Upon review, the Validate PR workflow will run to meet merge requirements,
    4. The PR can be merged after all checks pass,
    5. Once merged, the Publish Images workflow will run:
      • Validates versions file,
      • Prebuild information collection,
      • Image’s built with docker buildx action,
      • CPU arch specific tags published

    Merging PRs & Image Releases

    Before a PR can be merged it must be:

    • Reviewed and Approved by at least 1 user assigned in CODEOWNERS,
    • passing the Check kubectl release versions action.

    Digging Deeper

    The source for the versions to create the images is in versions.txt.
    This file is maintained by the scheduled add-new-veresions.yml workflow which automatically looks up new versions and creates a pull request.
    Additionally, you can manually add entries to it or manually run the GitHub Actions workflow to create an automatic PR on-demand.

    Scripts live in the ./scripts directory:

    • add-new-versions.sh: Checks GitHub releases for kubernetes/kubernetes with a version regex, checks if the image already exists, and if not, adds it to versions.txt.
    • check-versions.sh: Checks if the binaries exists for all architectures for versions in versions.txt.
    • new-versions.sh: Compares versions in versions.txt to filter out new versions into new-versions.txt temp file. (Based on existing image versions defined by $EXISTING_VERSIONS env variable.)

    License

    Copyright © 2020 – 2023 SUSE LLC

    Licensed under the Apache License, Version 2.0 (the “License”);
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0
    

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an “AS IS” BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

    Visit original content creator repository
    https://github.com/rancher/kubectl

  • awesome-vulkan

    Awesome Vulkan Awesome

    Vulkan demo scene

    A curated list of awesome Vulkan libraries, debuggers and resources. Inspired by awesome-opengl and other awesome-… stuff.

    Hardware Support

    SDK

    Document

    Tutorial

    Apps

    Samples

    Libraries

    • 2D

      • imgui – Immediate Mode Graphical User interface. [MIT]
      • Skia – Google’s 2D graphics library has a Vulkan backend, demonstrated in a cross-platform sample application with its own window library. [BSD 3-clause] website
      • VKVG – Vulkan 2D graphics library, API follows the same pattern as Cairo graphics lib, but with new functions.
    • Compute

      • libvc – Vulkan Compute for C++. [LICENSE]
      • Vulkan Kompute – Blazing fast and lightweight Vulkan Compute Framework optimized for advanced GPU processing usecases. [Apache License 2.0]
      • ncnn – High-performance neural network inference framework with Vulkan based GPU inference. [BSD 3-clause]
      • vuh – Vulkan-based C++ GPGPU computing framework. [MIT]
      • VkFFT – Efficient Vulkan FFT library [MPL-2.0 License]
    • Low Level

      • Vulkan Memory Allocator – Easy to integrate Vulkan memory allocation library from AMD. [MIT]
      • Fossilize – serialization format for various persistent Vulkan object types. [MIT]
      • vk-bootstrap – C++ utility library to jump start Vulkan development by automating instance, physical device, device, and swapchain creation. [MIT]
      • Google’s vulkan-cpp-library – Vulkan abstraction library using C++11 for memory, resource management, type and thread safety as well as system independency. [Apache]
      • FrameGraph – Vulkan abstraction layer that represent frame as a task graph. [BSD 2-clause]
      • V-EZ – light-weight middleware layer for the Vulkan API targeting Professional Workstation ISVs. [MIT]
      • Vookoo – Vookoo is a set of dependency-free utilities to assist in the construction and updating of Vulkan graphics data structres. [MIT]
      • vpp – Modern C++ Vulkan Abstraction focused on performance and a straightforward interface. [MIT]
      • VulkanSceneGraph – Vulkan/C++17 scene graph project, successor to OpenSceneGraph.
      • Vulkan-WSIWindow – Multi-platform library to create a Vulkan window, and handle input events. [Apache License 2.0]
      • Screen 13 – An easy-to-use Vulkan render graph for Rust. [MIT]
    • Frameworks, Engines, Higher Level Rendering

      • Acid – A high speed C++17 Vulkan game engine. [MIT]
      • AMD’s Anvil – cross-platform framework for Vulkan. [LICENSE]
      • Auto-Vk – Vulkan convenience and productivity layer for modern C++, atop Vulkan-Hpp, by the Research Unit of Computer Graphics, TU Wien. [MIT]
      • Auto-Vk-Toolkit – C++ framework around Auto-Vk for rapid prototyping, research, and teaching, by the Research Unit of Computer Graphics, TU Wien. [MIT for the framework’s code]
      • bgfx – Cross-platform, graphics API agnostic, “Bring Your Own Engine/Framework” style rendering library. [BSD-2-clause]
      • bsf – Modern C++14 library for the development of real-time graphical applications. [MIT]
      • Cinder and the story behind. [BSD]
      • DemoFramework – NXP GTEC C++11 cross-platform demo framework including lots of samples for Vulkan, OpenGL ES, OpenVX, OpenCL, OpenVG and OpenCV. [BSD-3-clause]
      • Diligent Engine – a modern cross-platform low-level graphics library that supports OpenGL/GLES, Direct3D11/12 and Vulkan. [Apache License 2.0]
      • Falcor – Real-time rendering framework from NVIDIA, supporting mainly DX12, with experimental Vulkan support. [BSD 3-clause]
      • glfw and the guide. [LICENSE]
      • Intrinsic Engine – Intrinsic is a Vulkan based cross-platform graphics and game engine. [Apache License 2.0]
      • Introductory Vulkan sample by GPUOpen. [MIT]
      • liblava – A modern C++ and easy-to-use framework. [MIT]
      • Logi – Light-weight object oriented Vulkan abstraction framework. [BSD 2-clause]
      • Lugdunum – Modern cross-platform 3D rendering engine built with Vulkan and modern C++14. [MIT]
      • openFrameworks – the most famouse C++ creative coding framework. [MIT]
      • PowerVR SDK – C++ cross-platform 3D graphics SDK to speed up development of Vulkan and GLES. [LICENSE]
      • Pumex – cross-platform Vulkan renderer implementing frame graph and simple scene graph. Able to render on many surfaces at once [MIT]
      • SDL – added cross-platform Vulkan graphics support in SDL_vulkan.h. [zlib]
      • small3d, Tiny Vulkan based C++ cross-platform game development framework [BSD 3-clause]
      • Spectrum – Work-in-progress framework and abstraction layer around Vulkan.
      • Tephra – A modern C++17 graphics and compute library filling the gap between Vulkan and high-level APIs like OpenGL. [MIT]
      • The-Forge – DirectX 12, Vulkan, macOS Metal 2 rendering framework. [Apache License 2.0]
      • VKFS – Cross-platform easy-to-use C++ framework that allows you to quickly initialize Vulkan and get a ready-made environment. Provides high-level abstraction over basic Vulkan objects.
      • Vulkan Launchpad – Vulkan framework for Windows, macOS, and Linux. Especially well-suited for Vulkan beginners, used in university education, by the Research Unit of Computer Graphics, TU Wien. [MIT]
    • Other API Interop and Implementations

      • visor – Vulkan Ignoble Software Rasterizer. [MIT]
      • VulkanOnD3D12 – Vulkan API for D3D12. [Apache License 2.0]
      • rostkatze – C++ implementation of Vulkan sitting on D3D12 🐈[Apache License 2.0]
      • VK9 – Direct3D 9 compatibility layer using Vulkan
      • VUDA – header-only lib that provides a CUDA Runtime API interface. [MIT]
      • clspv – prototype compiler for a subset of OpenCL C to Vulkan compute shaders. [Apache License 2.0]
      • MoltenVK – run Vulkan on iOS and macOS. [Apache-2.0]
      • Zink – OpenGL implementation on top of Vulkan, part of Mesa project. [MIT]
      • glo / OpenGL Overload – OpenGL implementation on top of Vulkan.
      • gfx-portability – Vulkan Portability implementation on Metal and D3D12, based on gfx-rs.
    • Raytracing

      • Quartz – Physically based Vulkan RTX path tracer with a declarative ES7-like scene description language. [LGPL-3.0]
    • Scientific

      • datoviz – High-performance GPU interactive scientific data visualization with Vulkan. [MIT]
      • iMSTK – C++ toolkit for building surgical simulations with Vulkan and VTK backends. [Apache License 2.0]
    • Shaders

      • glslang – Library for compiling glsl to spirv [BSD 3-Clause]
      • SPIRV-Cross – Library for reflection of spirv, simplify the creation of Vulkan pipeline layouts [ Apache-2.0 License]
    • Outdated ⚠️

    Bindings

    • ash – Vulkan bindings for Rust. [MIT]
    • gfx-rs – A low-overhead Vulkan-like GPU API for Rust. [Apache License 2.0]
    • libvulkan.lua – Lua bindings for Vulkan.
    • dvulkan – Auto-generated D bindings for Vulkan.
    • ErupteD – Another Auto-generated D bindings for Vulkan.
    • flextGL – Minimal Vulkan header/loader generator and the blog post about it.
    • Silk.NET – C# bindings for Vulkan and others. [MIT]
    • vulkan – Haskell bindings for Vulkan and Vulkan Memory Allocator [BSD-3-Clause]
    • nvk – JavaScript bindings for Vulkan. [MIT]
    • racket-vulkan – Racket bindings for Vulkan with detailed implementation notes. [MIT]
    • Vulkan-hpp Open-Source Vulkan C++ API originated from NVIDIA and the blog about it.
    • VulkanSharp – C# bindings for Vulkan. [MIT]
    • Vulkano – Safe and rich Rust wrapper around the Vulkan API. [MIT]
    • LWJGL – Lightweight Java Game Library 3 has Vulkan bindings. [BSD]
    • SharpVk – C# bindings for Vulkan with Linq-to-SPIR-V & NuGet package. [MIT]
    • vulkan – Ultimate Python bindings for Vulkan generated with CFFI. [Apache Licence 2.0]
    • vulkan-go – Go bindings for Vulkan. [MIT]
    • PasVulkan – Vulkan bindings plus high-level wrapper library for Object Pascal [Zlib]
    • vulkan-zig – Vulkan binding generator for Zig [MIT]
    • VK², Kotlin Wrapper for Vulkan: code expressiveness and safety meet graphic power [Apache License 2.0]
    • Vortice.Vulkan – .NET Standard 2.0 and .NET5 C# bindings [MIT]
    • Raw Node.js Vulkan API – A new Vulkan bindings for Node.JS, similar with LWJGL-3 or NVK.
    • Deno Vulkan – Vulkan API bindings for Deno. [Apache Licence 2.0]

    Tools

    • Nsight™ Visual Studio Edition 5.2+.
    • LoaderAndValidationLayers – from KhronosGroup. [Apache Licence 2.0]
    • renderdoc – by baldurk, a stand-alone graphics debugging tool. [MIT]
      • RDCtoVkCpp – converts RenderDoc Vulkan capture to compilable and executable C++ code. [MIT]
    • VulkanTools – LunarG’s tools including layers and configurator. [Apache Licence 2.0]
    • VKtracer – universal and easy-to-use profiler for Vulkan.
    • CodeXL – CodeXL goes open source. [MIT]
    • Qualcomm Adreno GPU Tools – samples, Adreno recommendation layer, best practice docs for Adreno GPU.
    • Qualcomm Snapdragon Profiler – includes Vulkan traces and frame captures for Adreno GPU.
    • Arm Mobile Studio – includes the Arm Graphics Analyzer to trace graphics performance issues easily, and Arm Streamline performance analyzer, for a whole-system view of performance to determine bottlenecks quickly across both the CPU and GPU.
    • Open Capture and Analytics Tool (OCAT) – provides an FPS overlay and performance measurement for D3D11, D3D12, and Vulkan. [MIT]
    • gapid – Graphics API Debugger, can trace and replay Android OpenGL ES and Vulkan applications. [Apache License 2.0]
    • Arm – PerfDoc – a validation layer against the Mali Application Developer Best Practices document. [MIT]
    • glsl_trace – library for shader debugging and profiling for Vulkan and OpenGL. [MIT]
    • MangoHud – Vulkan and OpenGL overlay for monitoring FPS, temperatures, CPU/GPU load. [MIT]

    Books

    Papers

    Khronos

    Community

    Related lists

    • awesome – Curated list of awesome lists.
    • awesome-opengl – Curated list of awesome OpenGL libraries, debuggers and resources.
    • gamedev – Awesome list about game development.
    • graphics-resources – List of graphic programming resources.
    • awesome-d3d12 – Curated list of awesome D3D12 libraries, debuggers and resources.

    License

    Creative Commons License

    This work is licensed under a Creative Commons Attribution 4.0 International License.

    Contributing

    Please see CONTRIBUTING for details.

    Visit original content creator repository https://github.com/vinjn/awesome-vulkan
  • angular-nf-pwa-ssr

    AngularNfPwaSsr

    This project was generated with Angular CLI version 18.2.6.
    It’s an angular native federatio with PWA and SSR enabled

    Development server

    Run ng serve for a dev server. Navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.

    Code scaffolding

    Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

    Build

    Run ng build to build the project. The build artifacts will be stored in the dist/ directory.

    Running unit tests

    Run ng test to execute the unit tests via Karma.

    Running end-to-end tests

    Run ng e2e to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.

    Further help

    To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

    Run on a local server

    • shell: npx servor dist\shell\browser index.html 4200 --browse
    • remote: npx servor dist\remote\browser index.html 4201 --browse
    • remote 2: npx servor dist\remote2\browser index.html 4202 --browse

    Visit original content creator repository
    https://github.com/AhmadAlMunajjed/angular-nf-pwa-ssr

  • dailyge-infra



    Dailyge Infra 저장소 입니다.
    서비스 소개는 해당 링크를 참조해주세요. 😃

    Release Release
    Release


    Table of Contents.

    1. Skills
    2. CI/CD
    3. Architecture
    4. Contents
    5. Modules


    1. Skills.

    서비스 구축을 위해 AWS를 활용했으며, Terraform을 사용해 자원을 프로비저닝 했습니다. Terraform으로 관리되는 자원은 Route53, CloudFront, S3, ALB, ECS, EC2(Application), RD 이며, 일부 자원들은 설치형으로 사용하고 있습니다. 모니터링은 Prometheus와 Grafana를 사용하고 있으며, 운영 및 시스템 로그는 모두 AWS CloudWatch로 관리하고 있습니다.

    image

    운영 과정에서 발생하는 이슈는 Grafana Alert 또는 AWS Lambda를 통해 슬랙으로 보고받고 있으며, Lambda와 같은 일부 서비스는 Python을 사용 중입니다.


    2. CI/CD

    PR이 생성되면 자동으로 정적 분석을 시작하며, Slack으로 결과를 보고받습니다. 팀원 간 코드 리뷰를 거친 후, dev 브랜치로 병합이 되면 개발 서버로 배포가 되며, 인수 테스트가 시작됩니다. 자동 인수 테스트 외에도 QA를 진행하며 기능의 동작 유무, 버그 리포팅을 합니다. main 브랜치로 병합이 되면 상용 서버로 배포가 되며, 최종 결과를 보고받습니다.

    image


    테스트, 배포 결과 및 비용은 슬랙을 통해 확인하고 있습니다.

    image


    3. Architecture

    정적 자원은 S3와 CloudFront를, 서버 오케스트레이션은 AWS ECS를 사용했습니다. 각 리소스는 VPC 내부 별도의 서브넷(Public/Private)에 존재하며, ALB와 NAT를 통해 외부와 통신합니다. 부하 테스트를 할 때는 terraform을 통해 서버를 동적으로 확장하고 있으며, 평상시에는 최소 인스턴스만 사용하고 있습니다.

    image


    서브 도메인을 적극 활용하고 있으며, 서브 도메인 간 쿠키를 공유해 사용하고 있습니다. 개발 서버, 모니터링 서버와 같은 서브 도메인에 대한 접근은 WAF 및 Security Group으로 관리하고 있습니다.


    4. Contents

    1. Resource 관리
    2. Config 관리
    3. Server
    4. RateLimiter
    5. Monitoring
    6. Log
    7. DB 백업


    4-1. Resource 관리

    프로비저닝을 후, 변경될 일이 적은 자원 들, 데이터베이스같이 변경되어선 안 되는 자원 들은 ignore_changes를 통해 테라폼 라이프사이클에서 제외한 후, 관리하고 있습니다.

    resource "aws_cloudfront_distribution" "s3_distribution_tasks_dev" {
      
      ......
    
      lifecycle {
        ignore_changes = all
      }
    }


    4-2. Config 관리

    Git Submodule과 AWS Secret Manager를 사용해 환경 변수를 관리하고 있습니다.

    image


    외부에 노출되는 값들은 암호화된 상태로 노출됩니다.

    env:
      dev
    
    profile:
      email: ENC(EoatZjyTeks503/9neDp3JfrFlhWwAiRvlYd77599hM=)
      nickname: ENC(VA1R4pL0mo0xHTfV68j+3xQrJbffCBTb)
    
    spring:
      cloud:
        aws:
          region:
            static: ap-northeast-2
          credentials:
            access-key: ENC(5vaRGdYWZUJsFEFF5P8A06TkwwNl5eapE)
            secret-key: ENC(JdK2itnFEFDKOdRu7A7zcXmLpOZwbSEWRUwq)
      liquibase:
        enabled: true
        change-log: db/rdb/changelog/changelog-master.yaml
      datasource:
        url: ENC(qmiZS71LFX29baI8nNpBKhLlLmsJop5vaRGdYWZUJsFEFF5P8A06TkwwNl5eapyY6/vlVdD6zCLkE8qlJdK2itnMByBKOdRu7A7zcXmLpOZwbSEWRUwqGbRvspsUPEFO/sS0PAqBF25vddL6GJ11onkUFqJZ0hPJt3Qr6toHqXcTH7yZNHlrTMLb2xrPlWU)
        username: ENC(KHdUpehLSIMFEEyDjj8P/+w==)
        password: ENC(/KquPoFfhpYAFEFSsumXHPpsdkquc4M)
        driver-class-name: com.mysql.cj.jdbc.Driver
    
        ......
    


    4-3. Server

    리소스 및 오토 스케일링을 조금 더 세밀하게 제어하기 위해 Fargate 대신 EC2를 사용하고 있으며, 배포 및 포트 충돌 방지를 위해 ECS 동적 포트를 사용하고 있습니다.

    image


    4-4. RateLimiter

    Route53에서 WAF로 일정 시간 동안 최대 사용자 요청을 제한하고 있으며, 모니터링 서버, 관리자 API 등 특정 리소스에 대한 접근은 ALB와 WAF, Security Group으로 제한하고 있습니다.

    image

    평소에는 분당 1,000회 이상일 때, IP 기반으로 API 요청 제한을 걸고 있으며, 부하 테스트를 할 때, 이를 해제합니다.


    4-5. Monitoring

    모니터링은 Prometheus와 Grafana를 CloudWatch와 연동해 사용하고 있으며, 이를 통해 알림을 받고 있습니다. 모니터링 중인 리소스는 EC2 서버, 애플리케이션 지표, RDS, Redis, MongoDB이며, CPU/메모리 사용률, Slow Query 등을 체크하고 있습니다.

    image

    애플리케이션이 다운될 경우, 자동으로 힙 덤프를 생성한 후, 이를 정적 저장소로 업로드하고 알림을 보내고 있습니다.


    오토 스케일링은 CPU 사용률이 75% 이상일 때, 1분 이상 지속되면 동작합니다. 이는 CloudWatch와 연동하고 있으며, 이 부분은 테라폼이 아닌 설치형으로 관리하고 있습니다.

    resource "aws_appautoscaling_policy" "dailyge_api_scale_out_policy" {
      name               = "dailyge-api-scale-out-policy"
      policy_type        = "TargetTrackingScaling"
      resource_id        = aws_appautoscaling_target.dailyge_api_ecs_scaling_target.resource_id
      scalable_dimension = aws_appautoscaling_target.dailyge_api_ecs_scaling_target.scalable_dimension
      service_namespace  = aws_appautoscaling_target.dailyge_api_ecs_scaling_target.service_namespace
    
      target_tracking_scaling_policy_configuration {
        target_value = 75.0
    
        predefined_metric_specification {
          predefined_metric_type = "ECSServiceAverageCPUUtilization"
        }
    
        scale_in_cooldown  = 60
        scale_out_cooldown = 60
      }
    }


    4-6. Log

    당일 로그는 CloudWatch로 관리하고 있으며, 하루가 지난 로그는 S3로 전송 후, 제거하고 있습니다.

    {
        "server": "dailyge-api",
        "path": "/api/monthly-tasks",
        "method": "POST",
        "traceId": "40cfde91-c912-4f3a-9b02-d45b3c066edb",
        "ip": "127.0.0.1",
        "layer": "ENTRANCE",
        "visitor": "{ "userId":null, "role":"GUEST" }",
        "time": "2024-08-06T07:29:48.745",
        "duration": "0ms",
        "context": {
            "args": null,
            "result": null
        }
    }

    로그는 요청 경로, 메서드, IP 주소(Origin), 파라미터, 응답 시간 등을 남기고 있습니다.


    4-7. DB 백업

    데이터베이스는 매일 새벽 3시마다 스냅샷을 생성해 백업하고 있습니다.

    데이터베이스 생성 후, AWS UI를 통해 설정을 관리하고 있으며, Import를 통해 싱크를 맞추고 있습니다.


    5. Modules

    modules 내부에 개발 환경을 기준으로 파일을 구분하고 있습니다. 명시적으로 dev, prod 패키지를 나누었지만, 프로젝트 규모가 작기 때문에 dev 하나만 사용하고 있습니다.

    $ tree -L 5
    .
    ├── dev
    │   ├── graph.png
    │   ├── main.tf
    │   ├── modules
    │   │   ├── acm
    │   │   ├── cloudfront
    │   │   │   ├── main.tf
    │   │   │   ├── outputs.tf
    │   │   │   └── variables.tf
    |
    │   ......
    |
    │   ├── provider.tf
    │   └── variables.tf
    
         ......
    

    Atlantis는 별도의 서버가 필요하기 때문에, 프로젝트 규모를 고려해 사용하지 않았습니다.

    Visit original content creator repository https://github.com/dailyge/dailyge-infra
  • mktext

    mktext – An Useless Text-Processing Utility that Exploits Make Functions.

    DON’T USE IT IN PRODUCTION CODE.

    We developed mktext just to demo how to use Make functions.

    System Requirement

    • A recent sh compatible shell.
    • A recent GNU Make >= 3.81

    We tested mktext on a recent CentOS. It should work on most modern Unix-like systems.

    Usage

    mktext provides several actions in functional styles:

    • any
    • all
    • filter
    • select
    • sub
    • sort
    • first
    • last
    • nth
    • range

    any checks whether any element fits cond:

    $ ./mktext any x x y z
    true
    

    all checks whether all elements fit cond:

    $ ./mktext all x x y z
    false
    

    filter removes elements by cond:

    $ ./mktext filter "a b c" a b c d e f g
    d
    e
    f
    g
    

    select keeps elements by cond:

    $ ./mktext select "a b c" a b c d e f g
    a
    b
    c
    

    sub replaces from with to:

    $ ./mktext sub ee ea beer deer feet
    bear
    dear
    feat
    

    sort sorts elements alphabetically:

    $ ./mktext sort b d a e c
    a
    b
    c
    d
    e
    

    first returns the first element:

    $ ./mktext first a b c d e
    a
    

    last returns the last element:

    $ ./mktext last a b c d e
    e
    

    nth returns the nth element:

    $ ./mktext nth 4 a b c d e
    d
    

    range returns the elements from mth to nth, inclusively on both side:

    $ ./mktext range 2 4 a b c d e
    b
    c
    d
    

    Besides, use -h and --help to print help message:

    $ ./mktext --help
    Usage: ./mktext action ...
    
    Actions:
            all cond arg_a arg_b arg_c ...
    (Omit some message...)
    

    Philosophy

    Make functions are a small sets of LISPy functions that are greek to many programmers from C family languages. Hence, we wrote mktext to show how to (improperly) use those functions.

    make itself is unable to handle command-line arguments and several other features seen in mktext. To handle those issues, we embedded a Makefile in a shell script so that we can manage those issues with a sh compatible shell. We limit ourself in the features provided by make when possble; otherwise, we use the features available in the system shell.

    To make a more useful alternative, consider to port it in Perl or some other modern scripting language.

    Author

    Michael Chen, 2018.

    License

    MIT

    Visit original content creator repository
    https://github.com/cwchentw/mktext

  • commentary_45_Romans_English

    GospelChurch.uk Bible Commentary – Romans

    Welcome to the “GospelChurch.uk Bible Commentary” series, a comprehensive guide to understanding and studying the Bible. Our aim is to provide a valuable resource for bible teaching in churches, as well as to share our biblical material with others, both Christian and non-Christian alike. We offer this commentary series as a free resource and ask that it not be used for commercial purposes.

    Our series comprises of volumes that offer a comprehensive analysis of every book of the Bible. Each book is introduced with valuable insights on the historical context, authorship, literary genre, central themes, theological concepts, key passages, and an outline of the book. Furthermore, our introduction also sheds light on how the book relates to the rest of the Bible, providing readers with a solid foundation to comprehend the text better.

    Following the introduction, we offer commentary on each section of the book according to the book outline. Our commentary includes seven key areas: highlights, context, themes, application, sermon, devotion, and review. These sections provide readers with a comprehensive guide to each section of the book, offering insights into the meaning and significance of the text.

    We believe that our series of Bible commentary can bless the Kingdom of God, churches, and everyone who seeks to deepen their understanding of the Bible. We hope that this series will be a valuable resource for readers around the world, and we look forward to sharing our insights with all who seek to grow in their understanding and knowledge of the Word of God.

    Please refer to our license below if you are interested in incorporating our content into your own work. We offer it to you free of cost, on the condition that you give us proper credit for the work and that your use is for non-commercial purposes only. Please do not hesitate to contact us for any further inquiries. We would be grateful for the opportunity to assist you.

    Blessings,
    Eliran Wong
    Gospel Church (UK)

    License

    Creative Commons Licence
    GospelChurch.uk Bible Commentary (vol. 45) – Romans by Eliran Wong, Gospel Church (UK) is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
    Based on a work at https://github.com/BibleTools/commentary_45_Romans_English.
    Permissions beyond the scope of this license may be available at https://www.gospelchurch.uk/?lang=en.

    Table of Content

    Introduction

    Commentary on Romans 1:1-7

    Commentary on Romans 1:8-15

    Commentary on Romans 1:16-17

    Commentary on Romans 1:18-32

    Commentary on Romans 2:1-29

    Commentary on Romans 3:1-8

    Commentary on Romans 3:9-20

    Commentary on Romans 3:21-31

    Commentary on Romans 4:1-25

    Commentary on Romans 5:1-11

    Commentary on Romans 5:12-21

    Commentary on Romans 6:1-14

    Commentary on Romans 6:15-23

    Commentary on Romans 7:1-25

    Commentary on Romans 8:1-17

    Commentary on Romans 8:18-30

    Commentary on Romans 8:31-39

    Commentary on Romans 9:1-29

    Commentary on Romans 9:30-10:21

    Commentary on Romans 11:1-36

    Commentary on Romans 12:1-2

    Commentary on Romans 12:3-8

    Commentary on Romans 12:9-21

    Commentary on Romans 13:1-7

    Commentary on Romans 13:8-14

    Commentary on Romans 14:1-12

    Commentary on Romans 14:13-23

    Commentary on Romans 15:1-13

    Commentary on Romans 15:14-33

    Commentary on Romans 16:1-16

    Commentary on Romans 16:17-20

    Commentary on Romans 16:21-24

    Commentary on Romans 16:25-27

    Support Us

    Thank you for your generosity! We would be humbled and grateful if you could consider making a donation to our cause. Please find our bank details below, so you can contribute in any way that is convenient for you. Your kindness is truly appreciated.

    https://www.gospelchurch.uk/%E5%A5%89%E7%8D%BB?lang=en

    As a church, we rely on the generosity of our community to continue spreading love and positivity. By donating to our church, you are not only helping us maintain our place of worship, but you are also contributing to the betterment of society. It is undoubtedly a blessing to give, and we appreciate any amount you can offer. Please note that we can only accept donations from within the UK, so we kindly ask those outside of the UK not to send money at this time. We thank you for considering donating to our church and for being a part of our mission to make the world a better place.

    Visit original content creator repository https://github.com/BibleTools/commentary_45_Romans_English
  • dewalnay

    dewalnay.py

    Installation

    poetry install should do it. You may need to install SciPy dependencies (LAPACK, BLAS) separately.

    Synopsis

    dewalnay.py -w 1920 -h 1080 -l '#c8a2c8' -r '#8c0035' -a 30 dewalnay.png
    

    Generated image

    Command-line options

    usage: dewalnay.py [--help] [-w W] [-h H] [-n N] [-l #RRGGBB] [-r #RRGGBB]
                       [-a ANGLE] [--min-value MIN_VALUE] [--max-value MAX_VALUE]
                       [--fuzz FUZZ] [--border-pts N] [--max-force MAX_FORCE]
                       [--epsilon EPSILON]
                       [outfile]
    
    Generate a wallpaper using Delaunay triangulation
    
    positional arguments:
      outfile               the image to be written (default: 'out.png')
    
    optional arguments:
      --help                show this help message and exit
      -w W, --width W       image width in pixels (default: 1920)
      -h H, --height H      image height in pixels (default: 1080)
      -n N, --num-pts N     number of interior points (default: 50)
      -l #RRGGBB, --left-color #RRGGBB
                            hexcode for left color (default: #000000)
      -r #RRGGBB, --right-color #RRGGBB
                            hexcode for right color (default: #ffffff)
      -a ANGLE, --angle ANGLE
                            angle to rotate gradient CCW in degrees (default: 0)
      --min-value MIN_VALUE
                            minimum greyscale value (default: 15)
      --max-value MAX_VALUE
                            maximum greyscale value (default: 240)
      --fuzz FUZZ           radius of interval of possible greyscale values
                            (default: 32)
      --border-pts N        number of points added to each border line (default:
                            5)
      --max-force MAX_FORCE
                            max magnitude of net Coulomb force on a point
                            (default: 3)
      --epsilon EPSILON     Coulomb proportionality constant (default: 100000)
    
    Visit original content creator repository https://github.com/avkliskova/dewalnay