Code Monkey home page Code Monkey logo

pngr's Introduction

PNGR Stack ๐Ÿ“

Build

Dockerized (postgres + nginx + golang + react) starter kit

Only implements users, sessions, password_resets, and a toy post type to demonstrate basic CRUD. PNGR is not a CMS.

Features and Stack

  • Hot-reload, front and back, including a test-runner for golang changes

Back-end

Front-end

Other goodies

Feature development is up to you!

Requirements

Install docker && docker-compose

Quick Start

# clone the repo
git clone https://github.com/karlkeefer/pngr.git my_project_name

# copy the .env template for your local version
cp .env.example .env

# build and start the containers
docker-compose up
  1. Visit http://localhost:4500
  2. Make changes to go, sql, or react code, and enjoy hot-reload goodness!

Run client-side test watcher

docker-compose exec react npm run test

Database Helpers

Migrations

Migrations are created and run using simple wrappers around go-migrate.

# create files for a new migration
postgres/new my_migration_name

# execute any new migrations (this is also run automatically the container is created)
postgres/migrate up

# go down 1 migration
postgres/migrate down 1

# goto a migration by index
postgres/migrate goto 3

Open a psql client

# remember to use \q to exit
postgres/psql

Rebuild everything, including database(!), from scratch

Maybe your postgres went sideways from a wonky migration and it's easier to restart from scratch.

docker-compose down -v && docker-compose up --build --force-recreate

Run in Production

Warning: Run in production at your own risk!

docker-compose.prod.yml is designed for a setup where postgresql is not dockerized.

Don't forget to copy .env.example -> .env and setup your secrets/passwords for the new environment! At minimum, you'll need to change ENV, APP_ROOT, and TOKEN_SECRET!

# build production images, and run them in a detached state
docker-compose -f docker-compose.prod-build.yml up --build -d

Note: using your production server as your build server is a bad idea, so you should consider using a registry...

Using CI

You can modify the github action to push built containers to a container registry. The containers are tagged with the commit SHA by default.

You will also need to update docker-compose.prod.yml to point to your container registry.

# pull containers from a registry using a tag, then run them in a detached state
SHA=2c25e862e0f36e0fc17c1703e4f319f0d9d04520 docker-compose -f docker-compose.prod.yml up -d

pngr's People

Contributors

karlkeefer avatar canrozanes avatar koddr avatar dependabot[bot] avatar dylannwatt avatar felix-leber avatar zamicol avatar brownchow avatar letusfly85 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.