This repository contains Terraform configurations for deploying the Open Journal System (OJS) on Microsoft Azure. The configurations set up the necessary Azure resources, including virtual machines, load balancers, and databases, to host an OJS instance.
- Terraform installed on your local machine
- Azure subscription and appropriate credentials
- SSH keys for secure access
Initialize the Terraform workspace to install necessary provider plugins.
terraform initGenerate and review the execution plan for deploying the infrastructure.
terraform plan -var-file=secrets.tfvarsApply the Terraform configuration to create the necessary Azure resources.
terraform apply -var-file=secrets.tfvars -auto-approveIf needed, destroy the deployed infrastructure to avoid unnecessary costs.
terraform destroy -var-file=secrets.tfvars -auto-approve-
Access the public IP address of the web load balancer, which can be found in the Terraform output or the Azure portal.
-
Use the following default credentials to log in to the OJS instance:
- Username:
admin - Password:
p@ssw0rd!$
- Username:
Be aware that any manual changes made to the OJS instance (e.g., creating a journal, adding content) are not tracked by Terraform state and may require manual cleanup in Azure if you decide to destroy the resources.
- Update SSH Keys: Ensure SSH keys are unique and secure.
- Enhance Security: Review and fix firewall rules and other security configurations.
- Domains and DNS: Set up domains and DNS configurations (note: this may incur additional costs).
- SSL Certificates and HTTPS: Implement SSL certificates and HTTP to HTTPS redirection.
- Scaling and Load Balancing: Consider implementing auto-scaling and further load balancing strategies.
- DevOps Pipeline: Integrate with a CI/CD pipeline for automated deployments.
- Refactor Variables: Clean up and organize Terraform variables for better readability and maintainability.
- Terraform Modules: Consider using Terraform modules for better modularity and reuse.
To verify the installation and configuration of the OJS VM:
-
Connect via SSH from Local Machine to Bastion Host:
ssh -i ssh-keys/terraform-azure.pem azureuser@<bastion_host_vm_public_ip>
-
From the Bastion Host, Connect to the OJS VM:
sudo su - ssh -i /tmp/terraform-azure.pem adminuser@<ojs_vm_private_ip>
-
Check Installation Logs:
tail -100f /var/log/cloud-init-output.log
To connect to the MySQL database:
mysql -h <db_server_host> -u dbadmin -pExample:
mysql -h dev-mysql-server-khbduo.mysql.database.azure.com -u dbadmin -pIf you encounter SSH warnings about inaccessible identity files or unknown hosts, update the known hosts:
ssh-keygen -f "/root/.ssh/known_hosts" -R "<ojs_vm_private_ip>"- Remote Backend for State Management: Configure a remote backend in Azure for team environments to manage Terraform state.
- Lock Files for Production: Use lock files in GitHub to prevent unintended changes to production infrastructure.
- Load Balancer (LB): Used for public access to web VMs.
- Inbound NAT Rules: Configure NAT rules for admin access to web tier VMs.
- Application Gateway: Set up an Application Gateway for web subnet access.
- Terraform modules and other dependencies are referenced in
.terraform/modules/modules.json.