Skip to content

Commit

Permalink
Merge branch 'master' into javascript-init
Browse files Browse the repository at this point in the history
  • Loading branch information
rossjrw committed Nov 12, 2020
2 parents c5465ce + 80e1052 commit d504258
Show file tree
Hide file tree
Showing 3,927 changed files with 589,545 additions and 15,641 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
File renamed without changes.
21 changes: 10 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
.idea/
# Keys and secrets
files/public.pem
files/modulus.pem
conf/ssl/*.pem
conf/wikidot.ini
conf/wikijump.ini
/tmp
/web/files--common/tmp
/web/files--common/dist/
/web/files--sites
/vendor
composer.phar
node_modules/
*.pem

# Editor files
.idea/
.*.swp

# Miscellaneous
*.bak
*~
1 change: 0 additions & 1 deletion INSTALL

This file was deleted.

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Wikijump

----

## About

Wikijump is a platform for creating wikis, based on [Wikidot](http://wikidot.com/).
15 changes: 0 additions & 15 deletions composer.json

This file was deleted.

9 changes: 0 additions & 9 deletions conf/ssl/key.pem

This file was deleted.

27 changes: 27 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Local Development

The `installer` folder has everything you need to run a local Wikijump install either in a container or on metal or a VM.

### Installation

You can create a docker container using the following:

```bash
$ docker build . -t scpwiki/wikijump:local
$ docker create --name wikijump -p 8080:80 scpwiki/wikijump:local
$ docker start wikijump
```

Instead of building Wikijump locally, you can also pull the image from the Docker Hub:

```bash
$ docker create --name wikijump -p 8080:80 scpwiki/wikijump:latest
```

Then terminate it:

```bash
$ docker stop wikijump
```

Alternatively, you can install to your local system using `install.sh`. This may require tinkering depending on your exact platform and environment.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions infra/terraform/dev/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log

# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
# .tfvars files are managed as part of configuration and so should be included in
# version control.
#
# example.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
#
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
1 change: 1 addition & 0 deletions infra/terraform/dev/acm.tf
1 change: 1 addition & 0 deletions infra/terraform/dev/cloudfront.tf
1 change: 1 addition & 0 deletions infra/terraform/dev/codebuild.tf
1 change: 1 addition & 0 deletions infra/terraform/dev/codepipeline.tf
1 change: 1 addition & 0 deletions infra/terraform/dev/ecr.tf
1 change: 1 addition & 0 deletions infra/terraform/dev/ecs.tf
1 change: 1 addition & 0 deletions infra/terraform/dev/elasticache.tf
1 change: 1 addition & 0 deletions infra/terraform/dev/elb.tf
1 change: 1 addition & 0 deletions infra/terraform/dev/master.tf
1 change: 1 addition & 0 deletions infra/terraform/dev/rds.tf
1 change: 1 addition & 0 deletions infra/terraform/dev/s3.tf
1 change: 1 addition & 0 deletions infra/terraform/dev/ssm.tf
1 change: 1 addition & 0 deletions infra/terraform/dev/variables.tf
1 change: 1 addition & 0 deletions infra/terraform/dev/vpc.tf
14 changes: 14 additions & 0 deletions infra/terraform/dev/wikijump.auto.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Meta
environment = "production"
web_domain = "wikijump.com"
files_domain = "wjfiles.com"

# VPC
vpc_cidr_block = "10.173.0.0/16"
elb_subnet = "10.173.0.0/24"
container_subnet = "10.173.10.0/24"
database_subnet = "10.173.20.0/24"
cache_subnet = "10.173.30.0/24"

# Cloudfront/ELB
cf_auth_token = "e421b736-aa0f-4fbf-9965-b6fce423c826"
29 changes: 29 additions & 0 deletions infra/terraform/prod/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log

# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
# .tfvars files are managed as part of configuration and so should be included in
# version control.
#
# example.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
#
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
3 changes: 3 additions & 0 deletions infra/terraform/prod/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# wikijump-deploy
Terraform files for deployment of Wikijump cloud environments.

13 changes: 13 additions & 0 deletions infra/terraform/prod/acm.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "aws_acm_certificate" "cf_wildcard_cert" {
domain_name = var.web_domain
subject_alternative_names = [
var.files_domain,
"*.${var.web_domain}",
"*.${var.files_domain}"
]
validation_method = "DNS"

lifecycle {
create_before_destroy = true
}
}
46 changes: 46 additions & 0 deletions infra/terraform/prod/cloudfront.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
resource "aws_cloudfront_distribution" "wikijump_cf_distro" {
enabled = true
is_ipv6_enabled = true
default_root_object = "index.php"

aliases = [var.web_domain, var.files_domain]

origin {
domain_name = aws_lb.wikijump_elb.dns_name
origin_id = "wikijump_elb"
custom_header {
name = "X-CLOUDFRONT-WIKIJUMP-AUTH"
value = var.cf_auth_token
}
}

restrictions {
geo_restriction {
restriction_type = "none"
}
}

default_cache_behavior {
allowed_methods = ["DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT"]
cached_methods = ["GET", "HEAD"]
target_origin_id = "wikijump_elb"

forwarded_values {
query_string = true

cookies {
forward = "all"
}
}

viewer_protocol_policy = "redirect-to-https"
min_ttl = 0
default_ttl = 60
compress = true
max_ttl = 60
}

viewer_certificate {
acm_certificate_arn = aws_acm_certificate.cf_wildcard_cert.arn
}
}
1 change: 1 addition & 0 deletions infra/terraform/prod/codebuild.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TBD - May not be needed if we choose to use GitHub Actions.
1 change: 1 addition & 0 deletions infra/terraform/prod/codepipeline.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TBD - May not be needed if we choose to use GitHub Actions.
9 changes: 9 additions & 0 deletions infra/terraform/prod/ecr.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "aws_ecr_repository" "wikijump_ecr" {
name = "wikijump-${var.environment}"
encryption_configuration {
encryption_type = "KMS"
}
image_scanning_configuration {
scan_on_push = true
}
}
26 changes: 26 additions & 0 deletions infra/terraform/prod/ecs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
resource "aws_ecs_service" "wikijump" {
name = "wikijump-${var.environment}"
cluster = aws_ecs_cluster.wikijump_ecs_cluster.id
task_definition = aws_ecs_task_definition.wikijump_task.arn
desired_count = 1 # This will be a var as we grow

load_balancer {
target_group_arn = aws_lb_target_group.elb_target_group.arn
container_name = "wikijump"
container_port = 80
}
}

resource "aws_ecs_task_definition" "wikijump_task" {
family = "wikijump-${var.environment}-family"
container_definitions = file("task-definitions/wikijump.json")
requires_compatibilities = ["FARGATE"]
cpu = 256 # 1024 = 1 vCPU
memory = 512 # MiB
}

resource "aws_ecs_cluster" "wikijump_ecs_cluster" {
name = "wikijump-${var.environment}"
# Using Spot as a cost-saving measure for now. This will end up being dependent on environment.
capacity_providers = ["FARGATE_SPOT"]
}
40 changes: 40 additions & 0 deletions infra/terraform/prod/elasticache.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
resource "aws_elasticache_cluster" "wikijump_cache" {
cluster_id = "wikijump-cache-${var.environment}"
engine = "memcached"
node_type = var.cache_ec2_size
num_cache_nodes = var.cache_num_nodes
parameter_group_name = "default.memcached1.5"
port = 11211
subnet_group_name = aws_elasticache_subnet_group.cache_subnet.name
security_group_names = [aws_security_group.elasticache_sg.name]
}

resource "aws_elasticache_subnet_group" "cache_subnet" {
name = "wikijump-${var.environment}-cache-subnet"
subnet_ids = [aws_subnet.cache_subnet.id]
}

resource "aws_elasticache_security_group" "elasticache_sg" {
name = "wikijump-elasticache-${var.environment}"
security_group_names = [aws_security_group.elasticache_sg.name]
}

resource "aws_security_group" "elasticache_sg" {
name = "elasticache_sg_${var.environment}"
description = "Allow 11211 inbound"

ingress {
description = "Memcached"
from_port = 11211
to_port = 11211
protocol = "tcp"
cidr_blocks = [var.container_subnet] # Probably a cleaner way to do this is getting vars from ECS
}

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
Loading

0 comments on commit d504258

Please sign in to comment.