https://github.com/skippednote/drupal-development-in-the-cloud
https://github.com/skippednote/drupal-development-in-the-cloud
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/skippednote/drupal-development-in-the-cloud
- Owner: skippednote
- Created: 2021-04-30T05:34:58.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-06T15:56:26.000Z (almost 5 years ago)
- Last Synced: 2024-12-30T08:11:36.431Z (over 1 year ago)
- Language: HCL
- Size: 8.79 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Drupal Development in the Cloud (AWS)
#### Generate SSH keys
```
mkdir keys
ssh-keygen -t rsa -b 4096 -C "key" -f keys/key
```
#### Create Infrastructure
```
cd terraform/instance
terraform init
terraform apply
```
#### Update the inventory files based on Terraform ouput
```
VM_IP=$(terraform output -raw ip)
// set VM_IP (terraform output -raw ip)
cd ../..
sed -i '' "s/VM_HOST/$VM_IP/" ansible/inventory/hosts.ini
```
#### Install relevant packages
```
ansible-galaxy install -r ansible/requirements.yml
ansible-playbook -i ansible/inventory/hosts.ini ansible/playbook.yml
```
#### SSH into the server
```
ssh -i keys/key ubuntu@$VM_IP
```
#### Create an AMI from the previously created instance
```
VM_ID=$(terraform output -raw instance_id)
// set VM_IP (terraform output -raw instance_id)
sed -i '' "s/SOURCE_INSTANCE_ID/$VM_ID/" terraform/ami/ami.tf
cd terraform/ami
terraform init
terraform apply
VM_AMI=$(terraform output -raw ami)
// set VM_AMI (terraform output -raw ami)
cd ../..
sed -i '' "s/ami *= \"ami-.*\"/ami=\"$VM_AMI\"/" terraform/instance/instance.tf
cd terraform/instance
terraform apply
```
#### Docker permissions
```
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
```