Skip to content

Instantly share code, notes, and snippets.

View ashmore11's full-sized avatar

Scott Ashmore ashmore11

View GitHub Profile
@ashmore11
ashmore11 / database.json
Last active January 14, 2021 18:15
Next Strapi Cloud Run (database development)
{
"defaultConnection": "default",
"connections": {
"default": {
"connector": "bookshelf",
"settings": {
"client": "mysql",
"host": "${process.env.DB_HOST}",
"port": "${process.env.DB_PORT}",
"database": "${process.env.DB_NAME}",
@ashmore11
ashmore11 / bitbucket.tf
Last active January 19, 2021 21:59
Next Strapi Cloud Run (Terraform Bitbucket)
provider "bitbucket" {
username = var.bitbucket_username
password = var.bitbucket_password
}
resource "bitbucket_repository_variable" "gcloud_project_id" {
repository = "${var.bitbucket_username}/${var.bitbucket_repository_slug}"
key = "GCLOUD_PROJECT_ID"
value = google_project.project.project_id
secured = false
@ashmore11
ashmore11 / gcp.tf
Last active March 2, 2023 20:29
Next Strapi Cloud Run (Terraform GCP)
provider "google" {
region = var.gcp_region
}
resource "random_id" "id" {
byte_length = 2
prefix = "${replace(lower(var.gcp_project_name), "/\\s+/", "-")}-"
}
resource "google_project" "project" {
@ashmore11
ashmore11 / backend.tf
Created January 12, 2021 16:51
Next Strapi Cloud Run (Terraform Backend)
terraform {
backend "gcs" {
bucket = "project-id-terraform-admin"
prefix = "terraform/state"
}
}
@ashmore11
ashmore11 / providers.tf
Last active January 12, 2021 17:26
Next Strapi Cloud Run (Terraform Providers)
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 3.50"
}
bitbucket = {
source = "terraform-providers/bitbucket"
version = ">= 1.2"
}
@ashmore11
ashmore11 / variables.tf
Last active January 19, 2021 17:46
Next Strapi Cloud Run (Terraform Variables)
variable "gcp_project_name" {
type = string
description = "Name of the Google Cloud Platform Project to be created."
default = "next-strapi-cloud-run"
}
variable "gcp_region" {
type = string
description = "Google Cloud Region that the project should be created within"
default = "europe-west1"
@ashmore11
ashmore11 / index.js
Created January 5, 2021 13:45
Next Strapi Cloud Run (next.js getStaticProps)
import { request, gql } from 'graphql-request'
export const getStaticProps = async () => {
const query = gql`
{
test {
title
}
}
`;
@ashmore11
ashmore11 / next.config.js
Created January 5, 2021 12:14
Next Strapi Cloud Run (next.js config)
module.exports = {
env: {
CMS_GRAPHQL_URL: process.env.CMS_GRAPHQL_URL,
},
}
@ashmore11
ashmore11 / docker-compose.yml
Last active January 20, 2021 10:28
Next Strapi Cloud Run (docker compose next.js)
version: "3.7"
services:
next-strapi-cloud-run-mysql:
image: mysql:5.7
container_name: next-strapi-cloud-run-mysql
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: cms
ports:
- "3308:3306"
@ashmore11
ashmore11 / docker-compose.yml
Last active January 20, 2021 10:28
Next Strapi Cloud Run (docker compose cms)
version: "3.7"
services:
next-strapi-cloud-run-mysql:
image: mysql:5.7
container_name: next-strapi-cloud-run-mysql
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: cms
ports:
- "3308:3306"