diff --git a/.env.sample b/.env.sample index a3f6c79..f39cacb 100644 --- a/.env.sample +++ b/.env.sample @@ -1,2 +1,2 @@ DATA_PATH=./data.local -CONFIG_PATH=config.yaml \ No newline at end of file +CONFIG_PATH=./config.yaml \ No newline at end of file diff --git a/README.md b/README.md index c77835d..1999f71 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,41 @@ $ pnpm dev $ pnpm build ``` +## Bootstrapping + +Run the following command to bootstrap a **phCD** instance. As this service doesn't have auth for now, it's strongly recommended to publish only on a local ip like `127.0.0.1` and then access directly or via an ssh tunnel (something like `ssh -L 8080:127.0.0.1:8080 server`). + +```bash +$ git clone https://git.phc.dm.unipi.it/phc/phcd +$ docker built . -t phcd + +$ echo 'deploys: []' > config.yaml +$ cp .env.sample .env + +$ docker run -d \ + --name phcd \ + --restart unless-stopped \ + -p 127.0.0.1:8080:4321 \ + -v ./data.local:./data.local \ + -v ./config.yaml:./config.yaml \ + phcd +``` + +### Updating + +```bash +$ git pull +$ docker stop phcd +$ docker built . -t phcd +$ docker run -d \ + --name phcd \ + --restart unless-stopped \ + -p 127.0.0.1:8080:4321 \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v ./config.yaml:/app/config.yaml \ + phcd +``` + ## Architecture Everything is stored in the `config.yaml` file. This file contains a list of projects to deploy and the configuration for each one. diff --git a/package.json b/package.json index 71273ac..e7b43e7 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,11 @@ "type": "module", "version": "0.0.1", "scripts": { - "dev": "astro dev", - "start": "astro dev", - "build": "astro sync && astro check && astro build", + "dev": "astro sync && astro dev", + "lint": "astro check", + "build": "astro build", "preview": "astro preview", - "astro": "astro" + "start": "node ./dist/server/entry.mjs", }, "dependencies": { "@astrojs/check": "^0.5.6", diff --git a/src/client/Deploy.jsx b/src/client/Deploy.jsx index 44ed1af..333f62c 100644 --- a/src/client/Deploy.jsx +++ b/src/client/Deploy.jsx @@ -1,8 +1,30 @@ import { Value } from './Inspect.jsx' +// const GitRef = ({ type, value }) => { +// return type === 'default' ? ( +//
default
+// ) : ( +//
{value}
+// ) +// } + +// const BaseDeploy = ({ name, ...rest }) => <> +//
{name}
+//
+//
commit
+//
{url}
+//
+// +// + export const Deploy = ({ deploy }) => { return (
+
{deploy.name}
+
{deploy.type}
+
{deploy.type}
+
{deploy.type}
+
) diff --git a/src/config.ts b/src/config.ts index 648a7e7..8c06f93 100644 --- a/src/config.ts +++ b/src/config.ts @@ -7,7 +7,9 @@ import { Mutex } from 'async-mutex' import { debug } from './logger' export const GitRef = z.union([ - z.object({ type: z.literal('default') }), + z.object({ + type: z.literal('default'), + }), z.object({ type: z.union([z.literal('branch'), z.literal('branch'), z.literal('branch')]), value: z.string(), diff --git a/src/styles/main.scss b/src/styles/main.scss index 4e03b18..9995649 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -297,9 +297,15 @@ form { .deploy { width: 100%; - border: 1px solid #ddd; + background: $accent-400; padding: 1rem; border-radius: 1rem; + + display: grid; + + // border: 1px solid #ddd; + // padding: 1rem; + // border-radius: 1rem; } //