Moonglade

Modern Markdown blogging with AI-powered localization and search.

Tag: docker

RSS

Node.js backend Dockerfile example

This article introduces two Docker image build solutions based on Node.js, aiming to optimize image size and resolve environment dependency issues through layered build techniques. The first solution is designed for simple scenarios and adopts a three-stage build process: it first installs development dependencies, then executes build commands to generate artifacts, and finally integrates them into the production environment, striving to minimize the final image size. The second solution targets complex scenarios, focusing on resolving Linux graphics library dependencies required by the Canvas library, the Python runtime environment, and the installation of Chinese fonts. This solution configures domestic mirror sources to accelerate downloads and pre-installs Python and necessary system libraries in the production stage, ensuring the completeness and stability of the application runtime. Both solutions follow best practices by using multi-stage builds to isolate development, build, and production environments, effectively reducing redundant files in the final delivered image. Additionally, they ensure service availability through health check mechanisms, providing practical containerized deployment references for Node.js projects of varying complexity.

Views 145
ci-cd devops docker dockerfile fonts multistage-build node nodejs python web-service

nginx Cipher Suite Security Audit

This article documents the company's entire process of identifying and resolving HTTPS cipher suite security vulnerabilities during the Level 3 Classified Protection (MLPS Level 3) assessment. Initially, scanning with the `nmap` tool revealed the presence of insecure cipher suites. Although the Nginx configuration was optimized to disable TLS 1.2 and retain only secure suites, external access tests still indicated issues. By comparing the results of local self-testing, which showed normal behavior, with the anomalies observed from external networks, it was determined that traffic passed through other middleware before reaching Nginx. After consulting with the operations team and reviewing historical purchase records, the root cause was finally identified as an incorrectly configured TLS restriction in the Alibaba Cloud WAF. Disabling the WAF caused the issue to disappear, and the problem was subsequently resolved completely through product upgrades and proper configuration. This experience not only highlighted the importance of configuring front-end middleware in security architectures but also prompted a deep reflection on troubleshooting methodologies: one should follow a logic of narrowing down from a broad scope to a specific one, using the discrepancies between internal and external network tests to quickly locate bottlenecks, thereby avoiding blind trial-and-error. Although inefficient communication with the operations team reduced efficiency during the process, the core lesson lies in establishing clear, progressive troubleshooting thinking, transforming theoretical insights into precise technical localization, and thus efficiently resolving security risks in complex network environments.

Views 200
2023 centos cloud docker nginx security work

Lite Version MongoDB Full-Text Search

This article primarily explores technical solutions for implementing Chinese full-text search in the MongoDB Community Edition. Since the Community Edition does not natively support Chinese word segmentation engines, the author proposes a custom solution based on NestJS, Mongoose, and the `@node-rs/jieba` segmentation library. The article details the use of Docker to deploy a MongoDB environment with replica set support, ensuring service stability through a health check mechanism. In terms of architecture, the project is organized using a Monorepo pattern. By listening to database change events, Chinese text is automatically segmented and written back to the collection upon data insertion, thereby constructing a full-text index that supports Chinese retrieval. This solution not only implements basic query functionality but also covers multi-entity detection, value object handling, and a comparative analysis with Elasticsearch, providing developers with a complete technical practice reference for achieving efficient Chinese search at low cost in constrained environments.

Views 175
docker fulltext mongodb nest node search study work

Related Content to Note

This article comprehensively outlines the core technology stack required for full-stack development and operations. The frontend section covers React, Vue, ES, TS, CSS, and UI frameworks, aiming to build modern user interfaces. The backend employs Node.js with the NestJS framework for data type ORM management, integrates mainstream databases and caching technologies such as MySQL, PostgreSQL, MongoDB, and Redis, and incorporates Nginx reverse proxy, Kafka message queue, and V8 engine optimization to ensure high-concurrency processing capabilities. On the operations side, containerized deployment is implemented based on Docker and Containerd, orchestration management is handled via Kubernetes, and a robust observability system is established using Elastic Stack, APM, monitoring, and distributed tracing systems, thereby ensuring high availability and stability of services.

Views 52
2024 Backend Technologies Frontend Development docker study todo

GitLab Deployment and DingTalk Integration

This article provides a detailed walkthrough of the complete process for deploying GitLab using Docker and deeply integrating it with DingTalk. First, the article demonstrates how to start the GitLab container using Docker commands, with a focus on the port mapping strategy: mapping port 80 directly to accommodate DingTalk's SSO login redirect behavior, which ignores ports; mapping the SSH port to 7003 and providing a corresponding client configuration example; and configuring persistent storage for configuration files, logs, and data directories. Second, the article explains in depth how to configure DingTalk as an Identity Provider (IdP) to implement Single Sign-On (SSO). This includes creating an application on the DingTalk Open Platform, obtaining the AppKey and AppSecret, configuring the callback domain, and enabling OmniAuth in GitLab's `gitlab.rb` file while entering the DingTalk credentials. Additionally, the article demonstrates in detail the configuration and verification of GitLab's SMTP email service to ensure that the email binding notification feature works correctly when users log in for the first time. Finally, the article introduces how to use DingTalk group robots as Webhook receivers to synchronize GitLab events, such as pushes and merge requests, to DingTalk group chats in real time, thereby enabling automated notifications for development collaboration information.

Views 129
DingTalk SSO devops docker gitlab k8s sso

Setting up MinIO with k8s and a Quick Introduction to Its Usage

This document provides a detailed walkthrough of the complete process for deploying MinIO object storage in a local environment using Kubernetes. It begins by introducing installation methods for two lightweight K8s distributions: first, installing Minikube via binary or apt packages, configuring the Docker driver and image mirrors, and demonstrating basic operations such as creating an application, exposing a NodePort service, and port forwarding; second, installing MicroK8s using the Snap package manager, including user permission configuration, adding cluster nodes, enabling the Dashboard plugin, and generating an access token to manage the cluster via a browser. Subsequently, the document focuses on how to deploy a MinIO development environment using the `kubectl apply` command, covering checking Pod and service status, describing resource details, tracking logs, and using port-forward to forward the Web interface (9090) and console (9000) ports. It also notes that the initial account credentials need to be extracted from the logs. Finally, the article provides a Go language code example for client testing, aiming to help developers quickly set up and verify the availability of the MinIO service in a K8s environment, laying the foundation for subsequent project integration.

Views 144
Kubernetes devops docker k8s microK8s minio

Uninstalling and Installing Docker

This document records the complete process of thoroughly uninstalling and reinstalling Docker on CentOS and Ubuntu systems. First, before proceeding with any operations, it is essential to confirm that no other users are currently using the Docker service to avoid disrupting business operations. For CentOS, simply use the `yum` command to remove the relevant component packages. For Ubuntu, use `apt-get` to delete dependency packages such as `docker.io`. In the reinstallation phase, if the server has access to the external network, the most convenient approach is to directly execute the official script or add the official GPG key and repository source. If the environment is an internal network, it is recommended to configure the Tsinghua mirror source to accelerate downloads, which can be achieved by modifying environment variables or replacing the repository address. Finally, after installation is complete, start the Docker service, run the `hello-world` image, and check the `docker compose` version to verify that the installation was successful. The entire process emphasizes the importance of selecting the correct package manager commands based on the system type and flexibly switching mirror sources according to network conditions.

Views 103
Docker Compose Uninstall Docker centos devops docker ubuntu

AutoQuery Usage and Deployment (GitHub Actions)

This article introduces the rapid development workflow based on the AutoQuery framework, covering key steps from environment initialization to production deployment. First, the `x` command-line tool is installed via `dotnet tool`, and the `x new` command is used to create a Web project. `autocrudgen` is then leveraged to automatically generate SQLite database models and basic code, simplifying backend development tasks. The deployment section details how to configure Docker and Docker Compose on an Ubuntu 22.04 server, including specific commands for updating system sources, adding the official Docker GPG key, and installing the latest CE version. The article also demonstrates how to use `x mix build` to generate an Nginx proxy configuration script, upload it to the server via `scp`, and start services using `docker compose` commands, thereby implementing an automated deployment solution based on GitHub Actions. Additionally, the text provides practical details such as Let's Encrypt email configuration, SSH connection parameters, and user permission settings, aiming to help developers efficiently build and deploy AutoQuery-based applications. A link to a related video tutorial is provided at the end for further learning.

Views 78
.Net ci-cd devops docker github nginx