Operation
Introduction
The correct configuration steps to take depends on whether you are:
- an end user installing our software (Production Environments) or,
- one of our open source contributors (Development Environments).
Make sure you have installed and configured the application correctly beforehand.
Proceed to the relevant section below.
Production Environment Operation
Operation of the production environment is easy.
Production Server Startup
Start the server by running the following command:
docker compose up
Production Server Shutdown
To stop the Docker Server, use this command:
docker compose down
Development Environment Operation
We make heavy use of Docker containers in our workflows. Since containers are a Linux-based technology, on non-Linux platforms they require Linux emulation through virtual machines, which can impact performance. So, you should be aware that there are performance penalties and certain limitations with running containers on platforms like MacOS and Windows.
Ensure you have a good understanding of these talawa-api technologies:
- Operating Systems:
- Unix based operating systems like linux based distributions, MacOS
- Windows Subsystem for Linux.
- Git
- Github
- Docker
- Docker compose
- Visual studio code with devcontainers
- Typescript
- Node.js
Here is some additional information that you'll need to know:
- If you are running Windows, we
STRONGLY RECOMMENDthat you run all commands using Windows Subsystem for Linux. - It is very important that you go through the Devcontainers Official Documentation for working with devcontainers in VScode.
Please proceed to the next sub-section.
DevContainer Setup
You will first need to ensure that the DevContainer is setup correctly.
Using the CLI
Most of these steps are specific to Linux. You will need to modify them accordingly for other operating systems
-
Ensure you have correctly configured your
.envconfiguration file. Use the Configuration Guide for assistance. -
Install the
devcontainers/clipackagepnpm install -g @devcontainers/cli -
You will now need to make your user a part of the
dockeroperating system group or else you will getpermission deniedmessages when starting docker later.$USERis a universal representation of your username. You don't need to change this in the command below.sudo usermod -a -G docker $USER -
You will only become a part of the
dockergroup on your next login. You don't have to logout, just start another session on the CLI using thesucommand.sudo su $USER - -
Build the docker devcontainer
devcontainer build --workspace-folder . -
When the build is complete, the last line of the output should be:
{"outcome":"success","imageName":"talawa-api"} -
Start the docker devcontainer
devcontainer up --workspace-folder . -
When the container startup is complete, the last lines of output should look like this:
...
...
{"outcome":"success", "containerId":"81306766f2aeeb851c8ebb844702d39ad2adc09419508b736ef2ee5a03eb8e34", "composeProjectName":"talawa","remoteUser":"talawa","remoteWorkspaceFolder":"/home/talawa/api"}
All done!
Using the VScode IDE
You can setup the app using the VScode IDE. Here are the steps to follow:
- Open cloned talawa-api project in Visual Studio Code.
- Install the
devcontainerextension in VScode. - You should see a notification that a
devcontainerconfiguration file is available. Click on the notification and selectReopen in Container.- If you don't see the notification, you can open the command palette by pressing
Ctrl+Shift+Pand search forReopen in Container. - Make sure you have downloaded
devcontainerextension of vs code.
- If you don't see the notification, you can open the command palette by pressing
- This will open a new Visual Studio Code window with the project running inside a Docker container. This will take a few minutes to complete.
- Wait till the process is complete and you see ports being forwarded in the terminal.
- You can check logs by clicking
Connecting to Dev Container (show log); - Create a new terminal in Visual Studio Code by pressing
Ctrl+Shift+`. - Run the
pwdcommand to confirm you are in the/home/talawa/apidirectory. - Run the following command to check if the project has required dependencies installed correctly:
node -v
pnpm -v
All done!
Development Server Startup
The Development Server startup methodology depends on your environment.
From the CLI
After a successful installation of the DevContainer environment, use these commands to start the application's Docker container.
-
To run in attached Mode
docker exec talawa-api-1 /bin/bash -c 'pnpm run start_development_server' -
To run in detached Mode
docker exec talawa-api-1 /bin/bash -c 'nohup pnpm run start_development_server > /dev/null 2>&1 &'
Within VScode
You can run the app after closing the terminal or restating the vscode using these commands:
-
for normal mode
pnpm run start_development_server -
for debugging mode
pnpm run start_development_server_with_debugger
Note: These commands will start the server in development mode.
Development Server Shutdown
Use the command docker compose command to cleanly shut down the dev container
docker compose down
Importing Sample Data
This applies to users running Talawa API in dev containers.
- Once the server is running, open a new terminal session.
- Run the following command to import sample data into the database:
docker exec talawa-api-1 /bin/bash -c 'pnpm run add:sample_data && exit'
Refer to the next section for login information.
Sample Data Users
Below is a table of user login credentials for the sample data.
| Name | Email Address | Password | Role |
|---|---|---|---|
| Wilt Shepherd | testsuperadmin@example.com | Pass@123 | administrator |
| Vyvyan Kerry | testadmin1@example.com | Pass@123 | administrator |
| Loyd Solomon | testadmin2@example.com | Pass@123 | administrator |
| Darcy Wilf | testadmin3@example.com | Pass@123 | administrator |
| Harve Lance | testuser1@example.com | Pass@123 | regular |
| Praise Norris | testuser2@example.com | Pass@123 | regular |
| Scott Tony | testuser3@example.com | Pass@123 | regular |
| Teresa Bradley | testuser4@example.com | Pass@123 | regular |
| Bruce Garza | testuser5@example.com | Pass@123 | regular |
| Burton Sanders | testuser6@example.com | Pass@123 | regular |
| Jeramy Garcia | testuser7@example.com | Pass@123 | regular |
| Deanne Marks | testuser8@example.com | Pass@123 | regular |
| Romeo Holland | testuser9@example.com | Pass@123 | regular |
| Carla Nguyen | testuser10@example.com | Pass@123 | regular |
| Peggy Bowers | testuser11@example.com | Pass@123 | regular |
Testing and Validation
Please refer to the Testing and Validation Page for more details.