mirror of
https://github.com/System-End/stickers.git
synced 2026-04-19 15:18:17 +00:00
coolify
This commit is contained in:
parent
33e653cbaf
commit
758ece096a
2 changed files with 151 additions and 82 deletions
169
README.md
169
README.md
|
|
@ -1,57 +1,32 @@
|
|||
<div align="center">
|
||||
<img
|
||||
src="https://assets.hackclub.com/flag-standalone.svg"
|
||||
width="100"
|
||||
alt="Hack Club flag"
|
||||
/>
|
||||
|
||||
<h2>
|
||||
<a href="https://stickers.hackclub.com">stickers.hackclub.com</a>
|
||||
</h2>
|
||||
|
||||
<img
|
||||
src="src/lib/assets/images/hackClubLogo.png"
|
||||
width="300"
|
||||
alt="Hack Club logo"
|
||||
/>
|
||||
<p>
|
||||
The Rails 8 + Inertia.js + Svelte 5 codebase powering
|
||||
<a href="https://stickers.hackclub.com">stickers.hackclub.com</a>
|
||||
</p>
|
||||
<img src="https://assets.hackclub.com/flag-standalone.svg" width="100" alt="Hack Club flag" />
|
||||
<h2><a href="https://stickers.hackclub.com">stickers.hackclub.com</a></h2>
|
||||
<img src="app/javascript/assets/images/hackClubLogo.png" width="300" alt="Hack Club logo" />
|
||||
<p>The Rails 8 + Inertia.js + Svelte 5 codebase powering <a href="https://stickers.hackclub.com">stickers.hackclub.com</a></p>
|
||||
</div>
|
||||
|
||||
<hr style="margin-top: 0.1rem; margin-bottom: 0;">
|
||||
---
|
||||
|
||||
<h1>Hack Club Stickers</h1>
|
||||
# Hack Club Stickers
|
||||
|
||||
<p>
|
||||
Every Hack Clubber gets free, high-quality stickers. Completing
|
||||
<a href="https://ysws.hackclub.com/">programs</a> and attending
|
||||
<a href="https://hackathons.hackclub.com/">hackathons</a>
|
||||
can earn more event-specific merch!
|
||||
</p>
|
||||
Every Hack Clubber gets free, high-quality stickers. Completing [programs](https://ysws.hackclub.com/) and attending [hackathons](https://hackathons.hackclub.com/) can earn more event-specific merch!
|
||||
|
||||
<h3>Features</h3>
|
||||
<ul>
|
||||
<li>Trade stickers with other Hack Clubbers</li>
|
||||
<li>Browse an archive of all printed Hack Club stickers</li>
|
||||
<li>Submit new sticker designs</li>
|
||||
<li>Vote on your favourite designs</li>
|
||||
<li>Hack to earn monthly sticker shipments</li>
|
||||
<li>Use as an API for sticker designs</li>
|
||||
</ul>
|
||||
## Features
|
||||
|
||||
<h3>Contributing</h3>
|
||||
<ul>
|
||||
<li>
|
||||
Help archive stickers at
|
||||
<a href="https://forms.hackclub.com/archive">forms.hackclub.com/archive</a>
|
||||
</li>
|
||||
</ul>
|
||||
- Trade stickers with other Hack Clubbers
|
||||
- Browse an archive of all printed Hack Club stickers
|
||||
- Submit new sticker designs
|
||||
- Vote on your favourite designs
|
||||
- Hack to earn monthly sticker shipments
|
||||
- Use as an API for sticker designs
|
||||
|
||||
<h3>Development Setup</h3>
|
||||
## Contributing
|
||||
|
||||
<pre>
|
||||
- Help archive stickers at [forms.hackclub.com/archive](https://forms.hackclub.com/archive)
|
||||
|
||||
## Development Setup
|
||||
|
||||
```bash
|
||||
git clone https://github.com/hackclub/stickers
|
||||
cd stickers
|
||||
|
||||
|
|
@ -68,13 +43,13 @@ bin/rails db:create db:migrate
|
|||
|
||||
# Start the server (runs on port 3100)
|
||||
bin/dev
|
||||
</pre>
|
||||
```
|
||||
|
||||
<h3>Environment Variables</h3>
|
||||
## Environment Variables
|
||||
|
||||
<p>Required environment variables in <code>.env</code>:</p>
|
||||
Required environment variables in `.env`:
|
||||
|
||||
<pre>
|
||||
```bash
|
||||
# Airtable
|
||||
AIRTABLE_PAT=your_personal_access_token
|
||||
AIRTABLE_BASE_ID=your_base_id
|
||||
|
|
@ -86,48 +61,78 @@ AIRTABLE_SHOP_TABLE_ID=your_shop_table_id
|
|||
OIDC_CLIENT_ID=your_client_id
|
||||
OIDC_CLIENT_SECRET=your_client_secret
|
||||
OIDC_REDIRECT_URI=http://localhost:3100/auth/oidc/callback
|
||||
</pre>
|
||||
```
|
||||
|
||||
<h3>API Usage</h3>
|
||||
## API Usage
|
||||
|
||||
<p>You can use <code>stickers.hackclub.com/api/</code> to get a list of all Hack Club stickers in JSON. Please don't hammer it too hard — let us know what you're up to and we can help you coexist within the rate limit.</p>
|
||||
You can use `stickers.hackclub.com/api/` to get a list of all Hack Club stickers in JSON. Please don't hammer it too hard — let us know what you're up to and we can help you coexist within the rate limit.
|
||||
|
||||
<h4>Stickers</h4>
|
||||
<ul>
|
||||
<li><code>GET /api/stickers</code> - List all visible stickers</li>
|
||||
<li><code>GET /api/stickers/:id</code> - Get sticker details</li>
|
||||
</ul>
|
||||
### Stickers
|
||||
|
||||
<h4>Designs</h4>
|
||||
<ul>
|
||||
<li><code>GET /api/designs</code> - List current user's designs (requires auth)</li>
|
||||
<li><code>GET /api/designs/all</code> - List all designs (requires auth)</li>
|
||||
<li><code>POST /api/designs</code> - Submit a new design (requires auth)</li>
|
||||
<li><code>POST /api/designs/:id/vote</code> - Toggle vote on a design (requires auth)</li>
|
||||
</ul>
|
||||
- `GET /api/stickers` - List all visible stickers
|
||||
- `GET /api/stickers/:id` - Get sticker details
|
||||
|
||||
Our Airtable has no passwords or secrets — if you want a read-only personal access token scoped to the base we can provide it!
|
||||
In general we're happy to help you over DM, but please have a glance over the code first!
|
||||
### Designs
|
||||
|
||||
<h3>Deployment</h3>
|
||||
- `GET /api/designs` - List current user's designs (requires auth)
|
||||
- `GET /api/designs/all` - List all designs (requires auth)
|
||||
- `POST /api/designs` - Submit a new design (requires auth)
|
||||
- `POST /api/designs/:id/vote` - Toggle vote on a design (requires auth)
|
||||
|
||||
<p>The app is deployed using Docker. To deploy:</p>
|
||||
Our Airtable has no passwords or secrets — if you want a read-only personal access token scoped to the base we can provide it! In general we're happy to help you over DM, but please have a glance over the code first!
|
||||
|
||||
<pre>
|
||||
# Build assets for production
|
||||
bin/rails assets:precompile
|
||||
</pre>
|
||||
## Deployment
|
||||
|
||||
<p>deploy with Docker directly:</p>
|
||||
### Option 1: Coolify (Recommended)
|
||||
|
||||
<pre>
|
||||
**Using Docker Compose (app + database):**
|
||||
|
||||
1. Create new resource → **Docker Compose**
|
||||
2. Point to your Git repo
|
||||
3. Set compose file to `docker-compose.coolify.yml`
|
||||
4. Set environment variables including `POSTGRES_PASSWORD`
|
||||
5. Set your domain for the `stickers` service
|
||||
6. Deploy
|
||||
|
||||
**Using Dockerfile (app only):**
|
||||
|
||||
1. Create new resource → **Application** → **Dockerfile**
|
||||
2. Point to your Git repo
|
||||
3. Set environment variables (see `.env.example`)
|
||||
4. Set `DATABASE_URL` to your PostgreSQL instance
|
||||
5. Set your domain
|
||||
6. Deploy
|
||||
|
||||
### Option 2: Docker (Manual)
|
||||
|
||||
```bash
|
||||
# Build and run
|
||||
docker build -t stickers .
|
||||
docker run -p 3000:3000 --env-file .env stickers
|
||||
</pre>
|
||||
docker run -d -p 80:80 \
|
||||
-e SECRET_KEY_BASE="$(rails secret)" \
|
||||
-e DATABASE_URL="postgresql://user:pass@host/db" \
|
||||
-e AIRTABLE_PAT="..." \
|
||||
stickers
|
||||
```
|
||||
|
||||
<p>
|
||||
Made with <3 by
|
||||
<a href="https://github.com/24c02">nora</a>,
|
||||
<a href="https://github.com/EDripper">euan</a>, and
|
||||
<a href="https://github.com/System-End">end</a>.
|
||||
</p>
|
||||
### Production Environment Variables
|
||||
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| `SECRET_KEY_BASE` | Rails secret (generate with `rails secret`) |
|
||||
| `DATABASE_URL` | PostgreSQL connection string |
|
||||
| `AIRTABLE_PAT` | Airtable Personal Access Token |
|
||||
| `AIRTABLE_BASE_ID` | Airtable base ID |
|
||||
| `AIRTABLE_STICKER_DB_TABLE_ID` | Stickers table ID |
|
||||
| `AIRTABLE_SHOP_TABLE_ID` | Shop table ID |
|
||||
| `AIRTABLE_DESIGN_TABLE_ID` | Designs table ID |
|
||||
| `OIDC_ISSUER` | `https://auth.hackclub.com` |
|
||||
| `OIDC_CLIENT_ID` | OIDC client ID |
|
||||
| `OIDC_CLIENT_SECRET` | OIDC client secret |
|
||||
| `OIDC_REDIRECT_URI` | `https://your-domain.com/auth/oidc/callback` |
|
||||
|
||||
See `.env.example` for a complete list.
|
||||
|
||||
---
|
||||
|
||||
Made with <3 by [nora](https://github.com/24c02), [euan](https://github.com/EDripper), and [end](https://github.com/System-End).
|
||||
|
|
|
|||
64
docker-compose.coolify.yml
Normal file
64
docker-compose.coolify.yml
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
|
||||
# Required Environment Variables (set in Coolify UI):
|
||||
# - SECRET_KEY_BASE
|
||||
# - DATABASE_URL
|
||||
# - AIRTABLE_PAT
|
||||
# - AIRTABLE_BASE_ID
|
||||
# - AIRTABLE_STICKER_DB_TABLE_ID
|
||||
# - AIRTABLE_SHOP_TABLE_ID
|
||||
# - AIRTABLE_DESIGN_TABLE_ID
|
||||
# - OIDC_ISSUER
|
||||
# - OIDC_CLIENT_ID
|
||||
# - OIDC_CLIENT_SECRET
|
||||
# - OIDC_REDIRECT_URI
|
||||
|
||||
services:
|
||||
stickers:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "80:80"
|
||||
environment:
|
||||
- RAILS_ENV=production
|
||||
- RAILS_LOG_TO_STDOUT=true
|
||||
- RAILS_SERVE_STATIC_FILES=true
|
||||
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
|
||||
- DATABASE_URL=${DATABASE_URL}
|
||||
- AIRTABLE_PAT=${AIRTABLE_PAT}
|
||||
- AIRTABLE_BASE_ID=${AIRTABLE_BASE_ID}
|
||||
- AIRTABLE_STICKER_DB_TABLE_ID=${AIRTABLE_STICKER_DB_TABLE_ID}
|
||||
- AIRTABLE_SHOP_TABLE_ID=${AIRTABLE_SHOP_TABLE_ID}
|
||||
- AIRTABLE_DESIGN_TABLE_ID=${AIRTABLE_DESIGN_TABLE_ID}
|
||||
- OIDC_ISSUER=${OIDC_ISSUER}
|
||||
- OIDC_CLIENT_ID=${OIDC_CLIENT_ID}
|
||||
- OIDC_CLIENT_SECRET=${OIDC_CLIENT_SECRET}
|
||||
- OIDC_REDIRECT_URI=${OIDC_REDIRECT_URI}
|
||||
- AUTH_SUCCESS_REDIRECT=${AUTH_SUCCESS_REDIRECT:-/stickers}
|
||||
- AUTH_LOGOUT_REDIRECT=${AUTH_LOGOUT_REDIRECT:-/}
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:80/up"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
|
||||
db:
|
||||
image: postgres:17-alpine
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER:-stickers}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- POSTGRES_DB=${POSTGRES_DB:-stickers_production}
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-stickers}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
Loading…
Add table
Reference in a new issue