Posts

Access and modify all the resources of our Wiki.js using WikiJS API

Image
Hi everyone 😎 , Today we are going to see how to access or modify WikiJS resources using WikiJS API. WikiJS exposes GraphQL API to access and modify the stuff according to our requirements. So In this blog post, we going to see  How to set up WikiJS's local environment using docker. How to generate an API token in Wikijs. Using API tokens how to access WikiJS resources and how to modify them. First Local Setup using docker Here I am using docker to set up my local isolated WikiJS environment. Below is my docker-compose.yml file written by WikiJS contributors. To build the WikiJS environment we just need to run the following command  docker-compose up -df  [PATH_OF_DOCKER_COMPOSE_YML_FILE] To check the environment is in a running state run the following command docker ps Second Generate API token After setup our local environment we are ready to create our initial Administrator account in our WikiJS. 1. On the browser type localhost:80 2. Create an Administrator acco...

Setup MongoDB statefulset on AWS Fargate

Image
Hi everyone I am Manshu Sharma and today we will see how can we deploy the mongoDB on AWS fargate as a  statefulset  with help of the mongoDB community operator but before we start let's have a quick overview of two important terms statefulset,   stateful application . What actually statefulset is in Kubernetes? StatefulSet is a Kubernetes resource used to manage stateful applications and It manages the scaling , ordering and uniqueness of each pod. It requires headless service and we are responsible for creating this service. What actually is stateful applications? Stateful applications are those programs that save client data from the activities of one session for use in the next session. Consider it as an ongoing periodic conversation with the same person. Some examples of stateful applications are MySQL,    MongoDB, FTP server,  Redis Cache, Kafka  and any Login service that stores client authentication data on the server, labelling clients...

How to share a custom AMI to other accounts

Image
Hi everyone πŸ™‚, I am Manshu Sharma and today we are going to discuss an interesting topic that will help us to share custom private AMI in all accounts & regions. In this post first, create a custom encrypted AMI from the public AMI, and then share the custom AMI with encrypted EBS snapshots across accounts and regions. This approach allows you to launch Amazon EC2 instances globally from multiple accounts by using the same base-encrypted AMI. Requirments We need two AWS accounts i.e SourceAccount & DestinationAccount Have a basic knowledge of AWS services SourceAccount:- In which you build a custom AMI and encrypt the associated EBS snapshots. DestinationAccount:- In which you launch instances using the shared custom AMI with encrypted snapshots. Note :- While writing this blog post I am considering two imaginary AWS account ids  111111111111   with region us-east-1 for  SourceAccount & 999999999999   with us-east-1 for DestinationAccount so be sure yo...

Min Steps To 1

Given a positive integer 'n', find and return the minimum number of steps that 'n' has to take to get reduced to 1. You can perform any one of the following 3 steps: 1.) Subtract 1 from it. (n = n - ­1) , 2.) If n is divisible by 2, divide by 2.( if n % 2 == 0, then n = n / 2 ) , 3.) If n is divisible by 3, divide by 3. (if n % 3 == 0, then n = n / 3 ). Input format : The first and the only line of input contains an integer value, 'n'. Output format : Print the minimum number of steps. Constraints : 1 <= n <= 10 ^ 6 Time Limit: 1 sec Sample Input 1 : 4 Sample Output 1 : 2 Explanation of Sample Output 1 : For n = 4 Step 1 : n = 4 / 2 = 2 Step 2 : n = 2 / 2 = 1 Sample Input 2 : 7 Sample Output 2 : 3 Explanation of Sample Output 2 : For n = 7 Step 1 : n = 7 ­- 1 = 6 Step 2 : n = 6 / 3 = 2 Step 3 : n = 2 / 2 = 1

Jenkins :- Run a remote command on all Jenkins slaves via Master

Image
Hi everyone πŸ˜€, Today I want to share a solution related to run a common command in all slave nodes via the master node in Jenkins using the Jenkins pipeline. I also faced a similar issue before where I had to run docker related commands in all nodes. The approach is simple  First, we need to define an agent in our Jenkins pipeline. Second, we need to define two stages first one for the master (optional) and the second one are for slaves. Third, we need some built-in functions jenkins.model.Jenkins.instance.getNodes() :-  Returns all Node s in the system, excluding Jenkins instance itself which represents the built-in node slave.toComputer().isOnline() :-  To check slave node is online getDisplayName() :-  To get the name of the slave node thereafter we create a user-define function and in this,  we define two loops first one for getting all names of slave nodes and the second one is to define a node-block that is capable of executing commands in the slave...

Relativity Problem Code: RELATIVE

  Read problem statements in   Bengali ,   Mandarin Chinese ,   Russian , and   Vietnamese   as well. In Chefland, the speed of light is   c   m / s , and acceleration due to gravity is   g   m / s 2 .   Find the smallest height (in meters) from which Chef should jump such that during his journey down only under the effect of gravity and independent of any air resistance, he achieves the speed of light and verifies Einstein's theory of special relativity. Assume he jumps at zero velocity and at any time, his velocity ( v ) and depth of descent ( H ) are related as v 2 = 2 ⋅ g ⋅ H . Input The first line contains an integer   T , the number of test cases. Then the test cases follow. Each test case contains a single line of input, two integers   g ,   c . Output For each test case, output in a single line the answer to the problem. We can show that under the constraints, the answer is an integer. Constraints 1 ≤ T ≤ 5 ⋅ ...

Popular posts from this blog

MySQL Multi Source Master Slave Replication using GTID

Setting Up PostgreSQL Logical Replication with Docker Compose

Regex 101: An Introduction to Regular Expressions for Developers