Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.1.0 #4

Merged
merged 3 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy Node.js CI - DO-001

on:
push:
branches: [develop]

jobs:
build:
runs-on: [ubuntu-22.04]

steps:
- name: Deploy development
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.MAIN_IP }}
username: ${{ secrets.GHA_USER }}
key: ${{ secrets.GHA_SSH }}
passphrase: ${{ secrets.GHA_PW }}
script: |
eval `ssh-agent -s`
cd ./_server/${{ vars.REPO_NAME }}/dev/
rm -rf ./${{ vars.REPO_NAME }}
ssh-add ~/.ssh/${{ secrets.REPO_SSH_NAME }}
git clone [email protected]:squeeble-ink/${{ vars.REPO_NAME }}.git
cd ./${{ vars.REPO_NAME }}
git checkout develop
rm ./nginx/prd.conf
docker compose up dev -d --build
29 changes: 29 additions & 0 deletions .github/workflows/deploy-prd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deploy Node.js CI - DO-001

on:
push:
branches: [main]

jobs:
build:
runs-on: [ubuntu-22.04]
env:
NODE_ENV: production

steps:
- name: Deploy production
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.MAIN_IP }}
username: ${{ secrets.GHA_USER }}
key: ${{ secrets.GHA_SSH }}
passphrase: ${{ secrets.GHA_PW }}
script: |
eval `ssh-agent -s`
cd ./_server/${{ vars.REPO_NAME }}/prd/
rm -rf ./${{ vars.REPO_NAME }}
ssh-add ~/.ssh/${{ secrets.REPO_SSH_NAME }}
git clone [email protected]:squeeble-ink/${{ vars.REPO_NAME }}.git
cd ./${{ vars.REPO_NAME }}
rm ./nginx/dev.conf
docker compose up prd -d --build
62 changes: 62 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# SE Readme Changelog

## [[v2.1.0] - 2024/02/19](https://github.com/squeeble-ink/stackexchange.readme-stats/releases/tag/v2.1.0)

### Added

- Explanation how to use
- GitHub workflows for deployment
- nginx configuration for deployment

### Fixed

- Site name centering
- User name centering
- nameX parameter still works as expected

### Changed

- Docker service names to include project name

## [[v2.0.0] - 2023/04/24](https://github.com/squeeble-ink/stackexchange.readme-stats/releases/tag/v2.0.0)

### Added

- Running project stand-alone via Docker
- Created a dev env to run project in development mode

### Fixed

- Issue when Stack Exchange API is down OR hitting rate limit
- Issue when User was not found on Stack Exchange site


## [[v1.1.1] - 2022/07/10](https://github.com/squeeble-ink/stackexchange.readme-stats/releases/tag/v1.1.1)

### Fixed

- Documentation on how to use the API

## [[v1.1.0] - 2021/01/06](https://github.com/squeeble-ink/stackexchange.readme-stats/releases/tag/v1.1.0)

### Added

- Ask Ubuntu website
- Extended SVG with optional
- User name instead of image
- User name outline from left

## [[v1.0.0] - 2020/09/28](https://github.com/squeeble-ink/stackexchange.readme-stats/releases/tag/v1.0.0)

### Added

- Meta Exchange website
- Stack Overflow website
- Shows a SVG with
- Stack Exchange site name
- User profile image
- User score on said Stack Exchange site
- Users badges with dynamic scaling
- Gold
- Silver
- Bronze
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Dynamically generated stackexchange stats for your github readmes

Please NOTE that this project is run on our server.
This means that we placed here the route that is fired on our server.
Our server runs on express.js

## How to use

- with profile picture:
Expand All @@ -16,16 +12,19 @@ Our server runs on express.js
![Tessa's stackoverflow stats](http://api.squeeble.ink/se/?userId=7185314&seSite=stackoverflow)
- without profile pictue:
```markdown
![alt text](http://api.squeeble.ink/se/?userId=<USERiD>&seSite=<STACKeXCHANGEsITE>&img=false&nameX=22)
![alt text](http://api.squeeble.ink/se/?userId=<USERiD>&seSite=<STACKeXCHANGEsITE>&img=false)
```
result:
![Tessa's stackoverflow stats](http://api.squeeble.ink/se/?userId=7185314&seSite=stackoverflow&img=false&nameX=22)
![Tessa's stackoverflow stats](http://api.squeeble.ink/se/?userId=7185314&seSite=stackoverflow&img=false)
NOTE: nameX is so you can line out your user name

Integrated stack exchange sites `<STACKeXCHANGEsITE>`:
- Stack Overflow
- Meta
- Ask Ubuntu


More comming soon!

## How to deploy


20 changes: 9 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
version: '2'
version: '3'

services:
dev:
container_name: stack-readme-dev
profiles: ['dev']
prd:
container_name: stack-readme-prd
build:
context: .
dockerfile: stack-readme-dev.dockerfile
dockerfile: stack-readme-prd.dockerfile
args:
- api_key=${STACK_EXCHANGE_API_KEY}
ports:
- '3040:3040'
prd:
container_name: stack-readme-prd
profiles: ['prd']
- '3070:3070'
dev:
container_name: stack-readme-dev
build:
context: .
dockerfile: stack-readme-prd.dockerfile
dockerfile: stack-readme-dev.dockerfile
args:
- api_key=${STACK_EXCHANGE_API_KEY}
ports:
- '3344:3344'
- '3071:3071'
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import cors from 'cors'
import stackExchange from './routes/stackExchange.route.js'

const fallbackPort =
process.env.NODE_ENV === 'production' ? 3344 : 3040
process.env.NODE_ENV === 'production' ? 3070 : 3071
const port = process.env.PORT
? parseInt(process.env.PORT, 10)
: fallbackPort
Expand Down
65 changes: 65 additions & 0 deletions nginx/dev.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
upstream shackexchange_readme_stats {
server 127.0.0.1:2990;
keepalive 8;
}

server {
listen 80;

server_name dev-api.squeeble.ink dev-api.sqbl.me;

location /se {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

proxy_pass http://shackexchange_readme_stats/;
}
}

server {
listen 443 ssl;

ssl_certificate /etc/letsencrypt/live/squeeble.ink/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/squeeble.ink/privkey.pem;

server_name dev-api.squeeble.ink;

access_log /var/log/nginx/shackexchange_readme_stats.log;

location /se {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

proxy_pass http://shackexchange_readme_stats/;
}
}

server {
listen 443 ssl;

ssl_certificate /etc/letsencrypt/live/sqbl.me/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/sqbl.me/privkey.pem;

server_name dev-api.sqbl.me;

access_log /var/log/nginx/shackexchange_readme_stats.log;

location /se {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

proxy_pass http://shackexchange_readme_stats/;
}
}
65 changes: 65 additions & 0 deletions nginx/prd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
upstream shackexchange_readme_stats {
server 127.0.0.1:2990;
keepalive 8;
}

server {
listen 80;

server_name api.squeeble.ink api.sqbl.me;

location /se {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

proxy_pass http://shackexchange_readme_stats/;
}
}

server {
listen 443 ssl;

ssl_certificate /etc/letsencrypt/live/squeeble.ink/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/squeeble.ink/privkey.pem;

server_name api.squeeble.ink;

access_log /var/log/nginx/shackexchange_readme_stats.log;

location /se {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

proxy_pass http://shackexchange_readme_stats/;
}
}

server {
listen 443 ssl;

ssl_certificate /etc/letsencrypt/live/sqbl.me/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/sqbl.me/privkey.pem;

server_name api.sqbl.me;

access_log /var/log/nginx/shackexchange_readme_stats.log;

location /se {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

proxy_pass http://shackexchange_readme_stats/;
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stackexchange.readme-stats",
"version": "1.0.0",
"version": "2.1.0",
"description": "Stack Exchange Readme Stats",
"main": "index.js",
"type": "module",
Expand Down
Loading