From c3c09ab12280764f8d68bc311341a4baf4c9f472 Mon Sep 17 00:00:00 2001 From: Shaz hemani Date: Tue, 14 Jul 2020 19:07:51 +0500 Subject: [PATCH] migration steps and setup of apps --- Migration.md | 25 +++++++++++ Nextcloud-gitea-setup.md | 89 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 Migration.md create mode 100644 Nextcloud-gitea-setup.md diff --git a/Migration.md b/Migration.md new file mode 100644 index 0000000..2d40969 --- /dev/null +++ b/Migration.md @@ -0,0 +1,25 @@ +#Migration from one vps to other + +This migration guide covers migration of applications (Nextcloud, Gitea and Currency converter) and their data containers + +#### Lets jump right into it + +1. Firstly open inventory/filetransfer.ini file and provide source and target machine IP addresses +2. Now set variables in playbooks/backup_restore.yml file + ````yaml + vars: + current_user: hemani (User should exist in both target & source machines) + ansible_ssh_keyfile_path: + key_file_name: + ```` +3. Now Run Following command on target machine + ``` + * $ansible-playbook -i inventory/inventory.ini playbooks/docker-playbook.yml + * $ansible-playbook -i inventory/inventory.ini playbooks/next-cloud-playbook.yml + * $ansible-playbook -i inventory/inventory.ini playbooks/git-tea-playbook.yml + ``` +4. Finally execute back and restore play book + ``` + $ansible-playbook -i inventory/inventory.ini playbooks/backup_restore.yml -vvv + ``` + diff --git a/Nextcloud-gitea-setup.md b/Nextcloud-gitea-setup.md new file mode 100644 index 0000000..535feb8 --- /dev/null +++ b/Nextcloud-gitea-setup.md @@ -0,0 +1,89 @@ + +# Install Nextcloud and Gitea + +This guide will assist you to quickly configure ansible project, for deployment of Nexcloud (NC) and Gitea(GT). + +**During deployment of applications following actions will be done** + +* Docker / Docker compose will be installed. +* Installation of NC +* Configuration of NC +* Installation of GT +* Configuration of GT +* OS hardening will be done (Devsec and fail2ban configs). +* Nginx setup +* Reverse proxy setup +* Lets encrypt setuo +* Opening of upstreams on nginx + + +#### Steps to configure and execute playbook + +1. Change Internal IP address in following files + * Go to roles -> next-cloud -> defaults -> main.yml, Provide internal ip address of VPS at following field + ```` + service: + ip: 192.168.0.0 + port: 9080 + ```` + * Go to roles -> git-tea -> defaults -> main.yml + ```` + internal_ip: 192.168.0.0 + ```` + * Go to playbooks -> nginx-playbook.yml + ```` + nginx_revproxy_sites: + drive.smarticlelabs.com: + domains: + - drive.smarticlelabs.com + upstreams: + - { backend_address: 192.168.0.0, backend_port: 9080 } + ```` + ```` + source.smarticlelabs.com: + domains: + - source.smarticlelabs.com + upstreams: + - { backend_address: 10.0.0.2, backend_port: 3000 } + ```` + 2. Now you need to provide domain and sub domain + * Go to playbooks -> nginx-playbook.yml + ```` + nginx_revproxy_sites: + subdomain.yourdomain.com: + domains: + - subdoamin.yourdomain.com + ```` + ```` + subdomaintwo.yourdomain.com: + domains: + - subdomaintwo.yourdomain.com + ```` + * Go to roles -> next-cloud -> defaults -> main.yml + ```` + next_cloud_domain: https://subdoamin.yourdomain.com + ```` + * Go to roles -> git-tea -> defaults -> main.yml + ```` + app: + domain: subdomaintwo.yourdomain.com + name : SmarticleLabs + mode : prod + disable_ssh : false + http_port : 3000 + root_url : https://subdomaintwo.yourdomain.com + ```` + 3. Now you need to provide your VPS external/public ip and ssh key path in inventory, So to do that + * Navigate to inventory -> inventory.ini file + * provide external/public ip + * provide path to your ssh public key + + 4. Finally you need to run following playbooks in suggested order + * $ansible-playbook -i inventory/inventory.ini playbooks/docker-playbook.yml + * $ansible-playbook -i inventory/inventory.ini playbooks/next-cloud-playbook.yml + * $ansible-playbook -i inventory/inventory.ini playbooks/git-tea-playbook.yml + * $ansible-playbook -i inventory/inventory.ini playbooks/os-hardening.yml + * $ansible-playbook -i inventory/inventory.ini playbooks/nginx-playbook.yml + + 5. And you are done ;-) Wait for few mins, let `nginx-playbook` issue ssl certificate and register against your domain. +