Giter VIP home page Giter VIP logo

rocketplate's Introduction

rocketplate

Boilerplate for your next web project.

Rocketplate for your next adventure ๐Ÿš€

Getting started

To get started, create a Google Cloud project and get authenticated:

gcloud auth application-default login
gcloud auth configure-docker

Now, we need to wire up Terraform and GCS. You can use the ./bootstrap.bash tool to do this:

./bootstrap.bash TERRAFORM_BUCKET_NAME

which will create a GCS bucket for Terraform and authenticate Google Cloud Build.

To configure your new deployment, copy the example tfvars:

cp -n example.tfvars production.tfvars

and change anything that needs to be changed.

All that's left is to deploy!

# Replace TERRAFORM_BUCKET_NAME
terraform init --backend-config=bucket=TERRAFORM_BUCKET_NAME --backend-config=prefix=tfstate/production

# You might need to run this twice
terraform apply -var-file=production.tfvars

You now are admin-ing your own GKE cluster ๐Ÿ˜Ž

DNS

To get your domain name pointing at this cluster, point the domain name's nameservers at the Google Managed Zone's DNS servers.

You can get these by going to the Google Cloud UI > Network Services > Cloud DNS > [Your Managed Zone] > Registrar Setup (top right corner).

Persisting secrets

The tfvars files are .gitignored, so, to persist them, you can use the ./tfvars.bash tool:

STAGE=production TF_BUCKET=your-bucket-name ./tfvars.bash upload

Which will upload production.tfvars for you to your terraform bucket.

To have your team download, they can run:

STAGE=production TF_BUCKET=your-bucket-name ./tfvars.bash download

The CI system, Google Cloud Build, can now also download your secrets and deploy for you.

CI

To use Google Cloud Build, first you need to build the custom cloud builder:

cd cloud-builder
gcloud builds submit --config=cloudbuild.yaml

Then, to run a remote deployment:

STAGE=production TF_BUCKET=rocketplate-terraform ./deploy.bash remote

To get builds happening automatically, head to the Google Cloud Build dashboard and set up an automatic trigger.

Data

The database in this project is Postgres, and the migration system is rambler.

Rambler has it's own folder, in ./rambler/

Development

To get the development environment up and running, run

docker-compose up

which will get Postgres and rambler running.

Next would be to get api and web and running:

cd api
cp -n .env.example .env
npm run install
npm run dev
cd web
cp -n .env.example .env
npm run install
npm run dev

The way it's set up, environment variables are read from .env in both services.

You can open up both localhost:3000 (web) and localhost:3001 (api) and start building stuff!

Techs

This system uses (from metal to user):

Cleaning up

To destroy everything, we can mostly just use Terraform. Doing a simple terraform destory fails unfortunatley though, because the Kubernetes node pool gets destroyed before helm (if you can create a PR to fix this, hats off to you!).

So, to destroy everything completely:

terraform destroy -var-file=production.tfvars
terraform state rm \
  module.ingress.helm_release.kube_lego \
  module.ingress.helm_release.nginx_ingress
terraform destroy -var-file=production.tfvars

And you should be good to go.

Troubleshooting

Error waiting for Create Service Networking Connection

Try running this command.

Todo


Whatever you do, work at it with all your heart, as working for the Lord, not for human masters, since you know that you will receive an inheritance from the Lord as a reward.

Colossians 3:23

rocketplate's People

Contributors

tuckerconnelly avatar dependabot[bot] avatar iamrare avatar

Forkers

asmtal

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.