wip: deployment guide

This commit is contained in:
Jayden Pyles
2024-06-26 16:31:53 -05:00
parent b272d0d8e6
commit 8e8d0cee9e
4 changed files with 34 additions and 5 deletions

View File

@@ -3,8 +3,8 @@
COMPOSE_DEV = docker compose -f docker-compose.yml -f docker-compose.dev.yml COMPOSE_DEV = docker compose -f docker-compose.yml -f docker-compose.dev.yml
COMPOSE_PROD = docker compose -f docker-compose.yml COMPOSE_PROD = docker compose -f docker-compose.yml
HOSTNAME_PROD = ... HOSTNAME_PROD = "localhost"
HOSTNAME_DEV = localhost HOSTNAME_DEV = "localhost"
.PHONY: help deps build pull up-prod up-dev down setup deploy .PHONY: help deps build pull up-prod up-dev down setup deploy

View File

@@ -2,6 +2,8 @@
Template designed to quickly build full stack apps. Template designed to quickly build full stack apps.
Utilizes Github Actions and Ansible to build Docker images to quickly deploy onto an AWS EC2 Debian instance.
## Technologies ## Technologies
- Containerization: Docker/Docker Compose - Containerization: Docker/Docker Compose
@@ -12,17 +14,43 @@ Template designed to quickly build full stack apps.
- Frameworks/Libraries: PDM, TailwindCSS - Frameworks/Libraries: PDM, TailwindCSS
## Prerequisites
- Install Ansible
- Create a Dockerhub account/repo and fill out the Github repo environmental variables:
- DOCKERHUB_TOKEN
- DOCKERHUB_USERNAME
- DOCKERHUB_REPO
- Complete the `config.yaml` and the `inventory.yaml` in the `ansible` directory
- `github_repo`: Github repo clone address
- `deploy_path`: Path where to clone the repo to on the server
- `deploy_command`: `Make` command to run to deploy on the server
## Deployment ## Deployment
### Local Deployment
Uses `make` to quickly dispatch `docker-compose` commands. Uses `make` to quickly dispatch `docker-compose` commands.
- `deps`: rebuilds the frontend to deploy statically using the api - `deps`: rebuilds the frontend to deploy statically using the api
- `build`: builds the container using `docker-compose build ` - `build`: builds the container using `docker-compose build `
- `up-dev`: ups the container using `docker-compose -f docker-compose.yml up` - `up-prd`: ups the container using `docker-compose -f docker-compose.yml up`
- `up-prd`: ups the container using `docker-compose -f docker-compose.yml -f docker-compose.dev.yml up` - `up-dev`: ups the container using `docker-compose -f docker-compose.yml -f docker-compose.dev.yml up`
which will deploy with local volumes. which will deploy with local volumes.
Ex: `make deps build up-dev` Ex: `make deps build up-dev`
### Server Deployment
Easy deployment using `make setup deploy` after completing the required config files.
- `setup`: Install dependencies and clone repo onto server
- `deploy`: Deploy on server

View File

@@ -1,3 +1,3 @@
github_repo: https://github.com/jaypyles/webapp-template.git github_repo: https://github.com/jaypyles/webapp-template.git
deploy_path: /home/admin/website deploy_path: /home/admin/site
deploy_command: make pull up-prd deploy_command: make pull up-prd

View File

@@ -1,6 +1,7 @@
version: "3" version: "3"
services: services:
frontend: frontend:
image: jpyles0524/webapp-template:latest
build: build:
context: ./ context: ./
container_name: frontend container_name: frontend