Skip to content

Commit 752101b

Browse files
committed
delete docker-compose.yml as its not supported by most cpanels
1 parent 980dad2 commit 752101b

27 files changed

+184
-241
lines changed

.env.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SQLITE_DATABASE_NAME=users.sqlite
1+
SQLITE_DATABASE_PATH=./_data/users.sqlite
22

33
# Use Litestream to backup SQLite database on every insert
44
REPLICA_URL=https://<account_id>.r2.cloudflarestorage.com

Makefile

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
.PHONY: build-dev
22
build-dev: ## Build the development docker image.
3-
BUILDKIT_PROGRESS=plain docker compose -f docker/development/docker-compose.yml build
3+
docker build -f docker/production/Dockerfile -t easypanel-nextjs:0.0.1 --target development .
44

55
.PHONY: start-dev
66
start-dev: ## Start the development docker container.
7-
BUILDKIT_PROGRESS=plain docker compose -f docker/development/docker-compose.yml up -d
7+
docker run -d -p 3000:3000 -v ./_data:/data --env-file .env.development --restart unless-stopped easypanel-nextjs:0.0.1
88

99
.PHONY: stop-dev
1010
stop-dev: ## Stop the development docker container.
11-
BUILDKIT_PROGRESS=plain docker compose -f docker/development/docker-compose.yml down
11+
docker stop $$(docker ps -a -q --filter ancestor=easypanel-nextjs:0.0.1)
1212

1313
.PHONY: build-staging
1414
build-staging: ## Build the staging docker image.
15-
BUILDKIT_PROGRESS=plain docker compose -f docker/staging/docker-compose.yml build
15+
docker build -f docker/production/Dockerfile -t easypanel-nextjs:0.0.1 .
1616

1717
.PHONY: start-staging
1818
start-staging: ## Start the staging docker container.
19-
BUILDKIT_PROGRESS=plain docker compose -f docker/staging/docker-compose.yml up -d
19+
docker run -d -p 3000:3000 -v ./_data:/data --env-file .env.staging --restart unless-stopped easypanel-nextjs:0.0.1
2020

2121
.PHONY: stop-staging
2222
stop-staging: ## Stop the staging docker container.
23-
BUILDKIT_PROGRESS=plain docker compose -f docker/staging/docker-compose.yml down
23+
docker stop $$(docker ps -a -q --filter ancestor=easypanel-nextjs:0.0.1)
2424

2525
.PHONY: build-prod
2626
build-prod: ## Build the production docker image.
27-
BUILDKIT_PROGRESS=plain docker compose -f docker/production/docker-compose.yml build
27+
docker build -f docker/production/Dockerfile -t easypanel-nextjs:0.0.1 .
2828

2929
.PHONY: start-prod
3030
start-prod: ## Start the production docker container.
31-
BUILDKIT_PROGRESS=plain docker compose -f docker/production/docker-compose.yml up -d
31+
docker run -d -p 3000:3000 -v ./_data:/data --env-file .env.production --restart unless-stopped easypanel-nextjs:0.0.1
3232

3333
.PHONY: stop-prod
3434
stop-prod: ## Stop the production docker container.
35-
BUILDKIT_PROGRESS=plain docker compose -f docker/production/docker-compose.yml down
35+
docker stop $$(docker ps -a -q --filter ancestor=easypanel-nextjs:0.0.1)

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,13 @@ time=2024-02-28T05:44:51.720Z level=INFO msg="snapshot written" db=/data/users.p
5959
time=2024-02-28T05:44:52.234Z level=INFO msg="write wal segment" db=/data/users.prod.sqlite replica=s3 position=ab8dd20a19bb28f7/00000000:0
6060
time=2024-02-28T05:44:52.602Z level=INFO msg="wal segment written" db=/data/users.prod.sqlite replica=s3 position=ab8dd20a19bb28f7/00000000:0 elapsed=367.834931ms sz=4152
6161
```
62+
63+
#### Easypanel Volume Mount
64+
65+
1. Go to `Storage` > Click `Add Volume Mount` > Put `Name` as anything and `Mount Path` as `/etc/easypanel/projects/[project]/[services]/volumes/data/`
66+
2. Use `/data` as directory
67+
68+
Hypothesis:
69+
70+
1. Use `/etc/easypanel/projects/[project]/[services]/volumes/data/` as `Data Path`
71+
2. Use `/data` as directory
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
52ccf2b50b81d149

_data/FIRST_TIME_MIGRATION_staging

Whitespace-only changes.

_data/users.staging.sqlite.tmp-shm

32 KB
Binary file not shown.

_data/users.staging.sqlite.tmp-wal

Whitespace-only changes.

docker/development/docker-compose.yml

-18
This file was deleted.

docker/production/Dockerfile

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ FROM node:20-alpine AS base
44

55
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
66
RUN apk add --no-cache libc6-compat
7-
RUN corepack enable && corepack prepare [email protected] --activate
7+
RUN corepack enable && corepack prepare [email protected] --activate
8+
9+
# Copied from https://stackoverflow.com/a/69867550/6141587
10+
USER root
11+
# Give /data directory correct permissions otherwise WAL mode won't work. It means you can't have 2 users writing to the database at the same time without this line as *.sqlite-wal & *.sqlite-shm are automatically created & deleted when *.sqlite is busy.
12+
RUN mkdir -p /data && chown -R node:node /data
813

914
# 1. Install all dependencies including devDependencies
1015
FROM base AS development
@@ -25,12 +30,6 @@ COPY --chown=node:node . .
2530
ENV NODE_ENV development
2631
ENV NEXT_TELEMETRY_DISABLED 1
2732

28-
# Copied from https://stackoverflow.com/a/69867550/6141587
29-
USER root
30-
# Give /data directory correct permissions otherwise WAL mode won't work. It means you can't have 2 users writing to the database at the same time without this line as *.sqlite-wal & *.sqlite-shm are automatically created & deleted when *.sqlite is busy.
31-
RUN mkdir -p /data && chown -R node:node /data
32-
33-
USER node
3433
RUN --mount=type=cache,id=pnpm,target=~/.pnpm-store pnpm install --frozen-lockfile --recursive --prefer-offline
3534
# Install native node_modules in Dockerfile so it uses pnpm's supportedArchitectures feature in package.json. sharp is required only if you use next/image optimization
3635
RUN --mount=type=cache,id=pnpm,target=~/.pnpm-store pnpm install [email protected] --recursive --prefer-offline

docker/production/docker-compose.yml

-16
This file was deleted.

docker/staging/docker-compose.yml

-16
This file was deleted.

drizzle.config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import * as dotenv from 'dotenv'
66

77
dotenv.config({ path: '.env.development' })
88

9-
if (!process.env.SQLITE_DATABASE_NAME) {
10-
throw Error(`process.env.SQLITE_DATABASE_NAME isn't set!`)
9+
if (!process.env.SQLITE_DATABASE_PATH) {
10+
throw Error(`process.env.SQLITE_DATABASE_PATH isn't set!`)
1111
}
1212

1313
// only ran in development so no need to dd a production check
14-
const url = `${process.env.SQLITE_DATABASE_NAME}`
14+
const url = `${process.env.SQLITE_DATABASE_PATH}`
1515

1616
export default {
1717
schema: './src/app/db/schema.ts',

litestream.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dbs:
2-
- path: /data/${SQLITE_DATABASE_NAME}
2+
- path: ${SQLITE_DATABASE_PATH}
33
replicas:
44
- type: s3
55
endpoint: ${REPLICA_URL}

package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@
2323
"@ngneat/falso": "^7.2.0",
2424
"@t3-oss/env-nextjs": "^0.9.2",
2525
"better-sqlite3": "^9.4.3",
26-
"drizzle-orm": "^0.30.2",
26+
"drizzle-orm": "^0.30.6",
2727
"jiti": "^1.21.0",
28-
"next": "14.1.3",
28+
"next": "14.1.4",
2929
"react": "^18.2.0",
3030
"react-dom": "^18.2.0",
3131
"std-env": "^3.7.0",
3232
"zod": "^3.22.4"
3333
},
3434
"devDependencies": {
3535
"@types/better-sqlite3": "^7.6.9",
36-
"@types/node": "^20.11.27",
37-
"@types/react": "^18.2.66",
38-
"@types/react-dom": "^18.2.22",
36+
"@types/node": "^20.12.2",
37+
"@types/react": "^18.2.73",
38+
"@types/react-dom": "^18.2.23",
3939
"dotenv": "^16.4.5",
4040
"drizzle-kit": "^0.20.14",
41-
"knip": "^5.1.0",
41+
"knip": "^5.7.0",
4242
"rimraf": "^5.0.5",
4343
"tsx": "^4.7.1",
44-
"typescript": "^5.4.2"
44+
"typescript": "^5.4.3"
4545
},
4646
"pnpm": {
4747
"supportedArchitectures": {

0 commit comments

Comments
 (0)