Caprover deployment - arashafazeli/bb-readme-tutorials GitHub Wiki
Intro
In this project we are using Caprover which is an open-source PaaS (Platform as a service) for app/database deployment and web server manager.
Participants in this group project:
- Alva Thunberg
- Arash Afazeli
- Kjell Bovin
- Ludvig Ravelin
- Bad Luck
The assignment contains of following parts
- Infrastructure as Code and Configuration Management
- Continuous Deployment showcase
Prerequisites
- Terraform and Ansible installed on local computer
- Attached Terraform file
- Attached Ansible file
Infrastructure as Code and Configuration Management
Starting up:
- Make sure you do not already have an initalized terraform by destroying everything with:
terraform destroy
- Head over to you browser and go to your Elastx page. To the left you'll find a menu section called "Project" -> "API access", in the top right corner you'll find the "Download Openstack RC file"
- Source the chas-RC file
- Head over to the openstack.tf file and change stated keypair name to your own keypair name
- Check connectivity to server:
ssh -i my_keypair ubuntu@IP
- Head over to Elastx and copy your
new assigned floating IPand paste it hosts-file in projects root directory - Change path to your SSH-keys in hosts-file
- Make the sure that the
key-fileis not too open with command
chmod 400 my_keypair
- Initialize and start Terraform:
terraform init
terraform fmt
terraform plan
terraform apply
- Run ansible playbook in projects root directory:
ansible-playbook main.yml
- If Error occurs try following on your computer
ssh-keygen -R "hostname"
Continuous Deployment showcase
CapRover Root Domain Configurations
- Open caprover webpage floatinIP:3000 (default password captain42)
- Add your caprover.domain
Enable HTTPS on CapRover webpage
- Open caprover webpage http://caprover_domain:3000 (default password captain42)
- Click enable HTTPS button
- State your mailadress
- Click force
Create a new app
- Name your app
- Click Create new app
Add remote registry in cluster
- Click cluster section on the left side
- Click cluster
- Click add remote registry
- Add Gitlab credentials
Password:Personal accesstoken
domain registry.gitlab.com/lura00/u08_breakingbad-demo/lura00:latest
image prexix lura00
- Click Add remote registry
Disable Default Push
- Click edit
- Disable push
- Choose disable push from dropdown menu
- Save and update
Adding variables:
- In Gitlab, click Settings, CI/CD and add following variables
Key : CAPROVER_URL , Value : https://captain.root.domain.com/ [replace it with your domain]
Key : CAPROVER_PASSWORD , Value : mYpAsSwOrD [replace it with your password]
Key : CAPROVER_APP , Value : my-test-gitlab-deploy [replace it with your app name]
Activate the pipeline and add to CapRover
- Trigg pipline
- The pipeline will build and push Docker container, which will be applied to Caprover
- Open caprover webpage https://caprover_domain
- Click apps
- Choose app
- Click enable HTTPS
After pipline and app is built
