diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5d76eb1 --- /dev/null +++ b/.dockerignore @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..507394c --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/README.md b/README.md index 2ec3297..e5f728e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docker-compose.build.yml b/docker-compose.build.yml new file mode 100644 index 0000000..03315d5 --- /dev/null +++ b/docker-compose.build.yml @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..01b8964 --- /dev/null +++ b/docker-compose.yml @@ -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 diff --git a/server/server.ts b/server/server.ts index 016fdbe..84aec4f 100644 --- a/server/server.ts +++ b/server/server.ts @@ -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"; diff --git a/src/pages/[lang]/index.astro b/src/pages/[lang]/index.astro index 6f8d811..43658d7 100644 --- a/src/pages/[lang]/index.astro +++ b/src/pages/[lang]/index.astro @@ -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" >

Version: { VERSION }

diff --git a/src/pages/loading.astro b/src/pages/loading.astro index 4a10ecc..042197b 100644 --- a/src/pages/loading.astro +++ b/src/pages/loading.astro @@ -1,10 +1,10 @@ --- -import Loading from "@components/Loading.astro"; +import LoadingComponent from "@components/Loading.astro"; import Layout from "@layouts/Layout.astro"; --- - +