Skip to content

Commit

Permalink
docs: First version of the documentation
Browse files Browse the repository at this point in the history
include guide, architecture and installation
  • Loading branch information
stmh committed Dec 15, 2024
1 parent 7ecab5e commit 565d05b
Show file tree
Hide file tree
Showing 57 changed files with 15,969 additions and 140 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This is a basic workflow to help you get started with Actions

name: Build and deploy documentation

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [docs]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-and-deploy-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Build and Deploy
uses: stmh/vuepress-github-actions-deploy@master
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BUILD_DIR: docs/_site
BUILD_SCRIPT: export FDOCS_HOST=https://scotty.factorial.io && yarn install --ignore-engines && yarn run docs:build
PAGES_CNAME: scotty.factorial.io
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/target
frontend/node_modules
docs/node_modules
apps/test-nginx-creation
/apps/test-nginx
apps/cd-with-db/
Expand Down
141 changes: 1 addition & 140 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,146 +19,7 @@ The repo contains two applications:

## Installation

### Docker

Use the provided docker-image for best results. Map the directory with
all your docker-composed apps to `/app/apps`.

```shell
docker run \
-p 21342:21342 \
-v $PWD/apps:/app/apps \
-v /var/run/docker.sock:/var/run/docker.sock \
ghcr.io/factorial-io/scotty:main
```

You can then visit the docs at http://localhost:21342/rapidocs

To run the cli use

```shell
docker run -it ghcr.io/factorial-io/scotty:main /app/scottyctl
```

If you are running the server also locally via docker, you need to adapt the
`--server` argument, e.g.

```shell
docker run -it ghcr.io/factorial-io/scotty:main \
/app/scottyctl \
--server http://host.docker.internal:21342 \
list
```

### docker compose

Scotty works nicely with traefik. Here's an example docker-compose file to
spin up both services:

```yaml
services:
traefik:
image: "traefik:v3.1"
container_name: "traefik"
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=proxy"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--entryPoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.tlschallenge=true"
#- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.myresolver.acme.email=<YOUR-LETSENCRYPT-MAIL@ADDRESS>"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- "./letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- default
- proxy
restart: unless-stopped
labels:
traefik.enable: true
traefik.http.routers.traefik_https.rule: Host(`traefik.<TLD>`)
traefik.http.routers.traefik_https.entrypoints: websecure
traefik.http.routers.traefik_https.tls: true
traefik.http.routers.traefik_https.tls.certResolver: myresolver
traefik.http.routers.traefik_https.service: api@internal
traefik.http.routers.traefik_https.middlewares: basic-auth-global
traefik.http.middlewares.basic-auth-global.basicauth.users: traefik:$$2y$$05$$OjZDsiX5v1NcqHmfsK2AqePaZ87SNNXDVve9wShlKeZ9KMe1vvD/W

scotty:
image: ghcr.io/factorial-io/scotty:main
volumes:
# we need to map the host apps folder to the same path, otherwise the folder mapping wont match for
# docker compose files of runing apps
- /opt/containers/apps:/opt/containers/apps
- /var/run/docker.sock:/var/run/docker.sock
environment:
RUST_LOG: info
SCOTTY__APPS__ROOT_FOLDER: /opt/containers/apps
SCOTTY__APPS__DOMAIN_SUFFIX: <TLD>
networks:
- default
- proxy
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.scotty.rule=Host(`scotty.<TLD>`)"
- "traefik.http.routers.scotty.entrypoints=websecure"
- "traefik.http.routers.scotty.tls=true"
- "traefik.http.routers.scotty.tls.certresolver=myresolver"
- "traefik.http.routers.service=scotty"
- "traefik.http.services.scotty.loadbalancer.server.port=21342"
networks:
proxy:
external: true
```
To start the services run
```shell
docker network create proxy
docker compose up -d
```

Set the traefik specific config in the `config/local.yaml`:

```yaml
traefik:
network: "proxy"
use_tls: true
certresolver: "myresolver"
```
### Install native apps
#### from github release
Download the latest release from the [releases page](https://github.com/factorial-io/scotty/releases),
make it executable and move it to a location in your path.
#### from source
For now you can build the apps either by checking out the repo and running
`cargo build` or if you are only interested in the executables you can also
use

```shell
# for the cli
cargo install --git https://github.com/factorial-io/scotty.git --bin scottyctl
# for the server
cargo install --git https://github.com/factorial-io/scotty.git --bin scotty
```
Please have a look at the detailed installation instructions [here](docs/content/installation.md)

## CLI usage

Expand Down
32 changes: 32 additions & 0 deletions docs/.fdocs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import config from "@factorial/docs/config.js";

export default function (defaultConfig) {
return config(defaultConfig, {
projectName: "Scotty",
input: "./content",
output: "./_site",
githubUrl: "https://github.com/factorial-io/scotty",
openSource: true,
heroImage: {
src: "/assets/hero.png",
width: 720,
height: 600,
},
logo: {
src: "/assets/logo.svg",
width: 115,
height: 30,
},
footerLogo: {
src: "/assets/logo-white.svg",
width: 115,
height: 30,
},
menu: [
"guide",
"architecture",
"installation",
"changelog",
],
});
}
Loading

0 comments on commit 565d05b

Please sign in to comment.