...
Clone the UPYOG-DevOps repository using the below command:
Code Block git clone https://github.com/upyog/UPYOG-DevOps.git
Once you clone the repository, cd into UPYOG-DevOps and then checkout UPYOG-Bootcamp branch using the command:
Code Block cd UPYOG-DevOps git checkout UPYOG-Bootcamp
At this step please check if correct credentials are configured using the command:Code Block aws configure list
Please make sure that the above command shows the proper AWS credentials which you have set. Please proceed only after confirming it.
(Refer to this AWS document in case of any doubts on how to set the credentials: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html )Generate ssh key pairs (Use either method (a) or method (b)).
a. Using online website (not recommended in prod setup. To be only used for demo setups):
https://8gwifi.org/sshfunctions.jspb. Using openssl :
Code Block openssl genpkey -algorithm RSA -out private_key.pem openssl rsa -pubout -in private_key.pem -out public_key.pem
Add the public key to your github account (reference: https://www.youtube.com/watch?v=9C7_jBn9XJ0&ab_channel=AOSNote )
Open input.yaml file in vscode. You can use the below code to directly open it in VS code:
Code Block code infra-as-code/terraform/sample-aws/input.yaml
If the command does not work you can manually go and open the file in VS code. Once the file is open, fill the inputs. Please make sure the inputs that you add follow the regex mentioned in the comments for that input
(In case you are not using vscode, you can open it any editor of your choice)
Open egov-demo-secret.yaml and add DB password (line number 5), flywayPassword (line number 7) and private key. You can use the following command to open it in VS code:
Code Block code config-as-code/environments/egov-demo-secrets.yaml
Please keep the DB password and flywayPassword same. Private key has to be added inside git-sync key against ssh key (line number 37).
Next go to infra-as-code/terraform/sample-aws and run init.go script to enrich different files based on input.yaml. You can run the script using the following command:
Code Block cd infra-as-code/terraform/sample-aws go run ../scripts/init.go
Now go to remote-state folder and run terraform using the following commands. It will create a S3 bucket and DynamoDB to maintain terraform state.
Code Block cd remote-state terraform init terraform plan terraform apply
Next cd back to sample-aws folder and run terraform to provision infra for UPYOG. Use the following command:
Code Block cd .. terraform init terraform plan terraform apply
(Add the same DB password which you have added in egov-demo-secret.yaml when prompted after running terraform apply)
Execute the following command to generate a kubeConfig file and update the volumeIds, DB URL, and other relevant details in the egov-demo.yaml file.
Code Block terraform output -json | go run ../scripts/envYAMLUpdater.go
Run the export KUBECONFIG command shown on terminal. (Note: The exact command to run will be printed on terminal. It will be something like this: export KUBECONFIG=<LOCAL_KUBECONFIGPATH> )
Next step is deployment of services. Run the digit-installer.go script to install UPYOG using the following command:
Code Block cd ../../../deploy-as-code/deployer go run digit_installer.go
Once this is done you will get the CNAME of the nginx-ingress-controller using the following command:
Code Block kubectl get svc nginx-ingress-controller -n egov -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
The output of this will be the something like this:
ae210873da6ff4c03bde2ad22e18fe04-233d3411.ap-south-1.elb.amazonaws.com
You need to add it in your domain provider against your domain name.
...