-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4a6044
commit db5f36b
Showing
104 changed files
with
1,988 additions
and
409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
npm-debug.log | ||
.env | ||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
MY_SECRET_VALUE="foobar" | ||
|
||
# Auth0 - https://auth0.com/docs/quickstart/webapp/nextjs/interactive | ||
# Allowed callback URLs: https://my-app.vercel.app/api/auth/callback, http://localhost:3000/api/auth/callback | ||
# Allowed logout URLs: https://my-app.vercel.app, http://localhost:3000 | ||
AUTH0_SECRET='use [openssl rand -hex 32] to generate a 32 bytes value' | ||
AUTH0_BASE_URL='http://localhost:3000' | ||
AUTH0_ISSUER_BASE_URL='https://{yourDomain}' | ||
AUTH0_CLIENT_ID='{yourClientId}' | ||
AUTH0_CLIENT_SECRET='{yourClientSecret}' | ||
NEXT_PUBLIC_URL=http://localhost:3000 | ||
NEXT_PUBLIC_STRIPE_KEY="pk_asdfasdfasdfasdfasdf" | ||
STRIPE_SECRET_KEY="sk_asdfasdfasdfasdfasdf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# bootstrap.sh | ||
|
||
#!/bin/bash | ||
|
||
# Check if PUBLIC_KEY is set | ||
if [ -z "$PUBLIC_KEY" ]; then | ||
echo "Error: PUBLIC_KEY environment variable is not set." | ||
exit 1 | ||
fi | ||
|
||
# Check if DOMAIN is set | ||
if [ -z "$DOMAIN" ]; then | ||
echo "Error: DOMAIN environment variable is not set." | ||
exit 1 | ||
fi | ||
|
||
# Check if EMAIL is set | ||
if [ -z "$EMAIL" ]; then | ||
echo "Error: EMAIL environment variable is not set." | ||
exit 1 | ||
fi | ||
|
||
# Update and install necessary packages | ||
apt update && apt upgrade -y | ||
apt install -y software-properties-common | ||
|
||
# Install Docker | ||
apt install -y docker.io | ||
systemctl enable docker | ||
systemctl start docker | ||
|
||
# Install Docker Compose | ||
DOCKER_COMPOSE_VERSION="v2.16.0" # Change to the desired version | ||
curl -SL "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
chmod +x /usr/local/bin/docker-compose | ||
|
||
# Configure UFW | ||
ufw allow OpenSSH | ||
ufw enable | ||
|
||
# Install Certbot and Nginx | ||
apt install -y certbot | ||
|
||
# Obtain the SSL certificate using standalone mode | ||
certbot certonly --standalone -d "$DOMAIN" --non-interactive --agree-tos --email "$EMAIL" | ||
|
||
|
||
# Disable password authentication | ||
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config | ||
systemctl restart ssh | ||
|
||
# Add SSH public key | ||
mkdir -p ~/.ssh | ||
echo "$PUBLIC_KEY" >> ~/.ssh/authorized_keys | ||
chmod 600 ~/.ssh/authorized_keys | ||
|
||
# Restart UFW to apply changes | ||
systemctl restart ufw | ||
|
||
echo "Bootstrap script completed successfully." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# .github/workflows/manual-deploy.yml | ||
# TODO_DEPLOYMENT | ||
|
||
name: Manually Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
#bootstrap: | ||
# run bootstrap.ssh? | ||
# PUBLIC_KEY="your_ssh_public_key_here" DOMAIN="your_domain_here" bash bootstrap.sh | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Re-deploy, update secrets | ||
env: | ||
# secure: only stored in memory during the remote-ssh session | ||
API_KEY: ${{ secrets.API_KEY }} | ||
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | ||
run: | | ||
ssh user@your-vm-ip << 'EOF' | ||
# Authenticate with GitHub CLI using the passed PAT | ||
echo "$GITHUB_TOKEN" | gh auth login --with-token | ||
|
||
# Create the .env file with secrets | ||
{ | ||
echo "API_KEY=$API_KEY" | ||
echo "DB_PASSWORD=$DB_PASSWORD" | ||
} > .env | ||
|
||
# Run docker-compose with the .env file | ||
docker-compose --env-file .env up -d | ||
|
||
# Remove the .env file immediately | ||
rm .env | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(update the changelog each time) | ||
commits: | ||
feat: landing page with dummy data | ||
feat: client-side cart item storage | ||
feat: stripe checkout with dummy data | ||
feat: printify | ||
feat: passwordless email login | ||
feat: enable fully functioning checkout (stripe + printify) | ||
docs: improve README |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Build Stage | ||
FROM node:20.16-alpine3.19 AS build | ||
|
||
WORKDIR /usr/src/app | ||
COPY package*.json ./ | ||
RUN npm ci | ||
COPY . . | ||
RUN npm run build | ||
|
||
# Production Stage | ||
FROM node:20.16-alpine3.19 AS production | ||
|
||
# Use a non-root user for security | ||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup | ||
USER appuser | ||
|
||
WORKDIR /usr/src/app | ||
COPY --from=build /usr/src/app ./ | ||
|
||
# Document the port that may need to be published | ||
EXPOSE 3000 | ||
|
||
# Start the application | ||
CMD ["npm", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
services: | ||
watchtower: | ||
image: containrrr/watchtower | ||
command: | ||
- "--label-enable" | ||
- "--interval" | ||
- "30" | ||
- "--rolling-restart" | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
reverse-proxy: | ||
image: traefik:v3.1 | ||
command: | ||
- "--log.level=ERROR" | ||
- "--accesslog=true" | ||
- "--providers.docker" | ||
- "--providers.docker.exposedbydefault=false" | ||
- "--entryPoints.websecure.address=:443" | ||
- "--certificatesresolvers.myresolver.acme.tlschallenge=true" | ||
- "--certificatesresolvers.myresolver.acme.email=elliott@zenful.cloud" | ||
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json" | ||
- "--entrypoints.web.address=:80" | ||
- "--entrypoints.web.http.redirections.entrypoint.to=websecure" | ||
- "--entrypoints.web.http.redirections.entrypoint.scheme=https" | ||
- "--entryPoints.web.forwardedHeaders.insecure" | ||
- "--entryPoints.websecure.forwardedHeaders.insecure" | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
volumes: | ||
- letsencrypt:/letsencrypt | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
nextjs-app: | ||
image: ghcr.io/spencerlepine/nextjs-app:prod | ||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.http.middlewares.nextjs-app-ratelimit.ratelimit.average=20" | ||
- "traefik.http.routers.nextjs-app.rule=Host(`zenful.cloud`) && !Method(`POST`)" | ||
- "traefik.http.routers.nextjs-app.entrypoints=websecure" | ||
- "traefik.http.routers.nextjs-app.tls.certresolver=myresolver" | ||
- "traefik.http.routers.nextjs-app.middlewares=nextjs-app-ratelimit" | ||
# Define separate router for POST methods | ||
- "traefik.http.middlewares.nextjs-app-ratelimit-post.ratelimit.average=1" | ||
- "traefik.http.middlewares.nextjs-app-ratelimit-post.ratelimit.period=1m" | ||
- "traefik.http.routers.nextjs-app-post.rule=Host(`zenful.cloud`) && Method(`POST`)" | ||
- "traefik.http.routers.nextjs-app-post.middlewares=nextjs-app-ratelimit-post" | ||
- "traefik.http.routers.nextjs-app-post.entrypoints=websecure" | ||
- "traefik.http.routers.nextjs-app-post.tls.certresolver=myresolver" | ||
# Proxy | ||
- "traefik.http.routers.proxy.rule=Host(`proxy.dreamsofcode.io`)" | ||
- "traefik.http.routers.proxy.entrypoints=websecure" | ||
- "traefik.http.routers.proxy.tls.certresolver=myresolver" | ||
# Enable watchtower | ||
- "com.centurylinklabs.watchtower.enable=true" | ||
environment: | ||
- POSTGRES_HOST=db | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_DB=nextjs-app | ||
- POSTGRES_PORT=5432 | ||
- POSTGRES_SSLMODE=disable | ||
- POSTGRES_PASSWORD=${DATABASE_PASSWORD} | ||
deploy: | ||
mode: replicated | ||
replicas: 3 | ||
restart: always | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:3000"] | ||
interval: 1m30s | ||
timeout: 10s | ||
retries: 3 | ||
start_period: 40s | ||
db: | ||
image: postgres | ||
restart: always | ||
user: postgres | ||
volumes: | ||
- db-data:/var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_DB=nextjs-app | ||
- POSTGRES_PASSWORD=${DATABASE_PASSWORD} | ||
expose: | ||
- 5432 | ||
healthcheck: | ||
test: [ "CMD", "pg_isready" ] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
dragonfly: | ||
image: 'docker.dragonflydb.io/dragonflydb/dragonfly' | ||
ulimits: | ||
memlock: -1 | ||
network_mode: "host" | ||
volumes: | ||
- dragonflydata:/data | ||
|
||
volumes: | ||
db-data: | ||
letsencrypt: | ||
dragonflydata: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,13 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
images: { | ||
remotePatterns: [ | ||
{ | ||
protocol: 'https', | ||
hostname: 'lh3.googleusercontent.com', | ||
port: '', | ||
pathname: '/**', | ||
}, | ||
{ | ||
protocol: 'https', | ||
hostname: 's.gravatar.com', | ||
port: '', | ||
pathname: '/**', | ||
}, | ||
], | ||
} | ||
remotePatterns: [{ | ||
protocol: 'http', | ||
hostname: 'localhost', | ||
port: '3000', | ||
pathname: '/images/**' | ||
}] | ||
}, | ||
}; | ||
|
||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Diff not rendered.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<xml version="1.0" encoding="UTF-8"> | ||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | ||
<url> | ||
<loc>http://www.swagsticker.com</loc> | ||
<lastmod>2024-10-14</lastmod> | ||
</url> | ||
</urlset> | ||
</xml> |
Oops, something went wrong.