Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated documentation for devcontainers #3100

Merged
merged 2 commits into from
Jan 30, 2025

Conversation

palisadoes
Copy link
Contributor

@palisadoes palisadoes commented Jan 30, 2025

Updated documentation for devcontainers

Summary by CodeRabbit

  • Documentation

    • Updated installation documentation with clearer section headers and more precise setup instructions
    • Simplified PostgreSQL database setup process
    • Clarified development mode operation commands
  • Configuration

    • Updated database host configuration from postgres to localhost

@palisadoes palisadoes added the ignore-sensitive-files-pr The contributor has a legitimate reason for editiing protected files label Jan 30, 2025
Copy link

coderabbitai bot commented Jan 30, 2025

Walkthrough

The pull request focuses on improving the installation documentation for the Talawa API. The changes include restructuring the installation.md file to provide clearer, more concise instructions for setting up the project. Additionally, the environment configuration file .env.devcontainer has been updated to modify the PostgreSQL host configuration, changing the database host from postgres to localhost.

Changes

File Change Summary
docs/docs/docs/getting-started/installation.md - Rephrased section headers for clarity
- Restructured "Using the VScode IDE" section
- Simplified PostgreSQL database setup instructions
- Updated Docker devcontainer commands
- Improved development mode operation instructions
envFiles/.env.devcontainer - Changed API_POSTGRES_HOST from postgres to localhost

Sequence Diagram

sequenceDiagram
    participant User
    participant VSCode
    participant Docker
    participant PostgreSQL

    User->>VSCode: Install devcontainer extension
    User->>VSCode: Open project directory
    VSCode->>Docker: Build devcontainer
    Docker->>PostgreSQL: Set up local database
    User->>VSCode: Start application in dev mode
Loading

Possibly related PRs


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Our Pull Request Approval Process

Thanks for contributing!

Testing Your Code

Remember, your PRs won't be reviewed until these criteria are met:

  1. We don't merge PRs with poor code quality.
    1. Follow coding best practices such that CodeRabbit.ai approves your PR.
  2. We don't merge PRs with failed tests.
    1. When tests fail, click on the Details link to learn more.
    2. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository
    3. Tests may fail if you edit sensitive files. Ask to add the ignore-sensitive-files-pr label if the edits are necessary.
  3. We cannot merge PRs with conflicting files. These must be fixed.

Our policies make our code better.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

codecov bot commented Jan 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 39.85%. Comparing base (7d4f843) to head (e918f91).
Report is 4 commits behind head on develop-postgres.

Additional details and impacted files
@@                Coverage Diff                @@
##           develop-postgres    #3100   +/-   ##
=================================================
  Coverage             39.85%   39.85%           
=================================================
  Files                   453      453           
  Lines                 33203    33203           
  Branches                385      385           
=================================================
  Hits                  13234    13234           
  Misses                19969    19969           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ce6165 and e918f91.

📒 Files selected for processing (2)
  • docs/docs/docs/getting-started/installation.md (3 hunks)
  • envFiles/.env.devcontainer (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
docs/docs/docs/getting-started/installation.md

201-201: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


205-205: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


237-237: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


237-237: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


239-239: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


241-241: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


241-241: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


243-243: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


245-245: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


245-245: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


247-247: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


249-249: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


249-249: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


270-270: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


273-273: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)

🪛 LanguageTool
docs/docs/docs/getting-started/installation.md

[grammar] ~248-~248: The word “output” is spelled as one word.
Context: ...e startup is complete, the last line of out put should look like this: ``` {"outc...

(OUT_COMPOUNDS)


[grammar] ~257-~257: The word “setup” is a noun. The verb is spelled with a space.
Context: ...## Setup: Using the VScode IDE You can setup the app using the VScode IDE. Here are ...

(NOUN_VERB_CONFUSION)


[style] ~265-~265: Consider using the more formal “until”.
Context: ...take a few minutes to complete. 1. Wait till the process is complete and you see por...

(TILL)


[uncategorized] ~265-~265: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...te. 1. Wait till the process is complete and you see ports being forwarded in the te...

(COMMA_COMPOUND_SENTENCE)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Run tests for talawa api
  • GitHub Check: Analyse Code With CodeQL (typescript)
🔇 Additional comments (3)
envFiles/.env.devcontainer (1)

35-35: Verify database connectivity with the new host configuration.

The change from postgres to localhost aligns with the documentation updates. However, we should verify that:

  1. The database is accessible on localhost
  2. The application can connect to it successfully
✅ Verification successful

Change to localhost is correct for devcontainer environment

The modification from postgres to localhost in .env.devcontainer is valid and follows proper devcontainer patterns. The database will be accessible because:

  • The PostgreSQL container port is correctly mapped to the host
  • The devcontainer configuration includes proper networking setup
  • This follows standard Docker development container practices
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify database connectivity with the new host configuration

# Test 1: Check if PostgreSQL is listening on localhost
echo "Testing PostgreSQL connectivity..."
nc -zv localhost 5432

# Test 2: Check if the database exists and is accessible
PGPASSWORD=password psql -h localhost -U talawa -d talawa -c "\l" >/dev/null 2>&1
if [ $? -eq 0 ]; then
    echo "Successfully connected to database"
else
    echo "Failed to connect to database"
fi

Length of output: 354


Script:

#!/bin/bash
# Check other env files and docker configurations for database host patterns
echo "=== Environment Files ==="
fd -t f -e .env -e .env.example -e .env.sample . | xargs cat 2>/dev/null || true

echo -e "\n=== Docker Compose Files ==="
fd -t f -e yml -e yaml . | grep -i docker-compose | xargs cat 2>/dev/null || true

echo -e "\n=== Database Configuration Documentation ==="
fd README -t f . | xargs grep -i "database\|postgres" 2>/dev/null || true

Length of output: 527


Script:

#!/bin/bash
# Broader search for database and container configuration
echo "=== Environment Templates ==="
find . -type f -name "*.env*" -o -name "*.example" -o -name "*.sample" 2>/dev/null | xargs cat 2>/dev/null || true

echo -e "\n=== Container Configurations ==="
find . -type f -name "*dockerfile*" -o -name "*compose*" -o -name "*.dc.*" 2>/dev/null | xargs cat 2>/dev/null || true

echo -e "\n=== Setup Documentation ==="
find . -type f -name "CONTRIBUTING*" -o -name "DEVELOPMENT*" -o -name "INSTALL*" -o -name "*.md" 2>/dev/null | xargs grep -i -l "setup\|install\|database\|postgres" 2>/dev/null || true

echo -e "\n=== Database Configuration Patterns ==="
rg -l "(?i)(database_url|db_host|postgres.*host)" || true

Length of output: 33039

docs/docs/docs/getting-started/installation.md (2)

Line range hint 181-195: LGTM! Clear and improved section headers.

The section headers have been updated for better clarity and consistency.

🧰 Tools
🪛 LanguageTool

[style] ~179-~179: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...tainers 7. Typescript 8. Node.js It is very important that you go through [this](https://code...

(EN_WEAK_ADJECTIVE)


276-276: LGTM! Clear development mode operation instructions.

The development mode operation instructions are clear and provide both normal and debugging mode options.

Comment on lines +200 to +207
1. Install the PostgreSQL database.
```bash
sudo apt-get -y install postgresql postgresql-contrib
sudo systemctl enable postgresql.service
sudo systemctl start postgresql.service
```
1. Connect to the PostgreSQL CLI

```bash
sudo -u postgres psql

```

1. Create the database, grant permissions then exit
```sql
CREATE DATABASE talawa;
CREATE USER talawa WITH PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE talawa TO talawa;
GRANT ALL ON SCHEMA public TO talawa;
sudo systemctl disable postgresql.service
sudo systemctl stop postgresql.service
```
1. There is no need to create databases, users and any associated permissions
1. These steps are done so that the docker container will have access to the PostgreSQL executables
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Simplify PostgreSQL setup instructions.

The instructions have been simplified by removing manual database creation steps. However, we should clarify that the PostgreSQL service needs to be stopped to avoid port conflicts with the Docker container.

 1. Install the PostgreSQL database.
    ```bash
    sudo apt-get -y install postgresql postgresql-contrib
    sudo systemctl disable postgresql.service
    sudo systemctl stop postgresql.service
    ```
+   1. The PostgreSQL service must be stopped to avoid port conflicts with the Docker container
    1. There is no need to create databases, users and any associated permissions
    1. These steps are done so that the docker container will have access to the PostgreSQL executables
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

201-201: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


205-205: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)

Comment on lines +236 to +251
1. Build the docker devcontainer
```
devcontainer build --workspace-folder .
```
1. When startup is complete, the last like of the output should be:
1. When build is complete, the last line of the output should be:
```
{"outcome":"success","imageName":"talawa-api"}
```
All done!
1. Start the docker devcontainer
```
devcontainer up --workspace-folder .
```
1. When the startup is complete, the last line of out put should look like this:
```
{"outcome":"success","containerId":"XXX","composeProjectName":"talawa","remoteUser":"talawa","remoteWorkspaceFolder":"/home/talawa/api"}
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Fix formatting and typos in the devcontainer setup instructions.

The instructions need some formatting improvements and typo fixes.

 1. Build the docker devcontainer
-   ```
+   ```bash
    devcontainer build --workspace-folder .
    ```
 1. When build is complete, the last line of the output should be:
-   ```
+   ```json
    {"outcome":"success","imageName":"talawa-api"}
    ```
 1. Start the docker devcontainer
-   ```
+   ```bash
    devcontainer up --workspace-folder .
    ```
-1. When the startup is complete, the last line of out put should look like this:
+1. When the startup is complete, the last line of output should look like this:
-   ```
+   ```json
    {"outcome":"success","containerId":"XXX","composeProjectName":"talawa","remoteUser":"talawa","remoteWorkspaceFolder":"/home/talawa/api"}
    ```
🧰 Tools
🪛 LanguageTool

[grammar] ~248-~248: The word “output” is spelled as one word.
Context: ...e startup is complete, the last line of out put should look like this: ``` {"outc...

(OUT_COMPOUNDS)

🪛 markdownlint-cli2 (0.17.2)

237-237: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


237-237: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


239-239: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


241-241: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


241-241: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


243-243: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


245-245: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


245-245: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


247-247: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


249-249: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


249-249: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

Comment on lines +257 to +269
You can setup the app using the VScode IDE. Here are the steps to follow:

1. Open cloned talawa-api project in Visual Studio Code.
2. You should see a notification that a `devcontainer` configuration file is available. Click on the notification and select `Reopen in Container`.
1. Install the `devcontainer` extension in VScode.
1. You should see a notification that a `devcontainer` configuration file is available. Click on the notification and select `Reopen in Container`.
- If you don't see the notification, you can open the command palette by pressing `Ctrl+Shift+P` and search for `Reopen in Container`.
- Make sure you have downloaded `devcontainer` extension of vs code.
3. 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.
4. Wait till the process is complete and you see ports being forwarded in the terminal.
5. You can check logs by clicking `Connecting to Dev Container (show log)`;
6. Create a new terminal in Visual Studio Code by pressing `` Ctrl+Shift+` ``.
7. Run the `pwd` command to confirm you are in the `/home/talawa/api` directory.
8. Run the following command to check if the project has required dependencies installed correctly:
1. 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.
1. Wait till the process is complete and you see ports being forwarded in the terminal.
1. You can check logs by clicking `Connecting to Dev Container (show log)`;
1. Create a new terminal in Visual Studio Code by pressing `` Ctrl+Shift+` ``.
1. Run the `pwd` command to confirm you are in the `/home/talawa/api` directory.
1. Run the following command to check if the project has required dependencies installed correctly:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Fix grammar and improve VScode IDE setup instructions.

The instructions need some grammar fixes and clarity improvements.

-You can setup the app using the VScode IDE. Here are the steps to follow:
+You can set up the app using the VScode IDE. Here are the steps to follow:

 1. Open cloned talawa-api project in Visual Studio Code.
 1. Install the `devcontainer` extension in VScode.
 1. You should see a notification that a `devcontainer` configuration file is available. Click on the notification and select `Reopen in Container`.
    - If you don't see the notification, you can open the command palette by pressing `Ctrl+Shift+P` and search for `Reopen in Container`.
-   - Make sure you have downloaded `devcontainer` extension of vs code.
+   - Make sure you have installed the `devcontainer` extension in VS Code.
 1. 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.
-1. Wait till the process is complete and you see ports being forwarded in the terminal.
+1. Wait until the process is complete and you see ports being forwarded in the terminal.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
You can setup the app using the VScode IDE. Here are the steps to follow:
1. Open cloned talawa-api project in Visual Studio Code.
2. You should see a notification that a `devcontainer` configuration file is available. Click on the notification and select `Reopen in Container`.
1. Install the `devcontainer` extension in VScode.
1. You should see a notification that a `devcontainer` configuration file is available. Click on the notification and select `Reopen in Container`.
- If you don't see the notification, you can open the command palette by pressing `Ctrl+Shift+P` and search for `Reopen in Container`.
- Make sure you have downloaded `devcontainer` extension of vs code.
3. 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.
4. Wait till the process is complete and you see ports being forwarded in the terminal.
5. You can check logs by clicking `Connecting to Dev Container (show log)`;
6. Create a new terminal in Visual Studio Code by pressing `` Ctrl+Shift+` ``.
7. Run the `pwd` command to confirm you are in the `/home/talawa/api` directory.
8. Run the following command to check if the project has required dependencies installed correctly:
1. 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.
1. Wait till the process is complete and you see ports being forwarded in the terminal.
1. You can check logs by clicking `Connecting to Dev Container (show log)`;
1. Create a new terminal in Visual Studio Code by pressing `` Ctrl+Shift+` ``.
1. Run the `pwd` command to confirm you are in the `/home/talawa/api` directory.
1. Run the following command to check if the project has required dependencies installed correctly:
You can set up the app using the VScode IDE. Here are the steps to follow:
1. Open cloned talawa-api project in Visual Studio Code.
1. Install the `devcontainer` extension in VScode.
1. You should see a notification that a `devcontainer` configuration file is available. Click on the notification and select `Reopen in Container`.
- If you don't see the notification, you can open the command palette by pressing `Ctrl+Shift+P` and search for `Reopen in Container`.
- Make sure you have installed the `devcontainer` extension in VS Code.
1. 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.
1. Wait until the process is complete and you see ports being forwarded in the terminal.
1. You can check logs by clicking `Connecting to Dev Container (show log)`;
1. Create a new terminal in Visual Studio Code by pressing `` Ctrl+Shift+` ``.
1. Run the `pwd` command to confirm you are in the `/home/talawa/api` directory.
1. Run the following command to check if the project has required dependencies installed correctly:
🧰 Tools
🪛 LanguageTool

[grammar] ~257-~257: The word “setup” is a noun. The verb is spelled with a space.
Context: ...## Setup: Using the VScode IDE You can setup the app using the VScode IDE. Here are ...

(NOUN_VERB_CONFUSION)


[style] ~265-~265: Consider using the more formal “until”.
Context: ...take a few minutes to complete. 1. Wait till the process is complete and you see por...

(TILL)


[uncategorized] ~265-~265: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...te. 1. Wait till the process is complete and you see ports being forwarded in the te...

(COMMA_COMPOUND_SENTENCE)

@palisadoes palisadoes merged commit a2b736c into PalisadoesFoundation:develop-postgres Jan 30, 2025
17 of 18 checks passed
@palisadoes palisadoes deleted the docs branch January 30, 2025 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ignore-sensitive-files-pr The contributor has a legitimate reason for editiing protected files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant