Skip to content

Commit 13581d5

Browse files
authored
Merge pull request #1 from webNeat/develop
Implement alpha.3 version
2 parents 46a28fb + 5c473b4 commit 13581d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2940
-6
lines changed

.github/workflows/pr.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: PR checks
2+
on:
3+
pull_request:
4+
branches: [main]
5+
jobs:
6+
check_pr:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: actions/setup-node@v1
11+
with:
12+
node-version: 22
13+
- run: npm i
14+
- run: npm run build
15+
- run: npm test

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.log
2+
.DS_Store
3+
node_modules
4+
dist
5+
.tests
6+
hvps
7+
lab

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"printWidth": 155,
5+
"trailingComma": "all"
6+
}

README.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,59 @@
11
# Hosty
22

3-
Self host your web apps and services with ease.
3+
A code based opinionated way to self-host and manage web apps.
44

5-
**This package is still under development, not ready for use yet!**
5+
# Quick Example
6+
7+
```ts
8+
import {app, db, deploy, run} from 'hosty'
9+
10+
// 1. Specify what you want to deploy
11+
12+
// A postgres database
13+
const database = db.postgres({
14+
name: 'my-db',
15+
user: 'db_user',
16+
pass: 'db_pass'
17+
})
18+
19+
// An application from a Git repo
20+
const api = app.git({
21+
name: 'my-api',
22+
repo: 'https://url-to-my-repo.git',
23+
branch: 'main',
24+
domain: 'my-api-domain.com',
25+
env: {
26+
PORT: '80',
27+
DB_HOST: database.host,
28+
DB_USER: database.user,
29+
DB_PASS: database.pass,
30+
DB_NAME: database.name,
31+
},
32+
})
33+
34+
// 2. Specify where you want deploy
35+
const myVPS = server({
36+
name: '188.114.97.6' // hostname or IP
37+
})
38+
39+
// 3. Deploy
40+
deploy(myVPS, database, api)
41+
run()
42+
```
43+
44+
This code will do the following:
45+
1. Connect to your server via SSH
46+
2. Create the postgres database
47+
3. Clone your repo, build and run it
48+
4. Configure the domain with https support
49+
50+
# Requirements
51+
**On local machine:**
52+
- [Ansible](https://www.ansible.com/) (tested with v2.16.6)
53+
- Nodejs (tested with v22.8)
54+
55+
**On the server**
56+
- A Linux server that uses `apt` and `systemctl` (tested on Ubuntu 22.04)
57+
- A user with `sudo` ability (using the root user is not recommended)
58+
59+
...

files.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/srv/hosty/
2+
services/
3+
db-foo/
4+
compose.yaml
5+
...
6+
app-foo/
7+
.ports
8+
local ports to use
9+
compose.yaml
10+
source.yaml
11+
repo: 'repo url'
12+
branch: 'deployed branch'
13+
commit: 'last deployed commit hash'
14+
Caddyfile
15+
...
16+
backups/
17+
db-foo/
18+
yyyy-mm-dd_hh-mm-ss.sql.gz
19+
...
20+

index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)