Skip to main content

setup-dev-testing

c--- id: scealai-dev-testing-setup-guide sidebar_position: 2

Setup: Dev Testing

Setup Dev Testing on An Scealai VM

1. SSH into the An Scealai VM

ssh [username]@[ip address] -p [port]

2. Clone the Repository

Navigate to your user directory and run:

git clone https://github.com/phonlab-tcd/An-Scealai.git

3. Setup GitHub Personal Access Token

To install the private gramadoir-ts package:

  • Ensure you're part of the phonlab-tcd GitHub organisation.
  • On GitHub go to:
    User Profile > Settings > Developer Settings > Personal Access Tokens > Tokens (classic)
    Click Generate new token (classic).
  • Enable the following scopes: repo, write, and project.
  • Click Generate token.
  • Copy and store this token safely — you won't see it again.

4. Configure .npmrc in ngapp

cd ./ngapp

Create or edit the .npmrc file with:

# .npmrc
//npm.pkg.github.com/:_authToken={YOUR_CLASSIC_GITHUB_TOKEN}
@phonlab-tcd:registry=https://npm.pkg.github.com/

⚠️ .npmrc is gitignored, so your token won’t be committed.

5. Install Dependencies

cd ./ngapp
npm install

cd ../api
npm install

6. Build the Backend

cd ./api
npm run build

⚠️ You might encounter errors in:

  • sentenceAudio.ts
  • synthesiseAndStoreSent.ts
  • drStory.route.ts

These may not prevent the app from running. It's okay to leave them alone until you've reviewed the code.

7. Add a Custom Start Script (if missing)

In both ./ngapp/package.json and ./api/package.json, look under "scripts":

Example:

"start:conor": "DB=neimhin-dev PORT=61000 nodemon dist/server.js"
  • Replace conor with your name.
  • Use a unique port not already in use.
  • Set the API port to one above your ngapp port for consistency.

8. Setup the .env File

cd ./api
cp .env.example .env
# edit if needed

9. Get Root User Permissions

sudo su

📝 Make sure you've already checked out your branch before doing this.
If you checkout as root, you may trigger a "dubious ownership" error.

10. Check for Existing tmux Sessions

tmux ls

If sessions exist (e.g. conor-api: 1 windows), they may already be running and using required ports.

Stop Existing Services

tmux attach -t conor-api     # replace with your API session name
Ctrl+C # to stop the process
Ctrl+B then D # to detach
tmux kill-session -t conor-api

Repeat the same steps for ngapp.

11. Run API in Persistent Terminal

cd ./api
tmux new -s [api-session-name]
npm run start:conor # replace with your script
# To detach:
Ctrl+B then D

❗ If you get errors regarding JSON Web Token keys in load_keys.ts, that's normal and discussed later.

12. Run Frontend (ngapp) in Persistent Terminal

cd ./ngapp
tmux new -s [ngapp-session-name]
npm run start:conor # or your start script
# To detach:
Ctrl+B then D

13. Start MongoDB Test Database (if not already running)

The production uses a single mongodb database hosted using systemctl that each developer uses. Check if the server is up and running with:

sudo systemctl status mongod

If the server is running, you don’t need to start it.

Otherwise:

sudo systemctl start mongod