<?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 Prabin Karki on Medium]]></title>
        <description><![CDATA[Stories by Prabin Karki on Medium]]></description>
        <link>https://medium.com/@pkkarki18?source=rss-8f77546602a4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*655gY3Z6Jry22IeQ.jpg</url>
            <title>Stories by Prabin Karki on Medium</title>
            <link>https://medium.com/@pkkarki18?source=rss-8f77546602a4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 19:12:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pkkarki18/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[How to Install MongoDB on Ubuntu in 2025]]></title>
            <link>https://pkkarki18.medium.com/how-to-install-mongodb-on-ubuntu-in-2025-2d8249f71400?source=rss-8f77546602a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d8249f71400</guid>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[bds]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[ubuntu]]></category>
            <dc:creator><![CDATA[Prabin Karki]]></dc:creator>
            <pubDate>Fri, 04 Apr 2025 07:29:02 GMT</pubDate>
            <atom:updated>2025-04-04T07:29:02.550Z</atom:updated>
            <content:encoded><![CDATA[<p>MongoDB is a popular open-source database that stores data in documents instead of tables, making it more flexible and scalable than traditional SQL databases. Many developers prefer MongoDB because it works well with different programming languages and offers good performance.</p><p>However, installing MongoDB on Ubuntu can be tricky since it requires several commands. In this guide, we’ll show you how to install MongoDB on an Ubuntu VPS, create a new database, set up a user, and enable remote access.</p><ul><li><a href="https://www.hostinger.com/tutorials/how-to-install-mongodb-on-ubuntu/#What_Is_MongoDB">What Is MongoDB?</a></li><li><a href="https://www.hostinger.com/tutorials/how-to-install-mongodb-on-ubuntu/#How_to_Install_MongoDB_on_Ubuntu">How to Install MongoDB on Ubuntu</a></li><li><a href="https://www.hostinger.com/tutorials/how-to-install-mongodb-on-ubuntu/#1_Install_MongoDB">1. Install MongoDB</a></li><li><a href="https://www.hostinger.com/tutorials/how-to-install-mongodb-on-ubuntu/#2_Start_Your_MongoDB_Service">2. Start Your MongoDB Service</a></li><li><a href="https://www.hostinger.com/tutorials/how-to-install-mongodb-on-ubuntu/#3_Configure_MongoDB">3. Configure MongoDB</a></li><li><a href="https://www.hostinger.com/tutorials/how-to-install-mongodb-on-ubuntu/#4_Create_a_New_Database">4. Create a New Database</a></li><li><a href="https://www.hostinger.com/tutorials/how-to-install-mongodb-on-ubuntu/#5_Create_a_New_User">5. Create a New User</a></li><li><a href="https://www.hostinger.com/tutorials/how-to-install-mongodb-on-ubuntu/#6_Enable_Remote_Authentication">6. Enable Remote Authentication</a></li><li><a href="https://www.hostinger.com/tutorials/how-to-install-mongodb-on-ubuntu/#How_to_Install_MongoDB_on_Ubuntu_FAQ">How to Install MongoDB on Ubuntu FAQ</a></li><li><a href="https://www.hostinger.com/tutorials/how-to-install-mongodb-on-ubuntu/#How_to_Check_if_MongoDB_Is_Installed_Correctly">How to Check if MongoDB Is Installed Correctly?</a></li><li><a href="https://www.hostinger.com/tutorials/how-to-install-mongodb-on-ubuntu/#How_to_Uninstall_MongoDB">How to Uninstall MongoDB?</a></li><li><a href="https://www.hostinger.com/tutorials/how-to-install-mongodb-on-ubuntu/#Whats_the_Difference_Between_MongoDB_and_MongoDB_Community_Edition">What’s the Difference Between MongoDB and MongoDB Community Edition?</a></li></ul><h3>What Is MongoDB?</h3><p>MongoDB is a popular open-source database used for large-scale applications and websites. Unlike SQL, it stores data in flexible BSON documents, which makes it more scalable. MongoDB also works with different operating systems, programming languages, and frameworks.</p><h3>How to Install MongoDB on Ubuntu</h3><p>In this section, we will explain how to install MongoDB on <strong>Ubuntu 20.04</strong> or other versions. Before proceeding, ensure you have connected to your VPS via SSH using a root or superuser account</p><h3>1. Install MongoDB</h3><p>Before installing the MongoDB package, download the <strong>GnuPG</strong> and <strong>cURL</strong> utility by running this command in your command-line interface:</p><pre>sudo apt-get install -y gnupg curl</pre><p>Use cURL and GnuPG to Import the MongoDB public GPG key to retrieve the installation package:</p><pre>curl -fsSL https://pgp.mongodb.com/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor</pre><p>Note that the URL varies depending on the MongoDB packages. In this tutorial, we will install MongoDB Community Edition 7.0, the latest stable version at the time of writing.</p><p>After importing the official MongoDB packages, create a list file for installation. The command differs depending on your Ubuntu version. For <strong>Ubuntu 22.04 </strong>or later, run:</p><pre>echo &quot;deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse&quot; | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list</pre><p>Meanwhile, run the following to configure the list file on <strong>Ubuntu 20.04:</strong></p><pre>echo &quot;deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/7.0 multiverse&quot; | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list</pre><p>Refresh the APT repository to synchronize the local package database:</p><pre>sudo apt-get update</pre><p>Run the following command to install the latest stable version of MongoDB using the APT package management system:</p><pre>sudo apt-get install -y mongodb-org</pre><p>Optionally, choose a specific version of the official MongoDB-org package. For example, run the following command to install <strong>MongoDB version 7.0.2</strong>:</p><pre>sudo apt-get install -y mongodb-org=7.0.2 mongodb-org-database=7.0.2 mongodb-org-server=7.0.2 mongodb-mongosh=7.0.2 mongodb-org-mongos=7.0.2 mongodb-org-tools=7.0.2</pre><p>If you specify only the MongoDB version and not the other components, APT will install the newest package.</p><p>Since APT automatically updates the component package, pin the installation to keep the current version. Here are the command examples:</p><pre>echo &quot;mongodb-org hold&quot; | sudo dpkg --set-selections</pre><pre>echo &quot;mongodb-org-server hold&quot; | sudo dpkg --set-selections</pre><pre>echo &quot;mongodb-mongosh hold&quot; | sudo dpkg --set-selections</pre><h4>Pro Tip</h4><p>If you don’t import the public GPG key to your local package database, APT will install the unofficial MongoDB package. This might lead to compatibility, security, and legal issues, as well as a lack of support.</p><h3>2. Start Your MongoDB Service</h3><p>After the installation, run MongoDB Community Edition by entering the following:</p><pre>sudo systemctl start mongod</pre><p>The <strong>systemctl</strong> command is essential for MongoDB service management. For example, if you encounter an error, run the following to reboot running services and try starting the DBMS again:</p><pre>sudo systemctl daemon-reload</pre><p>To find out whether MongoDB database server loaded properly, check its status with this command:</p><pre>sudo systemctl status mongod</pre><p>You should see <strong>active (running) </strong>if the MongoDB service is working, similar to the following output.</p><p>By default, the service doesn’t start at boot. To automatically load it at startup, enable MongoDB using the following command. :</p><pre>sudo systemctl enable mongod</pre><p>Check the service status using <strong>systemctl</strong>. If it shows <strong>Enabled </strong>instead of <strong>Loaded</strong>, MongoDB is ready to use.</p><p>MongoDB’s primary daemon process is called <strong>mongod</strong>. It handles data requests, manages access, and runs background management operations.</p><h3>3. Configure MongoDB</h3><p>Change the MongoDB database setting by modifying the main configuration file. It is created automatically during the installation process and accessible through <strong>/etc/mongod.conf</strong>.</p><p>Use a text editor like <a href="https://www.hostinger.com/tutorials/how-to-install-and-use-nano-text-editor">nano</a> to open and modify the file. Here’s the command:</p><pre>sudo nano /etc/mongod.conf</pre><p>There are several configuration options that determine the MongoDB server behavior. For example, <strong>system Log</strong> defines your database logging settings, while <strong>net </strong>lets you modify network-related settings.</p><p><strong>Warning!</strong> Be careful when editing the <strong>MongoDB</strong> configuration file as you may break the service or expose your server to security risk.</p><p>All options have several parameters. For instance, the <strong>system Log </strong>option has the <strong>path </strong>parameter determining the default log storage location, namely <strong>/var/log/mongodb/mongod.log</strong>.</p><p>Instead of deleting the parameters and options, add a hash symbol (<strong>#</strong>) to disable them. It is a good practice since you can easily reactivate them by removing the character.</p><p>After editing the configuration file, restart MongoDB using this command to apply the changes:</p><pre>sudo systemctl restart mongod</pre><h3>4. Create a New Database</h3><p>The MongoDB installation process automatically creates the <strong>admin </strong>database. Since it is usually used for administrative purposes like storing authentication data, we recommended creating a new one.</p><p>To do so, enter the Mongo shell by running the following command:</p><pre>mongosh</pre><p>MongoDB has the same command for creating and accessing databases. If one with the specified name exists, the shell will switch to it.</p><p>For example, the following will switch you to the default database since the name exists:</p><pre>use admin</pre><p>Meanwhile, run this command in the MongoDB shell to create the<strong> customers</strong> database:</p><pre>use customers</pre><p>To check all the MongoDB databases in your system, run the following:</p><pre>show dbs</pre><h3>5. Create a New User</h3><p>Since MongoDB has no default account, you must create a new user for each database and set their privileges. You can do so using the <strong>db.createUser() </strong>function.</p><p>For example, we will create a new<strong> root</strong> MongoDB<strong> </strong>user account with full permissions. After switching to the database <strong>admin</strong> mode using the <strong>use </strong>command, enter:</p><pre>db.createUser(<br>  {<br>    user: &quot;root&quot;,<br>    pwd: &quot;P@ssword@123&quot;,   <br>    roles: [ { role: &quot;root&quot;, db: &quot;admin&quot; } ]<br>  }<br>)</pre><p>You can write the function in one or multiple lines. Remember to pay attention to the capitalization since it is case-sensitive.</p><p><strong>Important!</strong> MongoDB user management relies on databases, meaning you must run the <strong>use</strong> command before entering a function.</p><p>To show all users within your current database, use this command:</p><pre>show users</pre><p>To test the database connection, quit the MongoDB console by entering the <strong>exit</strong> command on Terminal and run the following:</p><pre>mongosh --port [port] -u [username] -p &#39;[password]&#39; &#39;[database]&#39;</pre><p>For example, we will connect to the <strong>root </strong>user using the default port of <strong>27017</strong>:</p><pre>mongosh --port 27017 -u root -p &#39;P@ssword@123&#39; &#39;admin&#39;</pre><h3>6. Enable Remote Authentication</h3><p>By default, MongoDB authorizes all logins from the host machine. While this is sufficient for local deployment, you may encounter problems when pushing an application from another device.</p><p>To access MongoDB from another system, modify the <strong>mongod.conf</strong> file’s <strong>bind-IP </strong>parameter. Its default value is the local IP address, meaning it denies access from other machines than the host server.</p><p><strong>Warning!</strong> Be careful when changing IP addresses in your MongoDB configuration file as it can make your database public, exposing your service to serious security risks.</p><p>Use<strong> nano </strong>to open the <strong>mongod</strong>.<strong>conf </strong>file and add your VPS public IP address to the <strong>bind-IP</strong> parameter, like so:</p><pre>bindIP: 127.0.0.1,123.123.12.1</pre><p>We don’t recommend changing the value to<strong> 0.0.0.0</strong> since allowing all systems’ IP addresses to connect will expose your server to cyber attacks.</p><p>To ensure only permissive users can access your database, enable authentication by adding the following line under the <strong>security </strong>section:</p><pre>authorization: enabled</pre><p>Ensure you have removed the hash symbol at the beginning of the <strong>security </strong>option:</p><pre>sudo systemctl restart mongod</pre><p>After installing the Mongo utility in your local system, you should be able to connect to the database server by running this command syntax:</p><pre>mongo &quot;mongodb://user:password@ip:port/?authSource=database_name&quot;</pre><pre>mongo &quot;mongodb://root:P@ssword@123@123.123.1.1:27017/?authSource=admin&quot;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d8249f71400" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is EdgeDB?]]></title>
            <link>https://pkkarki18.medium.com/what-is-edgedb-fd48fc8c1586?source=rss-8f77546602a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd48fc8c1586</guid>
            <category><![CDATA[relational-databases]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[edgedb]]></category>
            <dc:creator><![CDATA[Prabin Karki]]></dc:creator>
            <pubDate>Sun, 16 Jul 2023 06:56:39 GMT</pubDate>
            <atom:updated>2023-07-16T06:56:39.423Z</atom:updated>
            <content:encoded><![CDATA[<p>EdgeDB is a modern, open-source relational database management system (RDBMS) designed to address the complexities of data modeling, query languages, and schema management in the database landscape. It stands out as a novel solution that combines the best aspects of traditional relational databases with the flexibility of NoSQL databases, making it an innovative choice for developers, data engineers, and businesses alike.</p><h4>Key Features and Significance of edgedb:</h4><blockquote>Schema-First Approach: EdgeDB takes a “schema-first” approach, where data models are defined upfront using a powerful type system. This approach ensures data consistency and reduces the likelihood of data anomalies or errors. By focusing on the schema from the beginning, developers can build robust applications with well-defined data structures.</blockquote><blockquote>EdgeQL: The Heart of EdgeDB: One of the standout features of EdgeDB is its sophisticated query language, EdgeQL. It’s a purpose-built language for EdgeDB that provides a developer-friendly and expressive way to interact with the database. EdgeQL is designed to be intuitive, allowing users to work efficiently with complex data models while avoiding the complexity often associated with SQL.</blockquote><blockquote>Object-Relational Mapping (ORM) Simplified: With EdgeDB, the need for complex ORMs is minimized since it natively supports object-oriented data modeling. This simplifies the data access layer and enhances the codebase’s readability and maintainability.</blockquote><blockquote>Data Integrity and Constraints: EdgeDB enforces strong data integrity through its robust type system and constraints. It ensures that only valid data can be inserted, avoiding inconsistent or invalid records.</blockquote><blockquote>Seamless Integration: EdgeDB provides native client libraries for popular programming languages such as Python, JavaScript, and Rust. This allows developers to integrate EdgeDB into their existing tech stack effortlessly.</blockquote><blockquote>Scalability and Performance: EdgeDB is designed to scale efficiently and handle both read and write-heavy workloads effectively. Its performance characteristics and optimizations make it suitable for various use cases.</blockquote><blockquote>Modern Database Ecosystem: EdgeDB is part of the vibrant modern database ecosystem, addressing the evolving needs of developers and businesses for scalable, high-performance, and developer-friendly databases.</blockquote><blockquote>Open Source and Community-Driven: As an open-source project, EdgeDB benefits from a thriving community of contributors and users who actively contribute to its development and improvement. This fosters transparency, innovation, and continuous enhancements to the database.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yxNHfxZ2sZJcdWsuTWiosA.png" /><figcaption>edgedb architecture.</figcaption></figure><h4>Schema Design and Migrations</h4><p>Schema design and migrations are essential aspects of working with EdgeDB. EdgeDB’s “schema-first” approach allows developers to define the data model upfront, ensuring data consistency and avoiding data anomalies. Let’s delve into how schema design and migrations work in EdgeDB:</p><h4>Schema Design:</h4><blockquote>EdgeDB’s schema design is centered around the concept of “types” and “object types.”</blockquote><blockquote>Types represent data entities or concepts, such as users, products, or orders.</blockquote><blockquote>Object types define the structure of data entities and their relationships with other types.</blockquote><blockquote>Properties, links, and constraints can be defined within object types to enforce data integrity.</blockquote><h4>Edgedb Schema Migration:</h4><blockquote>EdgeQL, EdgeDB’s expressive query language, is tightly integrated with schema design and migrations.</blockquote><blockquote>When you make schema changes, EdgeDB automatically updates the EdgeQL queries affected by those changes.</blockquote><blockquote>This seamless integration ensures that your application’s queries remain compatible with the evolving schema.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F_IUSPBm2xEA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D_IUSPBm2xEA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F_IUSPBm2xEA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e0d3ddf560600a9dfc875be29f944dc/href">https://medium.com/media/3e0d3ddf560600a9dfc875be29f944dc/href</a></iframe><p><strong><em>for migration edge-db do not need any other extra tools or service it has it’s own migration and migrate service.</em></strong></p><h4>Some of common command for edgedb is give below:</h4><blockquote>edgedb server start: Starts the EdgeDB server.</blockquote><blockquote>edgedb server stop: Stops the EdgeDB server.</blockquote><blockquote>edgedb server restart: Restarts the EdgeDB server.</blockquote><blockquote>edgedb server status: Displays the status of the EdgeDB server.</blockquote><blockquote>edgedb migration create: Creates a new database migration.</blockquote><blockquote>edgedb migration list: Lists all available migrations.</blockquote><blockquote>edgedb migration status: Shows the current migration status.</blockquote><blockquote>edgedb migration apply: Applies pending migrations to the database.</blockquote><blockquote>edgedb migration revert: Reverts the last applied migration.</blockquote><blockquote>edgedb migrate: Alias for edgedb migration apply.</blockquote><blockquote>edgedb shell: Opens the EdgeDB shell to interact with the database using EdgeQL queries.</blockquote><blockquote>edgedb query: Executes an EdgeQL query from the command line.</blockquote><blockquote>edgedb generate-schema: Generates an SDL schema file based on the current database schema.</blockquote><blockquote>edgedb generate-migrations: Generates new migrations based on the current schema changes.</blockquote><blockquote>edgedb upgrade: Upgrades the EdgeDB instance to the latest available version.</blockquote><blockquote>edgedb service create: Creates a new EdgeDB instance (service) on the EdgeDB Cloud.</blockquote><blockquote>edgedb service list: Lists all EdgeDB instances (services) available on the EdgeDB Cloud.</blockquote><blockquote>edgedb service delete: Deletes an existing EdgeDB instance (service) from the EdgeDB Cloud.</blockquote><h3>Edgedb with a python:</h3><p>EdgeDB is a modern and developer-friendly database that provides excellent integration with Python through its native client library. When using EdgeDB with Python, developers can take advantage of its powerful features, such as schema-first design, object-oriented data modeling, and the expressive EdgeQL query language.</p><p>The EdgeDB Python client library allows Python applications to connect to the EdgeDB server, execute EdgeQL queries, and process query results effortlessly. This seamless integration simplifies data management, enhances productivity, and ensures data consistency.</p><p><strong>To use EdgeDB with Python, you typically follow these steps:</strong></p><blockquote>Install the EdgeDB Python Client: You can install the EdgeDB Python client library using pip:</blockquote><blockquote>pip install edged</blockquote><blockquote>Connect to the EdgeDB Server: In your Python code, you can establish a connection to the EdgeDB server using the client library. You’ll need to provide the necessary connection parameters, such as the database URL, username, and password.</blockquote><blockquote>Execute EdgeQL Queries: Once connected, you can use the client library to execute EdgeQL queries and interact with the EdgeDB database. The client library provides functions to send queries and receive query results.</blockquote><blockquote>Process Query Results: The results of the EdgeQL queries are returned as Python data structures, such as dictionaries or lists, depending on the query response.</blockquote><h3>Why edge-db instead of other database?</h3><p>EdgeDB is preferred over other databases for its schema-first approach, integrated EdgeQL query language, object-oriented data modeling, horizontal scalability, and strong data integrity, making it easier to work with complex data, improve query performance, and ensure data consistency.</p><h3>summary:</h3><p>EdgeDB’s significance lies in its ability to simplify data modeling, provide an expressive query language, and offer seamless integration with modern programming languages. It bridges the gap between relational and NoSQL databases, offering a novel solution for building robust, scalable, and maintainable applications. As the database landscape continues to evolve, EdgeDB stands as a promising contender in reshaping how developers interact with and manage their data.</p><blockquote>Reference:</blockquote><blockquote><a href="https://www.edgedb.com/docs">edgedbdocs</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd48fc8c1586" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Vault and How to implement it??]]></title>
            <link>https://pkkarki18.medium.com/what-is-vault-and-how-to-implement-it-b8b753a2ec67?source=rss-8f77546602a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8b753a2ec67</guid>
            <category><![CDATA[vault]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[hashicorp-vault]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Prabin Karki]]></dc:creator>
            <pubDate>Sat, 08 Jul 2023 13:15:51 GMT</pubDate>
            <atom:updated>2023-08-09T07:16:35.105Z</atom:updated>
            <content:encoded><![CDATA[<p>While developing software, I am trying to store my valuable or sensitive items in a secure place to prevent easy access by unauthorized individuals. I could potentially store them in a .env file, a Git variable, or some other location, but these methods can be easily accessed by others. So, I have been searching for a suitable solution, and guess what? I discovered a vault!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*9dNt8LX1mAsUrQ6wthzs3w.png" /></figure><h3>What is Vault??</h3><p>A vault is essentially a highly secure storage space that is built to protect valuable or sensitive items. You can think of it as a specially designed room or container with strong walls, doors, and various security measures in place to prevent unauthorized access.Vault is a widely used open-source tool for securely managing secrets and sensitive data in modern software environments. It provides a secure storage and management solution for credentials, API keys, passwords, certificates, and other types of sensitive information.</p><p><strong>Vault offers various features to enhance security, such as:</strong></p><blockquote>&gt;. Secrets Management: Vault provides a secure API and command-line interface to manage secrets, allowing users and applications to store, retrieve, and delete secrets programmatically.</blockquote><blockquote>&gt;. Dynamic Secrets: Vault can generate short-lived credentials on-demand for different systems and services. This approach reduces the risk of long-lived secrets being compromised.</blockquote><blockquote>&gt;. Encryption as a Service: Vault offers encryption and decryption capabilities, enabling applications to encrypt data without directly accessing encryption keys. This helps to enforce separation of duties and enhances security.</blockquote><blockquote>&gt;. Access Control: Vault provides fine-grained access control mechanisms, allowing administrators to define policies and permissions for different users, applications, or systems. This ensures that only authorized entities can access specific secrets.</blockquote><blockquote>&gt;. Audit Logging: Vault maintains a detailed audit log of all actions performed on secrets, including read, write, and delete operations. This enables compliance with regulatory requirements and helps with security incident investigations.</blockquote><blockquote>&gt;. Integration with Cloud Providers: Vault integrates with various cloud providers, allowing seamless integration with their native secrets management services and enhancing overall security in cloud environments.</blockquote><h3><strong>Vault Implementation?</strong></h3><p>In Python Vault can be implement using a hashicorp in following way?</p><h4>Installation</h4><pre>pip install hvac</pre><p><em>If you would like to be able to return parsed HCL data as a Python dict for methods that support it:</em></p><pre>pip install &quot;hvac[parser]&quot;</pre><pre>client = hvac.Client(<br>   url=os.getenv(&quot;VAULT_URL&quot;),<br>)<br># Login with username and password<br>client.auth.userpass.login(<br>  username=os.getenv(&quot;VAULT_USER&quot;),<br>  password=os.getenv(&quot;VAULT_PASSWORD&quot;)<br>)<br> response = client.secrets.kv.read_secret_version(<br>  path=os.getenv(&quot;VAULT_ENV_PATH&quot;),<br>  mount_point=os.getenv(&quot;VAULT_SECRET_ENGINE_ENV&quot;),<br>)<br>return response<br>(response gives a items store in vau</pre><p>VAULT_URL: ( this is a domain name or IP where we host our vault)<br>VAULT_USER: user_name to access a vault<br>VAULT_PASSWORD: password to access a vault<br>VAULT_ENV_PATH: path where we store our data<br>VAULT_SECRET_ENGINE_ENV: Vault main engine path</p><blockquote><em>*note</em> <em>(We can also access a vault by token too and at first stage a vault is </em>shield<em> to </em>unshield<em> a vault we have to use our 4 token which we get while setting a vault)</em></blockquote><h4>Additional Info:</h4><p>If you are using a FASTAPI with a pydantic settings you can use a “pydantic-vault” which help you to setup your FASTAPI with pydantic Basesettings.<br>for reference go through <a href="https://pypi.org/project/pydantic-vault/">pydantic-vault</a> .</p><h3>Summary:</h3><blockquote>You can use a vault as per your need, it’s not necessary to use as i mention above, their is various method to implement it.<br>Here i have not mention how to set a vault , you can setup your vault as your need.<br><a href="https://developer.hashicorp.com/vault/docs/get-started/developer-qs">hashicorp</a><br><a href="https://github.com/nymous/pydantic-vault">pydantic-vault</a></blockquote><p>Thank you so much from <a href="https://kprabin.com.np/">prabin-karki</a> (Learn Grow &amp; Share) .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8b753a2ec67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[*args and **kwargs in Python]]></title>
            <link>https://pkkarki18.medium.com/args-and-kwargs-in-python-66908df7660c?source=rss-8f77546602a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/66908df7660c</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Prabin Karki]]></dc:creator>
            <pubDate>Sun, 23 Aug 2020 13:06:42 GMT</pubDate>
            <atom:updated>2020-08-23T13:06:42.615Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Most interview asked question is what is the differences between *args and **kwargs and how you can used these in your code.</blockquote><h3>*arg:</h3><p>The special syntax <em>*args</em> in function definitions in python is used to pass a variable number of arguments to a function. It is used to pass a non-keyworded, variable-length argument list.</p><h3><strong>Example for usage of *arg:</strong></h3><h4>def myFun(*argv):</h4><blockquote>print(type(argv))</blockquote><blockquote>for i in argv:</blockquote><blockquote>print (i)</blockquote><h4>myFun(&#39;Hello&#39;, &#39;My&#39;, &#39;Name&#39;, .&#39;&#39;is, &#39;Prabin&#39;)</h4><h3>Output: &lt;class ‘tuple’&gt; || Hello || My || Name || is || Prabin</h3><blockquote>def myFun(arg1, *argv):</blockquote><blockquote>print (&quot;First argument :&quot;, arg1)</blockquote><blockquote>for arg in argv:</blockquote><blockquote>print(arg)</blockquote><blockquote>myFun(&#39;Hello&#39;, &#39;My&#39;, &#39;Name&#39;, .&#39;&#39;is, &#39;Prabin&#39;)</blockquote><h3>Output: First argument : Hello || My || Name ||is || Prabin</h3><blockquote>With <em>*args</em>, any number of extra arguments can be tacked on to your current formal parameters (including zero extra arguments).</blockquote><h3>**kwargs</h3><p>The special syntax <em>**kwargs</em> in function definitions in python is used to pass a keyworded, variable-length argument list. We use the name <em>kwargs</em> with the double star. The reason is because the double star allows us to pass through keyword arguments</p><h3>Example for usage of **kwargs:</h3><blockquote>def myFun(**kwargs):<br> print(type(kwargs))<br> for key, value in kwargs.items(): <br> print (“%s == %s” %(key, value))</blockquote><blockquote>myFun(first =’Prabin’, last=’Karki’)</blockquote><h4>Output: &lt;class ‘dict’&gt; || first == Prabin ||<br>last == Karki</h4><blockquote>A keyword argument is where you provide a name to the variable as you pass it into the function.</blockquote><p><strong>Using *args and **kwargs in same line to call a function</strong></p><blockquote>def myFun(arg1, *args,**kwargs):<br> print (“First argument :”,arg1)<br> print(“args: “,args)<br> print(“kwargs: “,kwargs)<br>myFun(“Learn”,”Share”,”and”, “Grow”, first=”Prabin”, last=”Karki”)</blockquote><h4>Output: First argument : Learn || args: (‘Share’, ‘and’, ‘Grow’) || kwargs: {‘first’: ‘Prabin’, ‘last’: ‘Karki’}</h4><p>Thank you so much (Learn Grow &amp; Share).</p><p><a href="https://kprabin.com.np/">https://kprabin.com.np/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66908df7660c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Python and Django Apps on Heroku.]]></title>
            <link>https://pkkarki18.medium.com/deploying-python-and-django-apps-on-heroku-949bb9fa9cc9?source=rss-8f77546602a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/949bb9fa9cc9</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[django-rest-framework]]></category>
            <category><![CDATA[deploy]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[heroku]]></category>
            <dc:creator><![CDATA[Prabin Karki]]></dc:creator>
            <pubDate>Sun, 12 Jul 2020 03:35:13 GMT</pubDate>
            <atom:updated>2020-07-12T03:35:13.693Z</atom:updated>
            <content:encoded><![CDATA[<p>There are many platform to deploy your site, so that you can show your activities or work to your friend , relative, colleague and so on. One of the platform to deploy your site is Heroku.Let’s Hang on for a few more minutes to learn how it all works, so you can make the most out of Heroku.</p><h3>Things You need before you start</h3><blockquote><a href="https://signup.heroku.com/">Heroku Account(Free to create)</a>.</blockquote><blockquote>Install <a href="https://www.python.org/downloads/">Python</a> to your local machine.</blockquote><blockquote>Install PostgreSQL to your local machine.</blockquote><blockquote>Your system or machine should have git(<a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git">Install Git</a>).</blockquote><p>After installing above packages now you are ready to work for deploying your system to Heroku. To work in Heroku you need a Heroku CLI. Let’s Install it.</p><h3>Install Heroku CLI.</h3><blockquote>for ubuntu run =&gt; snap install heroko-classic</blockquote><blockquote>for arch run =&gt; pacman -S heroku-cli</blockquote><blockquote>for windows run =&gt; you can download for this <a href="https://devcenter.heroku.com/articles/heroku-cli">link</a>.</blockquote><blockquote>for mac run =&gt; brew install heroku/brew/heroku</blockquote><p>Now we are ready to use Heroku Command Line Interface (CLI). Now we can use the heroku command from our command shell.</p><h3>Use Heroku login command to log in to the Heroku CLI:</h3><blockquote>run =&gt; heroku login from your terminal.</blockquote><p>now you are login to heroku by using a command shell</p><p>now you can clone your project from git or copy a project to this directory.</p><blockquote>remember to delete a .git folder after git clone or copying a project to this directory if file exists.</blockquote><h3>Install Gunicorn</h3><p>gunicorn because heroku serve our app by using gunicorn</p><blockquote>run=&gt; pip install gunicorn</blockquote><h3>Add a Procfile in your project directory.</h3><p>Procfile is a mechanism for declaring what commands are run by your application’s dynos on the Heroku platform.</p><blockquote>add =&gt; web:gunicorn project_name.wsgi to Procfile</blockquote><blockquote>add =&gt; python manage.py migrate</blockquote><h3>Install Django Heroku.</h3><p>This is a Django library for Heroku applications that ensures a seamless deployment and development experience.</p><blockquote>run =&gt; pip install django-heroku</blockquote><p>now you have to import some library to django setting.py.</p><blockquote>import django-heroku to top</blockquote><blockquote>django_heroku.settings(locals())</blockquote><h3>Now you have to create a Heroku App.</h3><blockquote>run =&gt; heroku create app_name</blockquote><p>app_name can be any but domain name will be prefer to used.</p><h3>Now last one is to push your code to Heroku.</h3><blockquote>run =&gt; git init</blockquote><blockquote>run =&gt; git add .</blockquote><blockquote>run =&gt; git commit</blockquote><blockquote>run =&gt; heroku git:remote -a app_name</blockquote><blockquote>run =&gt; git push heroku master</blockquote><h4>Now your site is deploy to heroku you can see your site in <a href="https://hotelmiracle.herokuapp.com/">https://app_name.herokuapp.com/</a> .</h4><p>Note: Above all code or action do not support for dynamic media file , you have to work by your self for this or i will soon post another blog related to this.</p><p>Thank you so much (Learn Grow &amp; Share).</p><p><a href="https://kprabin.com.np/">https://kprabin.com.np/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=949bb9fa9cc9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Setup WordPress in Arch Manjaro Linux]]></title>
            <link>https://pkkarki18.medium.com/how-to-setup-wordpress-in-arch-manjaro-linux-b05c488ee0a1?source=rss-8f77546602a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/b05c488ee0a1</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[arch]]></category>
            <category><![CDATA[apache]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[wordpress]]></category>
            <dc:creator><![CDATA[Prabin Karki]]></dc:creator>
            <pubDate>Wed, 12 Feb 2020 14:40:18 GMT</pubDate>
            <atom:updated>2020-02-12T14:40:18.092Z</atom:updated>
            <content:encoded><![CDATA[<p>To be able to run Services like WordPress following things should be setup in your Machine</p><h3><strong>Install Apache on Arch Manjaro</strong></h3><p><strong>To install a Apache on arch run </strong><br> <em>sudo pacman -S apache</em></p><p><strong>To Start a Apache on arch run</strong><br><em>sudo apachectl start <br></em>if configuration file is needed you can find it in<br>/etc/httpd/conf . We will use them to install php for Apache and MySQL for Apache.</p><h3><strong>Install PHP for Apache on Arch/Manjaro</strong></h3><p>We want to use PHP with Apache HTTP Server on our machine to be able to run services like WordPress and others locally. After we installed Apache we are now able to install and configure PHP to work with it.</p><p><strong>Install php for Apache<br></strong><em>sudo pacman -S php php-apache</em></p><p><strong>Configuration<br></strong>edit the main Apache config File /etc/httpd/conf/httpd.conf</p><p><strong>comment the line, by adding a </strong><strong>#:</strong></p><pre>#LoadModule mpm_event_module modules/mod_mpm_event.so</pre><p><strong>uncomment the line, by removing the </strong><strong>#:</strong></p><pre>LoadModule mpm_prefork_module modules/mod_mpm_prefork.so</pre><p>Place this at the end of the <strong>LoadModule</strong> list:</p><pre>LoadModule php7_module modules/libphp7.so<br>AddHandler php7-script php</pre><p>Place this at the end of the <strong>Include</strong> list:</p><pre>Include conf/extra/php7_module.conf</pre><p><strong>Restart Apache<br></strong><em>sudo apachectl restart</em></p><p>We can verify that PHP is correctly configured by creating a File <br>/srv/http/test.php and write your php simple code :<br>To see if it works we go to: http:localhost/test.php</p><h3><strong>Install MySQL for Apache on Arch/Manjaro</strong></h3><p>We want to use MySQL with Apache HTTP Server on our machine in order to run WordPress and other services like it. Since we install Apache and PHP for Apache we are now able to install MySQL and configure it to work with PHP.</p><p><strong>PHP Configurations<br></strong>Uncomment the following lines in /etc/php/php.ini, by removing the #:</p><pre>extension=pdo_mysql.so<br>extension=mysqli.so</pre><p><strong>Installation<br></strong><em>sudo pacman -S mariadb<br>sudo mysql_install_db — user=mysql — basedir=/usr — datadir=/var/lib/mysql</em></p><p><strong>Start MySQL<br></strong><em>sudo systemctl start mysqld</em></p><h3>Installing WordPress</h3><p><strong>Install the WordPress package<br></strong><em>sudo pacman -S wordpress</em></p><p><strong>Configure Apache<br></strong>Make sure that MySQL is running! if not run <br><em>sudo systemctl start mysqld</em></p><p>login as a root and create a database and give a full privileges to the required user to the created database<br>and run <strong>localhost/wordpress</strong> to browser</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b05c488ee0a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Django REST framework(DRF) APIView Implement Pagination]]></title>
            <link>https://pkkarki18.medium.com/django-rest-framework-drf-apiview-implement-pagination-266f998af08?source=rss-8f77546602a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/266f998af08</guid>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Prabin Karki]]></dc:creator>
            <pubDate>Tue, 19 Nov 2019 14:34:01 GMT</pubDate>
            <atom:updated>2019-11-19T14:34:01.863Z</atom:updated>
            <content:encoded><![CDATA[<p>Django provides a few classes that help you manage paginated data — that is, data that’s split across several pages, with “Previous/Next” links. As apiview is a Django own customize API, pagination can be done by different method.Step to be implemented for APIVIew Pagination are as follows.</p><h3>Setp 1. Import REST framework Pagination</h3><p>Django REST Framework provide three way of importing a pagination they are:</p><p><strong>PageNumberPagination</strong></p><p><strong>LimitOffsetPagination</strong></p><p><strong>CursorPagination</strong></p><p>In this case, we use <strong>LimitOffsetPagination now create a pagination.py file and set up a pagination class:</strong></p><h3>Setp 2. Setup pagination_class</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*OSxjeck3va5O057nxnpNMQ.png" /></figure><p>The <strong>LimitOffsetPagination</strong> class includes a number of attributes that may be overridden to modify the pagination style.To set these attributes you should override the <strong>LimitOffsetPagination</strong> class, and then enable your custom pagination class.Here in <strong>LimitOffsetPagination </strong>class</p><p><strong>default_limt</strong> <strong>: </strong>A numeric value indicating the limit to use if one is not provided by the client in a query parameter.</p><p><strong>max_limit : </strong>It<strong> </strong>is a numeric value indicating the maximum allowable limit that may be requested by the client.</p><h3>Setp 3. Setup APIView</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*D5XgrQp7Ih1uZnIj7azyMw.png" /></figure><p>before setup a apiview import a BasicPagination and PaginationHandlerMixin from <strong>pagination</strong></p><p>Now APIView Pagination is ready to use.</p><p><strong>Thank for watching.</strong></p><p>If you still have any issues with this implementation let me know in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=266f998af08" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>