Code Monkey home page Code Monkey logo

outline-terraform-ansible's Introduction

Outline Terraform Ansible

Automated deployment of Outline, a modern knowledge base, using Terraform and Ansible.

Deploy to Google Cloud Platform

The script currently automates deployment of Outline server on Google Cloud Platform. This script will :

  • Create a virtual machine
  • Add the SSH public key specified in the variables to authorized keys in the virtual machine
  • Create a VPC network
  • Create Postgres database instance that's accessible only in the VPC network
  • Create database and user
  • Add firewall rules to open ports 22, 80 and 443 (TCP and ICMP Protocols)
  • Install Outline server and it's dependencies
  • Deploy the application using PM2
  • Install Nginx and Certbot
  • Create a reverse proxy to the application
  • Get Let's Encrypt certificate for the domain mentioned in ansible/group_vars/all (Optional)

Prerequisites

  • Terraform
  • Ansible
  • Google Cloud Platform Service Account Private Key with required permissions
  • Enable Redis Memorystore on Google Cloud Platform (Optional)
  • Domain Name (Optional)

You could use install-terraform.sh and install-ansible.sh to install Terraform and Ansible on Debian based linux distributions.

How to use

Before running the script, make sure you update values in the file vars.tf. Alternatively, you can use a .tfvars file.

Note:

The script by default creates cloud resources that are not covered by GCP Free Tier.

Please calculate the cost of the resources that you mention in the variables *vars.tf* file.

I do not claim responsibility for any cost incurred from running this script.

Steps:

  • Clone this repository
  • Make sure Terraform Provisioner Ansible is installed
  • Create a service account with Compute Admin and Service Networking Admin roles
  • Generate a key for the service account and update the path in variables
  • Update the values of the variables in the files gcp/vars.tf and ansible/group_vars/all
  • Change directory to gcp
  • Run terraform init
  • Run terraform apply
  • Sit back and relax
  • Update the domain's A record to point to the IP of the VM when prompted

Destroying resources

To destroy all the resources the script created, run terraform destroy.

Caution: This will destroy all resources created using this terraform script. Any data stored on the virtual machine or the database will be permanently deleted.

Deploy using Ansible

If you prefer deploying the application elsewhere, you could just use the Ansible Playbook.

You would have to create database manually and provide connection details as parameter extra-vars.

Prerequisites

How to use

  • Update the values of the variables in group_vars/all
  • Update ansible hosts file
  • Run ansible-playbook main.yml -i hosts --extra-vars='{"db_ip_address":"127.0.0.1","db_name":"outline_db","db_password":"Passw0rd","db_username":"outline_db_user","enable_redis":true}'

outline-terraform-ansible's People

Contributors

rjsgn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.