Created by Github action --------- Co-authored-by: github-actions <github-actions@twenty.com>
330 lines
9.8 KiB
Plaintext
330 lines
9.8 KiB
Plaintext
---
|
||
title: הגדרה מקומית
|
||
description: "מדריך עבור תורמים (או מפתחים סקרנים) שרוצים להריץ את Twenty במחשב מקומי."
|
||
image: /images/user-guide/fields/field.png
|
||
---
|
||
|
||
<Frame>
|
||
<img src="/images/user-guide/fields/field.png" alt="Header" />
|
||
</Frame>
|
||
|
||
## תנאים מוקדמים
|
||
|
||
<Tabs>
|
||
<Tab title="Linux and MacOS">
|
||
|
||
לפני שתוכל להתקין ולהשתמש ב-Twenty, וודא שהתקנת את הדברים הבאים במחשב שלך:
|
||
|
||
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
||
- [Node v24.5.0](https://nodejs.org/en/download)
|
||
- [yarn v4](https://yarnpkg.com/getting-started/install)
|
||
- [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md)
|
||
|
||
<Warning>
|
||
`npm` לא יעבוד, יש להשתמש ב-`yarn`. Yarn כעת מגיע עם Node.js, כך שאין צורך להתקין אותו בנפרד.
|
||
יש לבצע `corepack enable` כדי להפעיל את Yarn אם לא עשית זאת עדיין.
|
||
</Warning>
|
||
|
||
</Tab>
|
||
|
||
<Tab title="Windows (WSL)">
|
||
|
||
1. התקן את WSL
|
||
פתח PowerShell כמנהל והפעל:
|
||
|
||
```powershell
|
||
wsl --install
|
||
```
|
||
|
||
You should now see a prompt to restart your computer. If not, restart it manually.
|
||
|
||
Upon restart, a powershell window will open and install Ubuntu. ייתכן שהדבר ייקח קצת זמן.
|
||
You'll see a prompt to create a username and password for your Ubuntu installation.
|
||
|
||
2. התקן וקבע את הקונפיגורציה של git
|
||
|
||
```bash
|
||
sudo apt-get install git
|
||
|
||
git config --global user.name "Your Name"
|
||
|
||
git config --global user.email "youremail@domain.com"
|
||
```
|
||
|
||
3. התקן nvm, node.js ו-yarn
|
||
|
||
<Warning>
|
||
השתמש ב-`nvm` להתקנת הגרסה הנכונה של `node`. ה-.nvmrc מבטיח שכל התורמים ישתמשו באותה גרסה.
|
||
</Warning>
|
||
|
||
```bash
|
||
sudo apt-get install curl
|
||
|
||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
|
||
```
|
||
|
||
סגור ופתח מחדש את הטרמינל כדי להשתמש ב-nvm. לאחר מכן הפעל את הפקודות הבאות.
|
||
|
||
```bash
|
||
|
||
nvm install # installs recommended node version
|
||
|
||
nvm use # use recommended node version
|
||
|
||
corepack enable
|
||
```
|
||
|
||
</Tab>
|
||
</Tabs>
|
||
|
||
---
|
||
|
||
## Step 1: Git Clone
|
||
|
||
בטרמינל שלך, הפעל את הפקודה הבאה.
|
||
|
||
<Tabs>
|
||
<Tab title="SSH (Recommended)">
|
||
אם לא הקמת מפתחות SSH עדיין, תוכל ללמוד כיצד לעשות זאת [כאן](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/about-ssh).
|
||
```bash
|
||
git clone git@github.com:twentyhq/twenty.git
|
||
```
|
||
</Tab>
|
||
<Tab title="HTTPS">
|
||
|
||
```bash
|
||
git clone https://github.com/twentyhq/twenty.git
|
||
```
|
||
|
||
</Tab>
|
||
</Tabs>
|
||
|
||
## שלב 2: המיקום ברמת השורש
|
||
|
||
```bash
|
||
cd twenty
|
||
```
|
||
|
||
יש להפעיל את כל הפקודות מהשלבים הבאים מרמת השורש של הפרויקט.
|
||
|
||
## שלב 3: הגדרת מסד נתונים PostgreSQL
|
||
|
||
<Tabs>
|
||
<Tab title="Linux">
|
||
**Option 1 (preferred):** To provision your database locally:
|
||
Use the following link to install Postgresql on your Linux machine: [Postgresql Installation](https://www.postgresql.org/download/linux/)
|
||
```bash
|
||
psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;"
|
||
```
|
||
Note: You might need to add `sudo -u postgres` to the command before `psql` to avoid permission errors.
|
||
|
||
````
|
||
**Option 2:** If you have docker installed:
|
||
```bash
|
||
make postgres-on-docker
|
||
```
|
||
````
|
||
|
||
</Tab>
|
||
<Tab title="Mac OS">
|
||
**Option 1 (preferred):** To provision your database locally with `brew`:
|
||
|
||
````
|
||
```bash
|
||
brew install postgresql@16
|
||
export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH"
|
||
brew services start postgresql@16
|
||
psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;"
|
||
```
|
||
|
||
You can verify if the PostgreSQL server is running by executing:
|
||
```bash
|
||
brew services list
|
||
```
|
||
|
||
The installer might not create the `postgres` user by default when installing
|
||
via Homebrew on MacOS. Instead, it creates a PostgreSQL role that matches your macOS
|
||
username (e.g., "john").
|
||
To check and create the `postgres` user if necessary, follow these steps:
|
||
```bash
|
||
# Connect to PostgreSQL
|
||
psql postgres
|
||
or
|
||
psql -U $(whoami) -d postgres
|
||
```
|
||
|
||
Once at the psql prompt (postgres=#), run:
|
||
```bash
|
||
# List existing PostgreSQL roles
|
||
\du
|
||
```
|
||
You'll see output similar to:
|
||
```bash
|
||
Role name | Attributes | Member of
|
||
-----------+-------------+-----------
|
||
john | Superuser | {}
|
||
```
|
||
|
||
If you do not see a `postgres` role listed, proceed to the next step.
|
||
Create the `postgres` role manually:
|
||
```bash
|
||
CREATE ROLE postgres WITH SUPERUSER LOGIN;
|
||
```
|
||
This creates a superuser role named `postgres` with login access.
|
||
|
||
**Option 2:** If you have docker installed:
|
||
```bash
|
||
make postgres-on-docker
|
||
```
|
||
````
|
||
|
||
</Tab>
|
||
<Tab title="Windows (WSL)">
|
||
All the following steps are to be run in the WSL terminal (within your virtual machine)
|
||
|
||
````
|
||
**Option 1:** To provision your Postgresql locally:
|
||
Use the following link to install Postgresql on your Linux virtual machine: [Postgresql Installation](https://www.postgresql.org/download/linux/)
|
||
```bash
|
||
psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;"
|
||
```
|
||
Note: You might need to add `sudo -u postgres` to the command before `psql` to avoid permission errors.
|
||
|
||
**Option 2:** If you have docker installed:
|
||
Running Docker on WSL adds an extra layer of complexity.
|
||
Only use this option if you are comfortable with the extra steps involved, including turning on [Docker Desktop WSL2](https://docs.docker.com/desktop/wsl).
|
||
```bash
|
||
make postgres-on-docker
|
||
```
|
||
````
|
||
|
||
</Tab>
|
||
</Tabs>
|
||
|
||
כעת תוכל לגשת למסד הנתונים ב-[localhost:5432](localhost:5432), עם המשתמש `postgres` והסיסמה `postgres` .
|
||
|
||
## שלב 4: הגדרת מסד נתונים של Redis (מטמון)
|
||
|
||
Twenty זקוק למטמון redis כדי לספק את הביצועים הטובים ביותר
|
||
|
||
<Tabs>
|
||
<Tab title="Linux">
|
||
**Option 1:** To provision your Redis locally:
|
||
Use the following link to install Redis on your Linux machine: [Redis Installation](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/)
|
||
|
||
````
|
||
**Option 2:** If you have docker installed:
|
||
```bash
|
||
make redis-on-docker
|
||
```
|
||
````
|
||
|
||
</Tab>
|
||
<Tab title="Mac OS">
|
||
**Option 1 (preferred):** To provision your Redis locally with `brew`:
|
||
```bash
|
||
brew install redis
|
||
```
|
||
Start your redis server:
|
||
```brew services start redis```
|
||
|
||
````
|
||
**Option 2:** If you have docker installed:
|
||
```bash
|
||
make redis-on-docker
|
||
```
|
||
````
|
||
|
||
</Tab>
|
||
<Tab title="Windows (WSL)">
|
||
**Option 1:** To provision your Redis locally:
|
||
Use the following link to install Redis on your Linux virtual machine: [Redis Installation](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/)
|
||
|
||
````
|
||
**Option 2:** If you have docker installed:
|
||
```bash
|
||
make redis-on-docker
|
||
```
|
||
````
|
||
|
||
</Tab>
|
||
</Tabs>
|
||
|
||
אם אתה זקוק לממשק גרפי, אנו ממליצים על [redis insight](https://redis.io/insight/) (גרסה חינמית זמינה)
|
||
|
||
## שלב 5: הגדר משתנים סביבתיים
|
||
|
||
השתמש במשתנים סביבתיים או בקבצי `.env` כדי לקבוע את הקונפיגורציה של הפרויקט שלך. מידע נוסף [כאן](https://docs.twenty.com/l/he/developers/self-hosting/setup)
|
||
|
||
העתק את קבצי `.env.example` ב-`/front` וב-`/server`:
|
||
|
||
```bash
|
||
cp ./packages/twenty-front/.env.example ./packages/twenty-front/.env
|
||
cp ./packages/twenty-server/.env.example ./packages/twenty-server/.env
|
||
```
|
||
|
||
## שלב 6: התקנת חבילות תלות
|
||
|
||
כדי לבנות את שרת ה-Twenty ולהזין מעט נתונים למסד הנתונים שלך, הפעל את הפקודה הבאה:
|
||
|
||
```bash
|
||
yarn
|
||
```
|
||
|
||
לידיעתך, `npm` או `pnpm` לא יעבדו
|
||
|
||
## שלב 7: הפעלת הפרויקט
|
||
|
||
<Tabs>
|
||
<Tab title="Linux">
|
||
תלוי בהפצת הלינוקס שלך, ייתכן ששרת Redis יתחיל אוטומטית.
|
||
אם לא, בדוק את [מדריך ההתקנה של Redis](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/) עבור ההפצה שלך.
|
||
</Tab>
|
||
<Tab title="Mac OS">
|
||
שרת Redis כבר אמור לפעול. If not, run:
|
||
```bash
|
||
brew services start redis
|
||
```
|
||
</Tab>
|
||
<Tab title="Windows (WSL)">
|
||
תלוי בהפצת הלינוקס שלך, ייתכן ששרת Redis יתחיל אוטומטית.
|
||
אם לא, בדוק את [מדריך ההתקנה של Redis](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/) עבור ההפצה שלך.
|
||
</Tab>
|
||
</Tabs>
|
||
|
||
הגדר את בסיס הנתונים שלך עם הפקודה הבאה:
|
||
|
||
```bash
|
||
npx nx database:reset twenty-server
|
||
```
|
||
|
||
הפעל את השרת, העובד ואת השירותים של הממשק הקדמי:
|
||
|
||
```bash
|
||
npx nx start twenty-server
|
||
npx nx worker twenty-server
|
||
npx nx start twenty-front
|
||
```
|
||
|
||
לחילופין, ניתן להפעיל את כל השירותים בבת אחת:
|
||
|
||
```bash
|
||
npx nx start
|
||
```
|
||
|
||
## שלב 8: השתמש ב-Twenty
|
||
|
||
**ממשק קדמי**
|
||
|
||
הממשק הקדמי של Twenty יפעל בכתובת [http://localhost:3001](http://localhost:3001).
|
||
ניתן להיכנס באמצעות חשבון הדמו הברירת מחדלי: `tim@apple.dev` (סיסמה: `tim@apple.dev`)
|
||
|
||
**ממשק אחורי**
|
||
|
||
- השרת של Twenty יפעל בכתובת [http://localhost:3000](http://localhost:3000)
|
||
- ניתן לגשת ל-API של GraphQL בכתובת [http://localhost:3000/graphql](http://localhost:3000/graphql)
|
||
- ניתן להגיע ל-API של REST בכתובת [http://localhost:3000/rest](http://localhost:3000/rest)
|
||
|
||
## פתרון תקלות
|
||
|
||
אם אתה נתקל בכל בעיה, בדוק את [פתרון תקלות](https://docs.twenty.com/l/he/developers/self-hosting/troubleshooting) לפתרונות. |