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

Implement alpha version #1

Merged
merged 2 commits into from
Sep 7, 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
15 changes: 15 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: PR checks
on:
pull_request:
branches: [main]
jobs:
check_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 22
- run: npm i
- run: npm run build
- run: npm test
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.log
.DS_Store
node_modules
dist
.tests
hvps
lab
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": true,
"printWidth": 155,
"trailingComma": "all"
}
58 changes: 56 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
# Hosty

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

**This package is still under development, not ready for use yet!**
# Quick Example

```ts
import {app, db, deploy, run} from 'hosty'

// 1. Specify what you want to deploy

// A postgres database
const database = db.postgres({
name: 'my-db',
user: 'db_user',
pass: 'db_pass'
})

// An application from a Git repo
const api = app.git({
name: 'my-api',
repo: 'https://url-to-my-repo.git',
branch: 'main',
domain: 'my-api-domain.com',
env: {
PORT: '80',
DB_HOST: database.host,
DB_USER: database.user,
DB_PASS: database.pass,
DB_NAME: database.name,
},
})

// 2. Specify where you want deploy
const myVPS = server({
name: '188.114.97.6' // hostname or IP
})

// 3. Deploy
deploy(myVPS, database, api)
run()
```

This code will do the following:
1. Connect to your server via SSH
2. Create the postgres database
3. Clone your repo, build and run it
4. Configure the domain with https support

# Requirements
**On local machine:**
- [Ansible](https://www.ansible.com/) (tested with v2.16.6)
- Nodejs (tested with v22.8)

**On the server**
- A Linux server that uses `apt` and `systemctl` (tested on Ubuntu 22.04)
- A user with `sudo` ability (using the root user is not recommended)

...
20 changes: 20 additions & 0 deletions files.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/srv/hosty/
services/
db-foo/
compose.yaml
...
app-foo/
.ports
local ports to use
compose.yaml
source.yaml
repo: 'repo url'
branch: 'deployed branch'
commit: 'last deployed commit hash'
Caddyfile
...
backups/
db-foo/
yyyy-mm-dd_hh-mm-ss.sql.gz
...

1 change: 0 additions & 1 deletion index.js

This file was deleted.

Loading
Loading