-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from maciejzj/develop
Release changes v0.2.0 to master
- Loading branch information
Showing
35 changed files
with
941 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Python | ||
*.json | ||
# Project-specific | ||
deployment/artifacts | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[defaults] | ||
inventory = artifacts/hosts |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
it_jobs_meta_version: b962af2dc5a16548dec14f1a8c6e3b1803090505 | ||
# Add the following for weekly updates: | ||
# '--schedule "0 0 * * 1"' | ||
# Add the following to run from an archived snapshot: | ||
# '--from-archive "https://github.com/maciejzj/it-jobs-meta/raw/master/it_jobs_meta/data_pipeline/test/1640874783_nofluffjobs.json"' | ||
# Add the following to store data in the s3 bucket data lake: | ||
# '--s3-bucket /home/{{ ansible_user }}/it-jobs-meta/s3_bucket_config.yml' | ||
pipeline_command_params: '--from-archive "https://github.com/maciejzj/it-jobs-meta/raw/master/it_jobs_meta/data_pipeline/test/1640874783_nofluffjobs.json" -m /home/{{ ansible_user }}/it-jobs-meta/mongodb_config.yml' | ||
dashboard_command_params: '--with-wsgi --mongodb /home/{{ ansible_user }}/it-jobs-meta/mongodb_config.yml --label ARCHIVE' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,135 +1,44 @@ | ||
provider "aws" { | ||
region = "eu-central-1" | ||
access_key = var.aws_access_key | ||
secret_key = var.aws_secret_key | ||
region = "eu-central-1" | ||
} | ||
|
||
resource "aws_s3_bucket" "data_lake_bucket" { | ||
bucket = "it-jobs-meta-data-lake" | ||
resource "aws_s3_bucket" "data_lake_storage" { | ||
bucket = "it-jobs-meta-data-lake-${terraform.workspace}" | ||
force_destroy = true | ||
} | ||
|
||
resource "aws_s3_bucket_public_access_block" "data_lake_bucket_access" { | ||
bucket = aws_s3_bucket.data_lake_bucket.id | ||
|
||
# Keep the bucket private | ||
block_public_acls = true | ||
block_public_policy = true | ||
ignore_public_acls = true | ||
} | ||
|
||
resource "aws_default_vpc" "default_vpc" { | ||
tags = { | ||
Name = "Default AWS VPC" | ||
Name = "S3 bucket for it-jobs-meta data lake" | ||
Project = "${var.project_name_tag}" | ||
Environment = "${terraform.workspace}" | ||
} | ||
} | ||
|
||
resource "aws_security_group" "allow_web" { | ||
name = "allow_web_traffic" | ||
description = "Allow web trafic for hosting a server" | ||
vpc_id = aws_default_vpc.default_vpc.id | ||
data "aws_ami" "ubuntu" { | ||
most_recent = true | ||
|
||
ingress { | ||
description = "HTTPS" | ||
from_port = 443 | ||
to_port = 443 | ||
protocol = "tcp" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
ingress { | ||
description = "HTTP" | ||
from_port = 8080 | ||
to_port = 8080 | ||
protocol = "tcp" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
ingress { | ||
description = "HTTP" | ||
from_port = 80 | ||
to_port = 80 | ||
protocol = "tcp" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
filter { | ||
name = "name" | ||
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"] | ||
} | ||
ingress { | ||
description = "SSH" | ||
from_port = 22 | ||
to_port = 22 | ||
protocol = "tcp" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
|
||
egress { | ||
from_port = 0 | ||
to_port = 0 | ||
protocol = "-1" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
} | ||
|
||
resource "aws_iam_policy" "allow_s3_bucket_access" { | ||
name = "allow-s3-bucket-access" | ||
path = "/" | ||
description = "Allow " | ||
|
||
policy = jsonencode({ | ||
"Version" : "2012-10-17", | ||
"Statement" : [ | ||
{ | ||
"Sid" : "VisualEditor0", | ||
"Effect" : "Allow", | ||
"Action" : [ | ||
"s3:PutObject", | ||
"s3:GetObject", | ||
"s3:ListBucket", | ||
"s3:DeleteObject" | ||
], | ||
"Resource" : [ | ||
"arn:aws:s3:::*/*", | ||
aws_s3_bucket.data_lake_bucket.arn | ||
] | ||
} | ||
] | ||
}) | ||
# Canonical | ||
owners = ["099720109477"] | ||
} | ||
|
||
resource "aws_iam_role" "iam_role_for_ec2" { | ||
name = "iam_role_for_ec2_it_jobs_meta_server" | ||
|
||
assume_role_policy = jsonencode({ | ||
Version = "2012-10-17" | ||
Statement = [ | ||
{ | ||
Action = "sts:AssumeRole" | ||
Effect = "Allow" | ||
Sid = "" | ||
Principal = { | ||
Service = "ec2.amazonaws.com" | ||
} | ||
}, | ||
] | ||
}) | ||
} | ||
|
||
resource "aws_iam_instance_profile" "iam_profile_for_ec2" { | ||
name = "some-profile" | ||
role = aws_iam_role.iam_role_for_ec2.name | ||
} | ||
resource "aws_instance" "it_jobs_meta_server" { | ||
ami = data.aws_ami.ubuntu.id | ||
instance_type = "t2.micro" | ||
|
||
subnet_id = aws_subnet.it_jobs_meta_public.id | ||
vpc_security_group_ids = [aws_security_group.allow_web.id] | ||
associate_public_ip_address = true | ||
|
||
resource "aws_iam_role_policy_attachment" "data_lake_bucket_policy_attach" { | ||
role = aws_iam_role.iam_role_for_ec2.name | ||
policy_arn = aws_iam_policy.allow_s3_bucket_access.arn | ||
} | ||
|
||
resource "aws_instance" "it_jobs_meta_server" { | ||
# eu-central-1, Ubuntu 20.04 LTS, amd64 | ||
ami = "ami-0498a49a15494604f" | ||
instance_type = "t2.micro" | ||
vpc_security_group_ids = [aws_security_group.allow_web.id] | ||
key_name = aws_key_pair.it_jobs_meta_ec2_server.key_name | ||
iam_instance_profile = aws_iam_instance_profile.iam_profile_for_ec2.id | ||
|
||
tags = { | ||
Name = "It Jobs Meta server" | ||
Name = "EC2 instance for it-jobs-meta server" | ||
Project = "${var.project_name_tag}" | ||
Environment = "${terraform.workspace}" | ||
} | ||
|
||
iam_instance_profile = aws_iam_instance_profile.iam_profile_for_ec2.id | ||
} |
Oops, something went wrong.