From 04981209da52d182a9b96ba0f8683a91252e77f1 Mon Sep 17 00:00:00 2001 From: kimatata <117462761+kimatata@users.noreply.github.com> Date: Sun, 25 May 2025 21:17:32 +0900 Subject: [PATCH] Docs update (#229) --- docs/docs/getstarted/deployment.md | 3 +- docs/docs/getstarted/docker.md | 2 +- docs/docs/getstarted/environment.md | 52 +++++++++++++++----- docs/docs/getstarted/from-source.md | 75 +++++++++++++++++++++++++++++ docs/docs/getstarted/manual.md | 61 ----------------------- docs/docs/getstarted/selfhost.md | 2 +- 6 files changed, 119 insertions(+), 76 deletions(-) create mode 100644 docs/docs/getstarted/from-source.md delete mode 100644 docs/docs/getstarted/manual.md diff --git a/docs/docs/getstarted/deployment.md b/docs/docs/getstarted/deployment.md index ae0c373..d96c89d 100644 --- a/docs/docs/getstarted/deployment.md +++ b/docs/docs/getstarted/deployment.md @@ -1,5 +1,6 @@ --- -sidebar_position: 4 +sidebar_position: 5 +draft: true --- # Deployment diff --git a/docs/docs/getstarted/docker.md b/docs/docs/getstarted/docker.md index 9c9b5fc..ac78200 100644 --- a/docs/docs/getstarted/docker.md +++ b/docs/docs/getstarted/docker.md @@ -10,7 +10,7 @@ First, clone the repository. git clone https://github.com/kimatata/unittcms.git ``` -and start containers with the following command. +and start container with the following command. ```bash cd unittcms diff --git a/docs/docs/getstarted/environment.md b/docs/docs/getstarted/environment.md index 022cb74..aa3c25c 100644 --- a/docs/docs/getstarted/environment.md +++ b/docs/docs/getstarted/environment.md @@ -1,28 +1,56 @@ --- -sidebar_position: 5 +sidebar_position: 4 --- # Override settings -The system will work with default settings without setting environment variables, but you can override the settings by placing `.env` file. +UnitTCMS will work with the default settings, but you can override them as needed. -## setting frontend environment variables +:::warning[Strongly Recommended] -Create `.env` File on `frontend/` +It is strongly recommended to change `SECRET_KEY` from the default value in production. + +::: + +## Docker + +If you are self-hosting UnitTCMS with Docker, you can customize the environment using the `environment` section in `docker-compose.yaml`. + +```yaml title="docker-compose.yaml" +services: + unittcms: + image: unittcms:latest + build: . + ports: + - '8000:8000' + // highlight-start + environment: + - PORT=8000 + - SECRET_KEY=your_secret_key_here + - IS_DEMO=false # set to true to seed the database + // highlight-end + volumes: + - db-data:/app/backend/database + +volumes: + db-data: +``` + +## From Source + +If you are self-hosting UnitTCMS from source, you can override the environment by placing `.env` files in the appropriate directory. + +### Setting frontend environment variables + +Create a `.env` file in the `frontend/` directory: ```.env title="frontend/.env" NEXT_PUBLIC_BACKEND_ORIGIN=http://localhost:8001 ``` -## setting backend environment variables +### Setting backend environment variables -Create `.env` File on `backend/` - -:::warning[Strongly Recommended] - -It is strongly recommended to set SECRET_KEY in production. - -::: +Create a `.env` file in the `backend/` directory: ```.env title="backend/.env" FRONTEND_ORIGIN=http://localhost:8000 diff --git a/docs/docs/getstarted/from-source.md b/docs/docs/getstarted/from-source.md new file mode 100644 index 0000000..39a061d --- /dev/null +++ b/docs/docs/getstarted/from-source.md @@ -0,0 +1,75 @@ +--- +sidebar_position: 3 +--- + +# Running UnitTCMS from Source + +While using Docker is the recommended and easiest way to run UnitTCMS, this chapter explains how to run it directly from source. This approach is useful for those who cannot use Docker or are interested in contributing to UnitTCMS development. Since the frontend and backend are completely decoupled, this setup also supports more advanced use cases — such as serving the frontend via AWS S3 + CloudFront, or replacing the default SQLite database with another backend solution. + +:::info[Prerequisite] + +Prerequisite: v20 or higher node must be installed. + +::: + +To use UnitTCMS, you need to run both frontend server and backend(API) server. + +First, clone the repository. + +```bash +git clone https://github.com/kimatata/unittcms.git +``` + +## Run backend server + +Place the .env file at `backend/.env`. + +```.env title="backend/.env" +FRONTEND_ORIGIN=http://localhost:8000 +``` + +Move to backend directory, then install dependencies. + +```bash +cd backend +npm install +``` + +Initialize the database with the following command. + +```bash +npm run migrate +``` + +Start backend server. + +```bash +npm run start +``` + +## Run frontend server + +Move to frontend directory, then install dependencies. + +Place the .env file at `frontend/.env`. + +```.env title="frontend/.env" +NEXT_PUBLIC_BACKEND_ORIGIN=http://localhost:8001 +``` + +```bash +cd frontend +npm install +``` + +Build frontend code + +```bash +npm run build +``` + +Start frontend server + +```bash +npm run start +``` diff --git a/docs/docs/getstarted/manual.md b/docs/docs/getstarted/manual.md deleted file mode 100644 index 11f4535..0000000 --- a/docs/docs/getstarted/manual.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -sidebar_position: 3 ---- - -# Running UnitTCMS manually - -:::info[Prerequisite] - -Prerequisite: v20 or higher node must be installed. - -::: - -To use UnitTCMS, you need run frontend server and backend(API) server. - -First, clone the repository. - -```bash -git clone https://github.com/kimatata/unittcms.git -``` - -## Run backend server - -Move to backend directory, then install dependencies. - -```bash -cd backend -npm ci -``` - -Initialize the database with the following command. - -```bash -npm run migrate -``` - -Start backend server. - -```bash -npm run start -``` - -## Run frontend server - -Move to frontend directory, then install dependencies. - -```bash -cd frontend -npm ci -``` - -Build frontend code - -```bash -npm run build -``` - -Start frontend server - -``` -npm run start -``` diff --git a/docs/docs/getstarted/selfhost.md b/docs/docs/getstarted/selfhost.md index 3b8ccd5..0fbe953 100644 --- a/docs/docs/getstarted/selfhost.md +++ b/docs/docs/getstarted/selfhost.md @@ -7,4 +7,4 @@ sidebar_position: 1 UnitTCMS is designed for self-hosted use. There are two ways to self-host the application: “Docker” and “Manual”. - Docker (Recommended) -- Manual +- From Source