This commit is contained in:
MotorTruck1221 2024-10-18 02:58:35 -06:00
parent 162a2fbac3
commit bd28f8590b
No known key found for this signature in database
GPG key ID: 08F417E2B8B61EA4
8 changed files with 98 additions and 19 deletions

16
.dockerignore Normal file
View file

@ -0,0 +1,16 @@
node_modules/
.vscode
npm-debug.log
yarn-error.log
.github/
.env.example
.env
dist/
.git/
.astro/
~/
.gitignore
biome.json
docker-compose.yml
Dockerfile
README.md

19
Dockerfile Normal file
View file

@ -0,0 +1,19 @@
FROM node:22-alpine
WORKDIR /app
COPY package*.json .
COPY . .
RUN apk update
RUN apk add python3 py3-pip alpine-sdk openssl-dev build-base python3-dev
RUN python3 -m pip install setuptools --break-system-packages
RUN cp -n config.example.toml config.toml
RUN npm i -g pnpm
RUN pnpm install
RUN pnpm run build
RUN export TERM=xterm-256colo
VOLUME /app
EXPOSE 8080
ENTRYPOINT ["pnpm"]
CMD ["start", "--color"]

View file

@ -65,7 +65,7 @@
- By default the marketplace is enabled, and uses SQLite
- If you would like to disable the catalog, see [#config](#config)
- For big production instances I would recommend using Postgres over SQLite. To do this see [#config](#config)
- By default, the Docker images use Postgres. If you would like to disable this, see [#docker](#docker)
- To use postgres via the provided docker-compose files, see [#docker](#docker)
---
@ -94,10 +94,10 @@ cp config.example.toml config.toml
4. Modify the `config.toml` file to you liking (docs [here](#environment))
```
nano .env
nano config.toml
```
5. Build the frontend:
5. Build the frontend & server:
```bash
npm run build
```
@ -128,31 +128,29 @@ Prerequisites:
git clone https://github.com/nebulaservices/nebula && cd nebula
```
2. Create an .env file (if using prebuilt image, copy the example from the repo):
2. Create an `config.toml` file (if using prebuilt image, copy the example from the repo):
```bash
cp .env.example .env
cp config.example.toml config.toml
```
3. Modify the .env file to your liking (docs [here](#environment))
3. Modify the `config.toml` file to your liking (docs [here](#environment))
```bash
nano .env
nano config.toml
```
4. Build the docker image (skip if using prebuilt):
```bash
docker build --build-arg BARE_SERVER_OPTION=true GAMES_LINK=true RAMMERHEAD_OPTION=true -t incog:latest
docker build nebula:latest
```
For info on the build arg check [here](#environment)
5. Run the docker images:
- Prebuilt:
```bash
docker run --env-file ./.env motortruck1221/nebula:latest
docker run -v ./config.toml:/app/config.toml ghcr.io/nebulaservices/nebula:latest
```
- Image you built yourself:
```bash
docker run --env-file ./.env incog:latest
docker run -v ./config.toml:/app/config.toml nebula:latest
```
#### Docker Compose
@ -166,14 +164,14 @@ Prerequisites:
git clone https://github.com/nebulaservices/nebula
```
2. Create an .env file (if using prebuilt image, copy the example from the repo):
2. Create an `config.toml` file (if using prebuilt image, copy the example from the repo):
```bash
cp .env.example .env
cp config.example.toml config.toml
```
3. Modify the .env file to your liking (docs on that [here](#environment)]
3. Modify the `config.toml` file to your liking (docs on that [here](#environment)]
```bash
nano .env
nano config.toml
```
4. Build the docker image (skip if using prebuilt):
@ -191,6 +189,11 @@ docker compose -f ./docker-compose.build.yml build
```bash
docker compose -f ./docker-compose.build.yml up
```
#### Extra (Postgres)
- To use Postgres over SQlite, uncomment the DB section in the `docker-compose` file (or use your own postgres DB!). Then, modify the `config.toml` (See: [#config](#config) for knowledge on how to do this)
- To use Postgres over SQlite in a normal docker environment (no compose), you'll have to set one up and then modify the `config.toml` to use it. (See: [#config](#config) for knowledge on how to do this)
---
## Config

21
docker-compose.build.yml Normal file
View file

@ -0,0 +1,21 @@
services:
nebula:
image: ghcr.io/nebulaservices/nebula:latest
container_name: nebula
build: .
restart: unless-stopped
ports:
# HOST:CONTAINER (DO NOT CHANGE THE CONTAINER PORT, UNLESS EDITED IN THE config.toml FILE)
- 8080:8080
volumes:
- ./config.toml:/app/config.toml
# Uncomment the the below stuff to use POSTGRES!
# db:
# image: postgres
# restart: unless-stopped
# environment:
# POSTGRES_PASSWORD: password #CHANGE THIS
# POSTGRES_USER: username
# POSTGRES_DB: db
# volumes:
# - ./db:/var/lib/postgresql/data

20
docker-compose.yml Normal file
View file

@ -0,0 +1,20 @@
services:
nebula:
image: ghcr.io/nebulaservices/nebula:latest
container_name: nebula
restart: unless-stopped
ports:
# HOST:CONTAINER (DO NOT CHANGE THE CONTAINER PORT, UNLESS EDITED IN THE config.toml FILE)
- 8080:8080
volumes:
- ./config.toml:/app/config.toml
# Uncomment the the below stuff to use POSTGRES!
# db:
# image: postgres
# restart: unless-stopped
# environment:
# POSTGRES_PASSWORD: password #CHANGE THIS
# POSTGRES_USER: username
# POSTGRES_DB: db
# volumes:
# - ./db:/var/lib/postgresql/data

View file

@ -10,6 +10,7 @@ import chalk from "chalk";
import Fastify, { FastifyReply, FastifyRequest } from "fastify";
import gradient from "gradient-string";
import { DataTypes, InferAttributes, InferCreationAttributes, Model, Sequelize } from "sequelize";
//@ts-ignore WHY would I want this typechecked AT ALL
import { handler as ssrHandler } from "../dist/server/entry.mjs";
import { parsedDoc } from "./config.js";
import { setupDB } from "./dbSetup.js";

View file

@ -38,7 +38,6 @@ import { VERSION } from "astro:env/client";
id="neb-iframe"
class="hidden z-100 w-full h-full absolute top-0 bottom-0 bg-primary"
src="/loading"
preload="lazy"
></iframe>
<div id="version" class="flex flex-row w-full absolute bottom-4 pr-4 pl-4 text-text-color h-6 justify-between roboto">
<p> Version: { VERSION } </p>

View file

@ -1,10 +1,10 @@
---
import Loading from "@components/Loading.astro";
import LoadingComponent from "@components/Loading.astro";
import Layout from "@layouts/Layout.astro";
---
<Layout title="Loading page..." noHeader="true">
<Loading />
<LoadingComponent />
</Layout>
<script>
import { pageLoad } from "@utils/events";