DEV Community

Genne23v
Genne23v

Posted on

Setting Telescope Dev Environment

Telescope is Seneca open source project that I need to maintain for next four months with other students in the class. The current version is 3.1.3. We will update and add more features to release 4.0.0 by the end of April.

I set up local dev environment as I contributed last year. But it was only front-end due to some issues with backend setup. My change didn't involve backend. So it's good time for me to do the full setup.

First I need to install pre-requisite tools such as Node.js, pnpm, Docker which I already have on my machine. Then I installed packages again with pnpm install because there might be some changes in dependencies. Telescope uses many dependencies built from Docker. So I ran Docker before next step. To avoid the issues from Docker using cached data, it's recommended to run docker system prune -af --volumes.

After clearing old Docker data, I could simply run pnpm services:start to run both frontend and backend on my machine. If I need a different environment setup such as staging or production, I need to copy and paste a config file. But I don't need it now. It uses default config file which is env.development. Also I can run docker-compose --env-file config/env.development up --build -d. This is equivalent to pnpm services:start.

Unlike the last setup backend setup, it seems everything is working except for one that I can't search anything. I'm getting a blocked by CORS policy with 400. I usually got this response when something was wrong. So I asked Telescope community in Slack. I found that I still needed to seed database. To do this, I need to copy ./src/db/env.example to root and run pnpm db:init. It migrates new changes to database and populates data. I have search results now!

After I struggled, some students also had similar problems. I saw one student found a root cause and raised a PR. With this help, I set up my environment much more easily. Yes, it is very important to keep the documents up-to-date all the time.

Top comments (0)