Skip to main content

Posts

Showing posts from March, 2024

docker: storage and services

Docker Volume Without going through Docker, accessing files within a Docker image is not easy. Therefore, Docker has a volume feature that allows users to specify the location on the host file system to serve as the access directory for Docker. In other words, a volume is the NFS of a Docker image. Example: Using a volume to store SQLite files. ref:  SQLite for NodeJS: https://www.sqlitetutorial.net/sqlite-nodejs/ Initialize the project. # Setup ExpressJS framework express --view=pug 240324_ejs_sqlite_docker npm init npm install express npm install sqlite3 Test: npm start Initialize docker  Since the directory already contains NodeJS, the Docker Daemon will assist in the setup. Create new docker image docker build -t atfuture7/sqlite01 . Create a folder for Docker, create a container, run it.  mkdir docker_vol docker run -p 3000:3000 -v ./docker_vol:/data --name exp_sqlite atfuture7/sqlite01 After confirming that the container can run correctly, stop the container a

Docker, Virtual-Desktop and build-docker-image

Previously, my work platform involved using development, testing, and production environments. Docker is relatively new to me. As I also held a system administrator role, the characterization of Docker as "lightweight and simple" by supporters in the programming development community left me puzzled for a while. Here's a brief explanation of the differences between VMs, Docker, and Virtual Desktops as I understand them. The platforms most people commonly interact with are standalone systems, which typically include Windows, Mac, Android, and iOS. In the early Unix era, the system architecture consisted of a Host and Terminals. Terminals are lightweight systems with basic functions, which can also be seen today in devices like the Raspberry Pi. When work requires several systems to perform different tasks, having a separate hardware device for each can be wasteful. This led to the development of Hypervisor and VM (Virtual Machine) architectures. Sometimes institutions ne

Review old/new stuff: Angular 17

When I reviewed Angular recently, I discovered that it had just undergone a major revision three months ago, v17. The notes here are summaries of common features incorporated into v17. Install Angular ref: https://angular.io/guide/setup-local npm install -g @angular/cli Create new project ng new proj_name cd proj_name If the old project needs to be migrated to v17 control flow: ref: https://youtu.be/36Hcx7kRYDg?si=pmZcRkQHIlmguK3K ng generate @angular/core:control-flow Activate  ng serve Data Flow ref: https://angular.io/tutorial/first-app/first-app-lesson-09 Service can be regarded as a custom class (similar to custom modules written in expressJS) ng generate service obj_name In the sample program, enumeration of array is used. this.housingLocationList.find(housingLocation => housingLocation.id === id); The concept is  find( function(element) => { return (condition; )}) ref:  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fi

expressJS and nodeJS module

 While refreshing my skill set, I became acquainted with the ExpressJS framework. Different frameworks share similar fundamental concepts. Here, I document the development process starting from the basic initial structure. 1. Install basic expressJS project npm install express-generator express --view=jade 2403_express_sampleexpress_sample cd 2403_express_sampleexpress_sample npm install express At this point, you should have the basic structure of ExpressJS set up. Next, install Mongoose, which is used with MongoDB. npm install mongoose Conducted the first test. npm run start ( Ctrl+c to stop ) 2. Checking the ExpressJS structure 2-1. The startup file for ExpressJS. In ./package.json, find "scripts":{}. Among them, "start" records the startup file. Add another startup file: ”dev": "node ./test/loc". Then create loc.js file on the corresponding file path. This option is for testing, the way to run test:   npm run dev 2-2. Find the port

Review old stuff: mongoDB

blockquote Recently, I revisited old skills, extending to MongoDB. After reinstalling MongoDB, I felt that the website architecture had significantly changed compared to what I saw the last time I created a sample. My old sample project was a record of main characters from the Japanese anime "Demon Slayer." In just four years, from March 2020 to now, there has been a significant change in the website structure, indicating considerable improvements in MongoDB's functionality. Resource Some content has been spread out, but I find this arrangement clearer. Below are the resources I briefly looked up: community version:  https://www.mongodb.com/try/download/community-edition MongoDB shell: https://www.mongodb.com/try/download/shell Database tools:  https://www.mongodb.com/try/download/bi-connector   ( dump, restore, import, export)  NodeJS reference  (developer): https://www.mongodb.com/docs/drivers/node/current/quick-reference/ mongosh manual:  https://www.mongodb.com/docs