...
When the certificate loses its validity, it is necessary to generate a new certificate. For instances created using Terraform, you need to destroy the docker module and recreate it.
At the beginning remember to import the appropriate modules at the beginning, If you update certificates using terraform:
Code Block |
---|
terraform init
terraform import module.<Name OF SETUP>.aws_instance.app <ID OF INSTANCE>
terraform import module.<NAME OF SETUP>.aws_elb.elb <NAME OF ELB>
terraform import module.<NAME OF SETUP>.aws_db_instance.rds <NAME OF RDS INSTANCE> |
Use the following commands to set the Terraform variables:
Code Block |
---|
export TF_VAR_aws_access_key_id=$AWS_ACCESS_KEY_ID
export TF_VAR_aws_secret_access_key=$AWS_SECRET_ACCESS_KEY |
And add the right key to SSH-Agent, e.g. :
Code Block |
---|
ssh-add ~/.ssh/TestEnvDockerHost.pem |
Next, destroy the docker module and recreate it by running the following commands. Remember about setting docker_tls_force_recreate
parameter to true before you start.
...
Code Block |
---|
sudo update-ca-certificates sudo service docker restart |
Finally, remember to replace certificates on Jenkins (step 6 from this instruction).
The easiest way to regenerate certificates if the instance was created manually is to run the following command on your local machine (step 3 from this instruction):
...