Skip to content

Commit 12958f8

Browse files
authored
Feat: add production Docker Compose setup, LICENSE, and README docume… (#3)
* Feat: add production Docker Compose setup, LICENSE, and README documentation * Fix: update footer link to point to the correct GitHub repository * ~favicon * Feat: enhance SEO and social sharing metadata in app.html * Fix: update README to clarify project setup instructions * Fix: update supervisord configuration for improved logging and process management * Fix: remove JWT_SECRET from configuration loading
1 parent 7538d93 commit 12958f8

File tree

10 files changed

+157
-32
lines changed

10 files changed

+157
-32
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [2024] [Petrakis Georgios]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# ✂️ **GoShort** - Fast and customizable URL shortener
2+
3+
### Demo: [https://x.yup.gr](http://x.yup.gr)
4+
5+
GoShort is a fast and customizable URL shortener built with Go , Svelte and TailwindCSS. It is designed to be self-hosted and easy to deploy.
6+
7+
![GoShort](web/static/banner.png)
8+
9+
---
10+
11+
## 📋 **Table of Contents**
12+
13+
1. [Features](#-features)
14+
2. [Installation](#-installation)
15+
3. [Contributing](#-contributing)
16+
4. [License](#-license)
17+
5. [Security](#-security)
18+
---
19+
20+
## 🚀 **Features**
21+
22+
- **Fast**: GoShort is built with Go and is blazing fast.
23+
- **Customizable**: GoShort is built with Svelte and TailwindCSS, making it easy to customize.
24+
- **Self-hosted**: You own your data and can deploy GoShort on your own server.
25+
- **Custom URLs**: You can set custom URLs for your short links.
26+
- **Expiration**: You can set expiration for your short links.
27+
28+
---
29+
30+
## 🛠️ **Installation**
31+
32+
> Checkout docker-compose.prod.yml for a sample production setup.
33+
34+
---
35+
36+
## 🤝 **Contributing**
37+
38+
1. Fork the repository.
39+
2. Create a new branch: `git checkout -b my-feature-branch`
40+
3. Make your changes and add tests.
41+
4. Submit a pull request.
42+
43+
---
44+
45+
## 📄 **License**
46+
47+
GoShort is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
48+
49+
---
50+
51+
## 🔒 **Security**
52+
53+
We take security seriously and appreciate your efforts to responsibly disclose vulnerabilities. Checkout [SECURITY.md](SECURITY.md) for more information.

docker-compose.prod.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
services:
2+
goshort-db:
3+
image: postgres:17-alpine
4+
container_name: goshort_db
5+
environment:
6+
POSTGRES_USER: goshort
7+
POSTGRES_PASSWORD: goshort_password
8+
POSTGRES_DB: goshort
9+
volumes:
10+
- ./postgres_data:/var/lib/postgresql/data
11+
healthcheck:
12+
test: ["CMD-SHELL", "pg_isready -U goshort -d goshort"]
13+
interval: 10s
14+
timeout: 5s
15+
retries: 5
16+
networks:
17+
- goshort_net
18+
19+
goshort:
20+
image: ghcr.io/kek-sec/goshort:1.0.1
21+
container_name: goshort_app
22+
environment:
23+
DATABASE_URL: postgres://goshort:goshort_password@goshort-db:5432/goshort?sslmode=disable
24+
depends_on:
25+
goshort-db:
26+
condition: service_healthy
27+
ports:
28+
- 8081:80
29+
networks:
30+
- goshort_net
31+
32+
networks:
33+
goshort_net:
34+
external: true

pkg/config/config.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ func Load() {
1717

1818
configMap = map[string]string{
1919
"DATABASE_URL": os.Getenv("DATABASE_URL"),
20-
"JWT_SECRET": os.Getenv("JWT_SECRET"),
2120
"PORT": os.Getenv("PORT"),
2221
}
2322
}

supervisord.conf

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,38 @@
11
[supervisord]
22
nodaemon=true
33
user=root
4-
logfile=/tmp/supervisord.log
4+
logfile=/var/log/supervisord.log
55
logfile_maxbytes=50MB
66
logfile_backups=10
77
loglevel=info
8-
pidfile=/tmp/supervisord.pid
8+
pidfile=/var/run/supervisord.pid
99
identifier=supervisor
1010

1111
[program:goshort]
1212
command=/app/goshort
13+
directory=/app
14+
environment=APP_ENV=production,APP_LOG_LEVEL=info
1315
autorestart=true
1416
startsecs=3
15-
stdout_logfile=/dev/stdout
16-
stderr_logfile=/dev/stderr
17-
stdout_logfile_maxbytes=0
18-
stderr_logfile_maxbytes=0
17+
stdout_logfile=/var/log/goshort_stdout.log
18+
stderr_logfile=/var/log/goshort_stderr.log
19+
stdout_logfile_maxbytes=10MB
20+
stderr_logfile_maxbytes=10MB
21+
stdout_logfile_backups=5
22+
stderr_logfile_backups=5
23+
user=nobody
24+
umask=022
25+
stopsignal=TERM
1926

2027
[program:nginx]
2128
command=nginx -g "daemon off;"
2229
autorestart=true
2330
startsecs=3
24-
stdout_logfile=/dev/stdout
25-
stderr_logfile=/dev/stderr
26-
stdout_logfile_maxbytes=0
27-
stderr_logfile_maxbytes=0
31+
stdout_logfile=/var/log/nginx_stdout.log
32+
stderr_logfile=/var/log/nginx_stderr.log
33+
stdout_logfile_maxbytes=10MB
34+
stderr_logfile_maxbytes=10MB
35+
stdout_logfile_backups=5
36+
stderr_logfile_backups=5
37+
user=nginx
38+
stopsignal=QUIT

web/README.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
1-
# sv
2-
3-
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
4-
5-
## Creating a project
6-
7-
If you're seeing this, you've probably already done this step. Congrats!
8-
9-
```bash
10-
# create a new project in the current directory
11-
npx sv create
12-
13-
# create a new project in my-app
14-
npx sv create my-app
15-
```
16-
171
## Developing
182

19-
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
3+
Once you've clone the project and installed dependencies with `npm install` , start a development server:
204

215
```bash
226
npm run dev
@@ -34,5 +18,3 @@ npm run build
3418
```
3519

3620
You can preview the production build with `npm run preview`.
37-
38-
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.

web/src/app.html

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,33 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
6+
<title>GoShort - Simplify Your URLs</title>
7+
8+
<!-- Favicon -->
59
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
6-
<meta name="viewport" content="width=device-width, initial-scale=1" />
10+
11+
<!-- SEO Meta Tags -->
12+
<meta name="description" content="GoShort is a powerful and user-friendly URL shortener. Simplify, manage, and track your links with ease." />
13+
<meta name="keywords" content="URL shortener, GoShort, link management, shorten URLs, track links" />
14+
<meta name="author" content="GoShort Team" />
15+
16+
<!-- Social Sharing / Open Graph -->
17+
<meta property="og:title" content="GoShort - Simplify Your URLs" />
18+
<meta property="og:description" content="GoShort makes it easy to shorten, manage, and track your URLs. Perfect for businesses, marketers, and individuals." />
19+
<meta property="og:image" content="%sveltekit.assets%/banner.png" />
20+
<meta property="og:type" content="website" />
21+
22+
<!-- Twitter Card -->
23+
<meta name="twitter:card" content="summary_large_image" />
24+
<meta name="twitter:title" content="GoShort - Simplify Your URLs" />
25+
<meta name="twitter:description" content="Shorten, manage, and track your URLs with GoShort, the ultimate URL shortener." />
26+
<meta name="twitter:image" content="%sveltekit.assets%/banner.png" />
27+
28+
<!-- App Theme -->
29+
<meta name="theme-color" content="#4caf50" />
30+
31+
<!-- SvelteKit Head -->
732
%sveltekit.head%
833
</head>
934
<body data-sveltekit-preload-data="hover">

web/src/components/Footer.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<p class="text-sm">
1616
View the project on
1717
<a
18-
href="https://github.com/your-repo"
18+
href="https://github.com/kek-Sec/GoShort"
1919
target="_blank"
2020
class="text-blue-600 underline hover:text-blue-500 font-medium"
2121
>

web/static/banner.png

1.23 MB
Loading

web/static/favicon.png

23.3 KB
Loading

0 commit comments

Comments
 (0)