-
-
Notifications
You must be signed in to change notification settings - Fork 976
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
Feature Request : Add Talawa-API to run as systemd in Linux (All suggestion are taken from codeRabbit AI after resolving those new clean PR ) #2809
base: develop-postgres
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request introduces a comprehensive Linux installation guide for the Talawa API service using systemd. It includes a detailed systemd service configuration file, a startup script ( Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 13
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (6)
example/linux/installation.md
(1 hunks)example/linux/systemd/Talawa-api.sh
(1 hunks)example/linux/systemd/talawa-api.service
(1 hunks)schema.graphql
(13 hunks)test/routes/graphql/gql.tada-cache.d.ts
(1 hunks)test/routes/graphql/gql.tada.d.ts
(8 hunks)
🧰 Additional context used
📓 Learnings (4)
📓 Common learnings
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/installation.md:31-39
Timestamp: 2024-12-29T21:42:33.048Z
Learning: In the context of the Talawa API installation guide for systemd, “talawa-api” is the directory path, while “talawa” is the user created for running the service.
example/linux/installation.md (4)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:30:37.870Z
Learning: When preparing a system service for Talawa API, compare the Node.js version specified in package.json with the installed version first. If mismatched, install the exact version before proceeding to start the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/installation.md:31-39
Timestamp: 2024-12-29T21:42:33.048Z
Learning: In the context of the Talawa API installation guide for systemd, “talawa-api” is the directory path, while “talawa” is the user created for running the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:22:23.358Z
Learning: The user prefers installing Node.js system-wide at version 20.18.0 to match the Talawa API's Node.js version, rather than relying on NVM.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:24:14.320Z
Learning: When preparing Talawa-api.sh, always confirm the presence of package.json before extracting “engines.node” to avoid errors if the file isn't found in the working directory.
example/linux/systemd/Talawa-api.sh (8)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:30:37.870Z
Learning: When preparing a system service for Talawa API, compare the Node.js version specified in package.json with the installed version first. If mismatched, install the exact version before proceeding to start the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:15:55.398Z
Learning: When preparing Talawa-api.sh, explicitly begin by verifying and CDing to the project directory. If package.json is absent, abort with an error instead of silently creating or ignoring it.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: To avoid exposing sensitive environment variables, the Talawa-api.sh script selectively loads only the NODE_ENV variable from .env.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:24:14.320Z
Learning: When preparing Talawa-api.sh, always confirm the presence of package.json before extracting “engines.node” to avoid errors if the file isn't found in the working directory.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:08:27.581Z
Learning: When reading “engines.node” from package.json within Talawa-api.sh, ensure the script is in the correct working directory or references an absolute path. Also confirm the `jq` utility is installed and in scope for the service user.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api.sh script is intended and tested only for Linux environments, leveraging Linux-specific commands and file paths.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:56:37.763Z
Learning: When using Talawa-api.sh, skip auto-creation of the log file and instead exit if the file doesn't exist. A check ensures the user manually creates it with correct permissions before running the script.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api systemd service file automatically restarts the service after 5 seconds if an error occurs, achieving graceful exit use cases for Linux.
example/linux/systemd/talawa-api.service (2)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api systemd service file automatically restarts the service after 5 seconds if an error occurs, achieving graceful exit use cases for Linux.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/talawa-api.service:15-16
Timestamp: 2024-12-29T22:15:10.039Z
Learning: For the Talawa systemd usage, user PurnenduMIshra129th prefers using absolute paths in the service file, as referencing an environment file has caused errors in their setup.
🪛 Markdownlint (0.37.0)
example/linux/installation.md
152-152: Expected: 0 or 2; Actual: 3
Trailing spaces
(MD009, no-trailing-spaces)
157-157: Expected: 0 or 2; Actual: 3
Trailing spaces
(MD009, no-trailing-spaces)
162-162: Expected: 0 or 2; Actual: 3
Trailing spaces
(MD009, no-trailing-spaces)
209-209: Expected: 0 or 2; Actual: 1
Trailing spaces
(MD009, no-trailing-spaces)
215-215: Expected: 0 or 2; Actual: 3
Trailing spaces
(MD009, no-trailing-spaces)
221-221: Expected: 0 or 2; Actual: 3
Trailing spaces
(MD009, no-trailing-spaces)
35-35: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
76-76: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
88-88: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
116-116: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
131-131: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
137-137: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
142-142: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
155-155: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
160-160: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
173-173: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
178-178: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
183-183: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
188-188: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
201-201: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
207-207: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
219-219: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
🔇 Additional comments (19)
test/routes/graphql/gql.tada.d.ts (7)
13-19
: New types for chat and message connections
The newly introduced types (Chat
, ChatMembersConnection
, ChatMembersConnectionEdge
, etc.) look well-structured and consistent with standard GraphQL pagination patterns.
40-40
: Expanded Mutation
object
Adding chat-related fields (createChat
, createChatMembership
, createChatMessage
, etc.) helps cover key operations. Ensure upstream client logic properly handles success and error states for each new mutation.
42-44
: Mutation inputs for chat creation
The field parentChatMessageId
in MutationCreateChatMessageInput
is non-nullable, which might prevent top-level messages if there is no actual parent. Consider making it optional if you allow root-level messages in your chat system.
73-75
: Chat update inputs
All additions (MutationUpdateChatInput
, MutationUpdateChatMembershipInput
, MutationUpdateChatMessageInput
) follow a consistent pattern. Looks good for versioning and partial updates.
91-92
: Pagination of organization chats
OrganizationChatsConnection
and its edge type are well-defined. No issues identified.
117-117
: New queries: chat
and chatMessage
Exposing these queries provides clear entry points. Check permission logic to ensure only authorized users can retrieve chat or message details.
158-158
: Introspection updated with Subscription
The introspection references look coherent with the new subscription fields.
test/routes/graphql/gql.tada-cache.d.ts (1)
8-10
: Modified user country code unions
The union type now includes "at"
alongside "pg"
and other country codes. Verify whether "pg"
remains intentional or if it should be removed if replaced by "at"
.
Also applies to: 12-12, 14-14, 16-16, 18-18, 20-20, 24-24, 26-26, 28-28, 32-32
schema.graphql (5)
Line range hint 86-185
: Introduced Chat
and related types
These definitions (Chat
, ChatMessage
, ChatMembersConnection
, etc.) appear consistent, covering standard chat entity requirements.
Line range hint 828-941
: New chat-based mutations in Mutation
Includes create, delete, and update flows for chats, memberships, and messages. Ensure DB transactions or security checks enforce membership permissions.
1448-1483
: Update inputs for chats, memberships, messages
Requiring role
in MutationUpdateChatMembershipInput
ensures explicit role setting. That’s helpful for clarity.
1844-1855
: OrganizationChatsConnection
Consistent pagination style. No issues found.
2057-2062
: Queries for chat
and chatMessage
Providing direct queries fosters easier retrieval of single chat or message details. Confirm logic for user access control.
example/linux/systemd/talawa-api.service (2)
12-13
: Consider verifying the absolute path correctness.
You’ve emphasized using absolute paths to avoid issues with environment variables not being loaded by systemd. Ensure that /path/to/your/talawa-api/example/linux/systemd/Talawa-api.sh
is valid. Sometimes small typos or directory structure changes can break the service, so a quick check (e.g., systemd-analyze verify
) helps confirm correctness.
14-16
: Align the service’s WorkingDirectory with the actual codebase path.
You’ve indicated:
WorkingDirectory=/path/to/your/talawa-api
Double-check that this is the exact root directory containing the project code, ensuring that commands like npm install
or references to src
and dist
won't break.
example/linux/systemd/Talawa-api.sh (3)
62-72
: Excellent checks for 'jq' presence.
Verifying the installation of jq
before usage is good, preventing unexpected script failures. This ensures graceful handling of missing dependencies.
88-92
: Node.js version mismatch logic is well-handled.
Exiting if the system’s Node.js version doesn’t match engines.node
is a robust approach, ensuring consistent runtime conditions. Good job.
1-5
: 🧹 Nitpick (assertive)
Review the note on environment variables.
You’re explicitly avoiding setting any environment variables here, relying on absolute paths. This is acceptable but might complicate multi-environment setups (e.g., separate staging or QA). If you need future expansions, consider environment files or the EnvironmentFile
directive in systemd with care.
⛔ Skipped due to learnings
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api.sh script is intended and tested only for Linux environments, leveraging Linux-specific commands and file paths.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/talawa-api.service:15-16
Timestamp: 2024-12-29T22:15:10.039Z
Learning: For the Talawa systemd usage, user PurnenduMIshra129th prefers using absolute paths in the service file, as referencing an environment file has caused errors in their setup.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api systemd service file automatically restarts the service after 5 seconds if an error occurs, achieving graceful exit use cases for Linux.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: To avoid exposing sensitive environment variables, the Talawa-api.sh script selectively loads only the NODE_ENV variable from .env.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:56:37.763Z
Learning: When using Talawa-api.sh, skip auto-creation of the log file and instead exit if the file doesn't exist. A check ensures the user manually creates it with correct permissions before running the script.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:47:29.830Z
Learning: When running Talawa-api.sh as a system service under a specific user, ensure the log file’s ownership and permissions align with that user to prevent "Permission denied" on /var/log/talawa-api.log.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:30:37.870Z
Learning: When preparing a system service for Talawa API, compare the Node.js version specified in package.json with the installed version first. If mismatched, install the exact version before proceeding to start the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:15:55.398Z
Learning: When preparing Talawa-api.sh, explicitly begin by verifying and CDing to the project directory. If package.json is absent, abort with an error instead of silently creating or ignoring it.
example/linux/installation.md (1)
209-211
: Helpful caution about environment variable usage alongside systemd.
You underline how environment variables can become tricky when systemd runs processes in separate environments. Sticking to absolute paths or local .env
is consistent with the rest of your guide. This looks good.
🧰 Tools
🪛 Markdownlint (0.37.0)
209-209: Expected: 0 or 2; Actual: 1
Trailing spaces
(MD009, no-trailing-spaces)
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
example/linux/installation.md
(1 hunks)example/linux/systemd/Talawa-api.sh
(1 hunks)schema.graphql
(34 hunks)
🧰 Additional context used
📓 Learnings (3)
📓 Common learnings
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/installation.md:31-39
Timestamp: 2024-12-29T21:42:33.048Z
Learning: In the context of the Talawa API installation guide for systemd, “talawa-api” is the directory path, while “talawa” is the user created for running the service.
example/linux/installation.md (4)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:30:37.870Z
Learning: When preparing a system service for Talawa API, compare the Node.js version specified in package.json with the installed version first. If mismatched, install the exact version before proceeding to start the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/installation.md:31-39
Timestamp: 2024-12-29T21:42:33.048Z
Learning: In the context of the Talawa API installation guide for systemd, “talawa-api” is the directory path, while “talawa” is the user created for running the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:22:23.358Z
Learning: The user prefers installing Node.js system-wide at version 20.18.0 to match the Talawa API's Node.js version, rather than relying on NVM.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:24:14.320Z
Learning: When preparing Talawa-api.sh, always confirm the presence of package.json before extracting “engines.node” to avoid errors if the file isn't found in the working directory.
example/linux/systemd/Talawa-api.sh (8)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:30:37.870Z
Learning: When preparing a system service for Talawa API, compare the Node.js version specified in package.json with the installed version first. If mismatched, install the exact version before proceeding to start the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:15:55.398Z
Learning: When preparing Talawa-api.sh, explicitly begin by verifying and CDing to the project directory. If package.json is absent, abort with an error instead of silently creating or ignoring it.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: To avoid exposing sensitive environment variables, the Talawa-api.sh script selectively loads only the NODE_ENV variable from .env.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:24:14.320Z
Learning: When preparing Talawa-api.sh, always confirm the presence of package.json before extracting “engines.node” to avoid errors if the file isn't found in the working directory.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:08:27.581Z
Learning: When reading “engines.node” from package.json within Talawa-api.sh, ensure the script is in the correct working directory or references an absolute path. Also confirm the `jq` utility is installed and in scope for the service user.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api.sh script is intended and tested only for Linux environments, leveraging Linux-specific commands and file paths.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:56:37.763Z
Learning: When using Talawa-api.sh, skip auto-creation of the log file and instead exit if the file doesn't exist. A check ensures the user manually creates it with correct permissions before running the script.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api systemd service file automatically restarts the service after 5 seconds if an error occurs, achieving graceful exit use cases for Linux.
🪛 Markdownlint (0.37.0)
example/linux/installation.md
163-163: Expected: 1; Actual: 2; Style: 1/1/1
Ordered list item prefix
(MD029, ol-prefix)
169-169: Expected: 1; Actual: 3; Style: 1/1/1
Ordered list item prefix
(MD029, ol-prefix)
235-235: Expected: 1; Actual: 2; Style: 1/1/1
Ordered list item prefix
(MD029, ol-prefix)
137-137: null
Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
🔇 Additional comments (3)
schema.graphql (2)
1334-1344
:
Reconsider mandatory parent message requirement
The parentChatMessageId
field is required in MutationCreateChatMessageInput
, which prevents creating top-level messages in a chat. This design choice might be limiting as most chat systems need to support both top-level messages and replies.
Consider making parentChatMessageId
optional:
input MutationCreateChatMessageInput {
"""Body of the chat message."""
body: String!
"""Global identifier of the associated chat."""
chatId: ID!
"""Global identifier of the associated parent chat message."""
- parentChatMessageId: ID!
+ parentChatMessageId: ID
}
Likely invalid or redundant comment.
2746-2757
: 🧹 Nitpick (assertive)
Enhance real-time capabilities
The subscription system currently only supports chat message creation events. Consider adding subscriptions for other real-time events that would benefit from immediate updates.
Consider adding subscriptions for:
- Event updates/cancellations
- Venue booking changes
- New agenda items
- Tag changes
- Organization membership changes
Example addition:
type Subscription {
"""Subscription field to subscribe to the event of creation of a chat message."""
chatMessageCreate(input: SubscriptionChatMessageCreateInput!): ChatMessage
+ """Subscription field to subscribe to event updates."""
+ eventUpdate(input: SubscriptionEventUpdateInput!): Event
+ """Subscription field to subscribe to venue booking changes."""
+ venueBookingUpdate(input: SubscriptionVenueBookingUpdateInput!): Venue
}
Likely invalid or redundant comment.
example/linux/systemd/Talawa-api.sh (1)
166-169
:
Verify production build before starting in production mode.
When NODE_ENV
is set to production, ensure the application is built before starting.
elif [ "$NODE_ENV" == "production" ]; then
echo "Starting Talawa API in production mode..." | tee -a "$LOG_FILE"
+ if [ ! -d "dist" ] || [ ! -f "dist/index.js" ]; then
+ echo "Error: Production build not found. Run 'npm run build' first. Exiting." | tee -a "$LOG_FILE"
+ exit 1
+ fi
exec "$NODE_PATH" "$PROD_PATH"
Likely invalid or redundant comment.
@palisadoes all changes i have made for this pr . Takes the best suggestion from the coderabbit to make the code better , more readable . Review once . |
@palisadoes plz review this pr . If necessary to change some then give suggestion. For the above conflicts file of graphql these are auto generated .If it will remain unmerge for some days then again and i have to update the branch solve coflicts, also resolve the conversation of codeRabbit . |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
example/linux/installation.md
(1 hunks)example/linux/systemd/Talawa-api.sh
(1 hunks)example/linux/systemd/talawa-api.service
(1 hunks)schema.graphql
(2 hunks)
🧰 Additional context used
📓 Learnings (4)
📓 Common learnings
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/installation.md:31-39
Timestamp: 2024-12-29T21:42:33.048Z
Learning: In the context of the Talawa API installation guide for systemd, “talawa-api” is the directory path, while “talawa” is the user created for running the service.
example/linux/systemd/talawa-api.service (5)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/talawa-api.service:15-16
Timestamp: 2024-12-29T22:15:10.039Z
Learning: For the Talawa systemd usage, user PurnenduMIshra129th prefers using absolute paths in the service file, as referencing an environment file has caused errors in their setup.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api systemd service file automatically restarts the service after 5 seconds if an error occurs, achieving graceful exit use cases for Linux.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:47:29.830Z
Learning: When running Talawa-api.sh as a system service under a specific user, ensure the log file’s ownership and permissions align with that user to prevent "Permission denied" on /var/log/talawa-api.log.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:30:37.870Z
Learning: When preparing a system service for Talawa API, compare the Node.js version specified in package.json with the installed version first. If mismatched, install the exact version before proceeding to start the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api.sh script is intended and tested only for Linux environments, leveraging Linux-specific commands and file paths.
example/linux/installation.md (4)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:30:37.870Z
Learning: When preparing a system service for Talawa API, compare the Node.js version specified in package.json with the installed version first. If mismatched, install the exact version before proceeding to start the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/installation.md:31-39
Timestamp: 2024-12-29T21:42:33.048Z
Learning: In the context of the Talawa API installation guide for systemd, “talawa-api” is the directory path, while “talawa” is the user created for running the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:22:23.358Z
Learning: The user prefers installing Node.js system-wide at version 20.18.0 to match the Talawa API's Node.js version, rather than relying on NVM.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:24:14.320Z
Learning: When preparing Talawa-api.sh, always confirm the presence of package.json before extracting “engines.node” to avoid errors if the file isn't found in the working directory.
example/linux/systemd/Talawa-api.sh (11)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:30:37.870Z
Learning: When preparing a system service for Talawa API, compare the Node.js version specified in package.json with the installed version first. If mismatched, install the exact version before proceeding to start the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:15:55.398Z
Learning: When preparing Talawa-api.sh, explicitly begin by verifying and CDing to the project directory. If package.json is absent, abort with an error instead of silently creating or ignoring it.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: To avoid exposing sensitive environment variables, the Talawa-api.sh script selectively loads only the NODE_ENV variable from .env.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:24:14.320Z
Learning: When preparing Talawa-api.sh, always confirm the presence of package.json before extracting “engines.node” to avoid errors if the file isn't found in the working directory.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:08:27.581Z
Learning: When reading “engines.node” from package.json within Talawa-api.sh, ensure the script is in the correct working directory or references an absolute path. Also confirm the `jq` utility is installed and in scope for the service user.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api.sh script is intended and tested only for Linux environments, leveraging Linux-specific commands and file paths.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:56:37.763Z
Learning: When using Talawa-api.sh, skip auto-creation of the log file and instead exit if the file doesn't exist. A check ensures the user manually creates it with correct permissions before running the script.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api systemd service file automatically restarts the service after 5 seconds if an error occurs, achieving graceful exit use cases for Linux.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2809
File: example/linux/systemd/Talawa-api.sh:145-152
Timestamp: 2024-12-30T21:11:34.734Z
Learning: The user prefers manual verification of environment variables (like MongoDB URI, Redis URL) rather than incorporating those checks into the script.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2809
File: example/linux/systemd/Talawa-api.sh:5-9
Timestamp: 2024-12-30T21:08:42.307Z
Learning: PurnenduMIshra129th strongly prefers using absolute paths in systemd scripts for Talawa’s deployment on Linux, rather than introducing command-line arguments for paths.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/talawa-api.service:15-16
Timestamp: 2024-12-29T22:15:10.039Z
Learning: For the Talawa systemd usage, user PurnenduMIshra129th prefers using absolute paths in the service file, as referencing an environment file has caused errors in their setup.
🪛 Markdownlint (0.37.0)
example/linux/installation.md
163-163: Expected: 1; Actual: 2; Style: 1/1/1
Ordered list item prefix
(MD029, ol-prefix)
169-169: Expected: 1; Actual: 3; Style: 1/1/1
Ordered list item prefix
(MD029, ol-prefix)
235-235: Expected: 1; Actual: 2; Style: 1/1/1
Ordered list item prefix
(MD029, ol-prefix)
137-137: null
Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
🔇 Additional comments (8)
example/linux/systemd/talawa-api.service (3)
35-39
: 🧹 Nitpick (assertive)Enhance network dependency configuration.
The current network dependency configuration is basic. Consider using
network-online.target
for services that require full network connectivity.-After=network.target +After=network-online.target +Wants=network-online.target WorkingDirectory=$CODEROOT Type=simple Restart=always RestartSec=5Likely invalid or redundant comment.
42-45
: 🧹 Nitpick (assertive)Strengthen security directives.
While basic security directives are present, consider adding more restrictions for better security.
NoNewPrivileges=true PrivateTmp=true RestrictAddressFamilies=AF_INET AF_INET6 AmbientCapabilities=CAP_NET_BIND_SERVICE +ProtectSystem=strict +ProtectHome=true +RestrictSUIDSGID=true +SystemCallArchitectures=nativeLikely invalid or redundant comment.
25-26
:⚠️ Potential issueReplace environment variable with absolute path.
The use of
$CODEROOT
contradicts the warning about environment variables not working properly in systemd context. Based on the learnings from previous reviews, absolute paths are preferred for reliability.-Environment=CODEROOT=/path/to/your/talawa-api -ExecStart=$CODEROOT/example/linux/systemd/Talawa-api.sh +ExecStart=/path/to/your/talawa-api/example/linux/systemd/Talawa-api.sh⛔ Skipped due to learnings
Learnt from: PurnenduMIshra129th PR: PalisadoesFoundation/talawa-api#2795 File: example/linux/systemd/talawa-api.service:15-16 Timestamp: 2024-12-29T22:15:10.039Z Learning: For the Talawa systemd usage, user PurnenduMIshra129th prefers using absolute paths in the service file, as referencing an environment file has caused errors in their setup.
Learnt from: PurnenduMIshra129th PR: PalisadoesFoundation/talawa-api#2795 File: example/linux/systemd/Talawa-api.sh:41-52 Timestamp: 2024-12-28T18:13:52.844Z Learning: The Talawa-api systemd service file automatically restarts the service after 5 seconds if an error occurs, achieving graceful exit use cases for Linux.
Learnt from: PurnenduMIshra129th PR: PalisadoesFoundation/talawa-api#2795 File: example/linux/systemd/Talawa-api.sh:41-52 Timestamp: 2024-12-28T18:13:52.844Z Learning: The Talawa-api.sh script is intended and tested only for Linux environments, leveraging Linux-specific commands and file paths.
Learnt from: PurnenduMIshra129th PR: PalisadoesFoundation/talawa-api#2795 File: example/linux/systemd/Talawa-api.sh:41-52 Timestamp: 2024-12-28T18:13:52.844Z Learning: To avoid exposing sensitive environment variables, the Talawa-api.sh script selectively loads only the NODE_ENV variable from .env.
Learnt from: PurnenduMIshra129th PR: PalisadoesFoundation/talawa-api#2809 File: example/linux/systemd/Talawa-api.sh:5-9 Timestamp: 2024-12-30T21:08:42.307Z Learning: PurnenduMIshra129th strongly prefers using absolute paths in systemd scripts for Talawa’s deployment on Linux, rather than introducing command-line arguments for paths.
example/linux/installation.md (1)
91-110
: Well-structured logrotate configuration with security measures!The configuration includes important security features:
nolinkasym
to prevent symlink attacks- Proper ownership with
su talawa talawa
- Safe log rotation with
delaycompress
example/linux/systemd/Talawa-api.sh (3)
7-13
: Good separation of editable and static configurations!The clear separation between editable paths and static configurations makes the script maintainable and follows the user's preference for absolute paths.
142-156
: Appropriate environment variable handling!The script correctly focuses on loading only the essential NODE_ENV variable, leaving other environment variable verification to the manual installation process as preferred.
77-96
: 🧹 Nitpick (assertive)Consider semantic version comparison.
The current exact version match (
!=
) might be too strict. Consider using semantic version comparison to allow compatible versions:if ! command -v semver >/dev/null 2>&1; then npm install -g semver fi if ! semver -r "^$TARGET_NODE_VERSION" "$INSTALLED_NODE_VERSION" >/dev/null; then echo "Error: Node.js version $INSTALLED_NODE_VERSION is not compatible with required version $TARGET_NODE_VERSION" exit 1 fi⛔ Skipped due to learnings
Learnt from: PurnenduMIshra129th PR: PalisadoesFoundation/talawa-api#2795 File: example/linux/systemd/Talawa-api.sh:4-7 Timestamp: 2024-12-28T12:08:27.581Z Learning: When reading “engines.node” from package.json within Talawa-api.sh, ensure the script is in the correct working directory or references an absolute path. Also confirm the `jq` utility is installed and in scope for the service user.
schema.graphql (1)
495-532
: Standardize avatar field naming.The Chat type uses both
avatarURL
andavatarURI
. Standardize to useavatarURL
consistently across the schema.
@coderabbitai full review |
✅ Actions performedFull review triggered. |
I'll look at this in detail later today |
There was a problem hiding this 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
📒 Files selected for processing (4)
example/linux/installation.md
(1 hunks)example/linux/systemd/Talawa-api.sh
(1 hunks)example/linux/systemd/talawa-api.service
(1 hunks)schema.graphql
(2 hunks)
🧰 Additional context used
📓 Learnings (5)
📓 Common learnings
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/installation.md:31-39
Timestamp: 2024-12-29T21:42:33.048Z
Learning: In the context of the Talawa API installation guide for systemd, “talawa-api” is the directory path, while “talawa” is the user created for running the service.
example/linux/installation.md (4)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:30:37.870Z
Learning: When preparing a system service for Talawa API, compare the Node.js version specified in package.json with the installed version first. If mismatched, install the exact version before proceeding to start the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/installation.md:31-39
Timestamp: 2024-12-29T21:42:33.048Z
Learning: In the context of the Talawa API installation guide for systemd, “talawa-api” is the directory path, while “talawa” is the user created for running the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:22:23.358Z
Learning: The user prefers installing Node.js system-wide at version 20.18.0 to match the Talawa API's Node.js version, rather than relying on NVM.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:24:14.320Z
Learning: When preparing Talawa-api.sh, always confirm the presence of package.json before extracting “engines.node” to avoid errors if the file isn't found in the working directory.
example/linux/systemd/talawa-api.service (5)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/talawa-api.service:15-16
Timestamp: 2024-12-29T22:15:10.039Z
Learning: For the Talawa systemd usage, user PurnenduMIshra129th prefers using absolute paths in the service file, as referencing an environment file has caused errors in their setup.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api systemd service file automatically restarts the service after 5 seconds if an error occurs, achieving graceful exit use cases for Linux.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:47:29.830Z
Learning: When running Talawa-api.sh as a system service under a specific user, ensure the log file’s ownership and permissions align with that user to prevent "Permission denied" on /var/log/talawa-api.log.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:30:37.870Z
Learning: When preparing a system service for Talawa API, compare the Node.js version specified in package.json with the installed version first. If mismatched, install the exact version before proceeding to start the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api.sh script is intended and tested only for Linux environments, leveraging Linux-specific commands and file paths.
example/linux/systemd/Talawa-api.sh (11)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:30:37.870Z
Learning: When preparing a system service for Talawa API, compare the Node.js version specified in package.json with the installed version first. If mismatched, install the exact version before proceeding to start the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:15:55.398Z
Learning: When preparing Talawa-api.sh, explicitly begin by verifying and CDing to the project directory. If package.json is absent, abort with an error instead of silently creating or ignoring it.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: To avoid exposing sensitive environment variables, the Talawa-api.sh script selectively loads only the NODE_ENV variable from .env.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:24:14.320Z
Learning: When preparing Talawa-api.sh, always confirm the presence of package.json before extracting “engines.node” to avoid errors if the file isn't found in the working directory.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:08:27.581Z
Learning: When reading “engines.node” from package.json within Talawa-api.sh, ensure the script is in the correct working directory or references an absolute path. Also confirm the `jq` utility is installed and in scope for the service user.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api.sh script is intended and tested only for Linux environments, leveraging Linux-specific commands and file paths.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:56:37.763Z
Learning: When using Talawa-api.sh, skip auto-creation of the log file and instead exit if the file doesn't exist. A check ensures the user manually creates it with correct permissions before running the script.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:41-52
Timestamp: 2024-12-28T18:13:52.844Z
Learning: The Talawa-api systemd service file automatically restarts the service after 5 seconds if an error occurs, achieving graceful exit use cases for Linux.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2809
File: example/linux/systemd/Talawa-api.sh:145-152
Timestamp: 2024-12-30T21:11:34.734Z
Learning: The user prefers manual verification of environment variables (like MongoDB URI, Redis URL) rather than incorporating those checks into the script.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2809
File: example/linux/systemd/Talawa-api.sh:5-9
Timestamp: 2024-12-30T21:08:42.307Z
Learning: PurnenduMIshra129th strongly prefers using absolute paths in systemd scripts for Talawa’s deployment on Linux, rather than introducing command-line arguments for paths.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/talawa-api.service:15-16
Timestamp: 2024-12-29T22:15:10.039Z
Learning: For the Talawa systemd usage, user PurnenduMIshra129th prefers using absolute paths in the service file, as referencing an environment file has caused errors in their setup.
schema.graphql (1)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2809
File: schema.graphql:164-203
Timestamp: 2025-01-10T06:19:43.820Z
Learning: Duplicate type definitions in schema.graphql are auto-generated and should not be flagged as issues.
🪛 Markdownlint (0.37.0)
example/linux/installation.md
163-163: Expected: 1; Actual: 2; Style: 1/1/1
Ordered list item prefix
(MD029, ol-prefix)
169-169: Expected: 1; Actual: 3; Style: 1/1/1
Ordered list item prefix
(MD029, ol-prefix)
235-235: Expected: 1; Actual: 2; Style: 1/1/1
Ordered list item prefix
(MD029, ol-prefix)
137-137: null
Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
🔇 Additional comments (10)
example/linux/systemd/talawa-api.service (4)
29-29
: 🧹 Nitpick (assertive)Specify RuntimeDirectory mode.
Add explicit mode settings for the runtime directory to ensure proper permissions:
RuntimeDirectory=talawa-api +RuntimeDirectoryMode=750
Likely invalid or redundant comment.
35-46
: 🧹 Nitpick (assertive)Enhance network dependency configuration.
Consider adding
network-online.target
if the service requires network connectivity to be fully established:-After=network.target +After=network-online.target +Wants=network-online.targetLikely invalid or redundant comment.
24-26
: 🛠️ Refactor suggestionUse absolute paths consistently in the service file.
Based on your feedback about environment variables not working properly in systemd context, replace the environment variable usage with absolute paths:
-Environment=CODEROOT=/path/to/your/talawa-api -ExecStart=$CODEROOT/example/linux/systemd/Talawa-api.sh +ExecStart=/path/to/your/talawa-api/example/linux/systemd/Talawa-api.sh⛔ Skipped due to learnings
Learnt from: PurnenduMIshra129th PR: PalisadoesFoundation/talawa-api#2795 File: example/linux/systemd/talawa-api.service:15-16 Timestamp: 2024-12-29T22:15:10.039Z Learning: For the Talawa systemd usage, user PurnenduMIshra129th prefers using absolute paths in the service file, as referencing an environment file has caused errors in their setup.
Learnt from: PurnenduMIshra129th PR: PalisadoesFoundation/talawa-api#2795 File: example/linux/systemd/Talawa-api.sh:41-52 Timestamp: 2024-12-28T18:13:52.844Z Learning: The Talawa-api systemd service file automatically restarts the service after 5 seconds if an error occurs, achieving graceful exit use cases for Linux.
1-17
: 🧹 Nitpick (assertive)Enhance documentation structure and visibility of critical warnings.
The README section is well-documented but could be improved by:
- Moving the environment variable warning (line 11) to the top as it's a critical consideration
- Adding security implications of using absolute paths
# Talawa API Systemd Service Configuration # # This service file is used to manage the Talawa API service. # +# IMPORTANT SECURITY CONSIDERATIONS: +# - Environment variables may not work properly in systemd context +# - Use absolute paths for reliability and security +# - Ensure all paths and files have appropriate permissions +# # README: # 1. Edit the paths in the `[Editable Configuration]` section to match your setup. # 2. `Environment=CODEROOT` specifies the root directory of the Talawa API project. # 3. `ExecStart` should reference the absolute path to the Talawa-api.sh script. # 4. `WorkingDirectory` must match the root project directory. # 5. The service runs as the `talawa` user and group for better security. # 6. The `RuntimeDirectory` creates a directory under `/run` for storing temporary runtime data. # 7. `LimitNOFILE=15000` ensures the service has sufficient open file descriptors for typical usage patterns. # 8. Do not modify the `[Static Configuration]` section unless absolutely necessary. # 9. Use `journalctl` for service logs (`journalctl -u talawa-api.service`). # 10. After editing, reload systemd with `sudo systemctl daemon-reload`. -# 11. In my case Environment did not worked properly in case if you faced error in readind directory path use absolute path.⛔ Skipped due to learnings
Learnt from: PurnenduMIshra129th PR: PalisadoesFoundation/talawa-api#2795 File: example/linux/systemd/talawa-api.service:15-16 Timestamp: 2024-12-29T22:15:10.039Z Learning: For the Talawa systemd usage, user PurnenduMIshra129th prefers using absolute paths in the service file, as referencing an environment file has caused errors in their setup.
example/linux/installation.md (1)
73-77
: 🧹 Nitpick (assertive)Add security context for log file permissions.
The permissions (664) allow group read/write access. Consider adding a note explaining:
- Why these specific permissions are chosen
- What the permissions mean (owner: rw-, group: rw-, others: r--)
- Security implications of group write access
⛔ Skipped due to learnings
Learnt from: PurnenduMIshra129th PR: PalisadoesFoundation/talawa-api#2795 File: example/linux/systemd/Talawa-api.sh:4-7 Timestamp: 2024-12-28T11:47:29.830Z Learning: When running Talawa-api.sh as a system service under a specific user, ensure the log file’s ownership and permissions align with that user to prevent "Permission denied" on /var/log/talawa-api.log.
example/linux/systemd/Talawa-api.sh (4)
66-138
: LGTM! Thorough dependency and version checks.The script performs comprehensive checks for:
- jq installation for parsing package.json
- Node.js version compatibility
- tsx and node executable availability
170-172
:⚠️ Potential issueAdd build step before starting in production mode.
The script directly executes the production path without building first. Add the build step:
elif [ "$NODE_ENV" == "production" ]; then echo "Starting Talawa API in production mode..." | tee -a "$LOG_FILE" + pnpm build_production || { echo "Error: Build failed. Exiting." | tee -a "$LOG_FILE"; exit 1; } exec "$NODE_PATH" "$PROD_PATH"
Likely invalid or redundant comment.
17-19
: 🧹 Nitpick (assertive)Enhance error message with creation instructions.
When the log file is missing, provide the exact commands needed:
- echo "Error: Log file '$LOG_FILE' not found. Exiting." - echo "Please create it first with the correct ownership and permissions, then return." + echo "Error: Log file '$LOG_FILE' not found. Exiting." + echo "Please create the log file using these commands:" + echo "sudo touch $LOG_FILE" + echo "sudo chown talawa:talawa $LOG_FILE" + echo "sudo chmod 664 $LOG_FILE"Likely invalid or redundant comment.
8-8
: 🧹 Nitpick (assertive)Update the example path with the actual installation path.
The example path
/path/to/your/talawa-api
should be updated with the actual default installation path for Talawa API to avoid confusion during installation.schema.graphql (1)
Line range hint
164-585
: LGTM! Auto-generated schema file.The GraphQL schema looks good. The duplicate type definitions are expected as they are auto-generated.
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (7)
certs/cert.pem
is excluded by!**/*.pem
certs/key.pem
is excluded by!**/*.pem
images/0ebg7HyP8HjIpP97kc9eFimage.png
is excluded by!**/*.png
images/6lFrZPt8zAPumkUQugmU3image.png
is excluded by!**/*.png
images/S_fGEW2OIc4pipoTvX8emimage.png
is excluded by!**/*.png
images/ij1Fp40yJzM0E4iRFXWGRimage.png
is excluded by!**/*.png
images/wc14qUmQDQtFOeSmIhYIgimage.png
is excluded by!**/*.png
📒 Files selected for processing (3)
.env_test
(1 hunks)example/linux/installation.md
(1 hunks)schema.graphql
(2 hunks)
🧰 Additional context used
📓 Learnings (3)
📓 Common learnings
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/installation.md:31-39
Timestamp: 2024-12-29T21:42:33.048Z
Learning: In the context of the Talawa API installation guide for systemd, “talawa-api” is the directory path, while “talawa” is the user created for running the service.
example/linux/installation.md (4)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:30:37.870Z
Learning: When preparing a system service for Talawa API, compare the Node.js version specified in package.json with the installed version first. If mismatched, install the exact version before proceeding to start the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/installation.md:31-39
Timestamp: 2024-12-29T21:42:33.048Z
Learning: In the context of the Talawa API installation guide for systemd, “talawa-api” is the directory path, while “talawa” is the user created for running the service.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T11:22:23.358Z
Learning: The user prefers installing Node.js system-wide at version 20.18.0 to match the Talawa API's Node.js version, rather than relying on NVM.
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/systemd/Talawa-api.sh:4-7
Timestamp: 2024-12-28T12:24:14.320Z
Learning: When preparing Talawa-api.sh, always confirm the presence of package.json before extracting “engines.node” to avoid errors if the file isn't found in the working directory.
schema.graphql (1)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2809
File: schema.graphql:164-203
Timestamp: 2025-01-10T06:19:43.820Z
Learning: Duplicate type definitions in schema.graphql are auto-generated and should not be flagged as issues.
🪛 Markdownlint (0.37.0)
example/linux/installation.md
163-163: Expected: 1; Actual: 2; Style: 1/1/1
Ordered list item prefix
(MD029, ol-prefix)
169-169: Expected: 1; Actual: 3; Style: 1/1/1
Ordered list item prefix
(MD029, ol-prefix)
175-175: Expected: 1; Actual: 4; Style: 1/1/1
Ordered list item prefix
(MD029, ol-prefix)
241-241: Expected: 1; Actual: 2; Style: 1/1/1
Ordered list item prefix
(MD029, ol-prefix)
137-137: null
Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
🪛 Gitleaks (8.21.2)
.env_test
4-4: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
5-5: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Test Deployment to https://docs-api.talawa.io
- GitHub Check: Analyse Code With CodeQL (typescript)
🔇 Additional comments (4)
.env_test (1)
6-6
: Add validation for required database and Redis configurations.The MongoDB and Redis connection settings are empty. These are critical configurations that need proper validation to prevent startup issues.
Run this script to check if these configurations are validated in the codebase:
Also applies to: 21-23
example/linux/installation.md (1)
71-77
: 🛠️ Refactor suggestionEnhance log file security configuration.
The current log file permissions (664) allow group write access. Consider:
- Using more restrictive permissions (640)
- Documenting the security implications
sudo touch /var/log/talawa-api.log sudo chown talawa:talawa /var/log/talawa-api.log -sudo chmod 664 /var/log/talawa-api.log +# Set more restrictive permissions (owner: rw-, group: r--, others: ---) +sudo chmod 640 /var/log/talawa-api.log⛔ Skipped due to learnings
Learnt from: PurnenduMIshra129th PR: PalisadoesFoundation/talawa-api#2795 File: example/linux/systemd/Talawa-api.sh:4-7 Timestamp: 2024-12-28T11:56:37.763Z Learning: When using Talawa-api.sh, skip auto-creation of the log file and instead exit if the file doesn't exist. A check ensures the user manually creates it with correct permissions before running the script.
Learnt from: PurnenduMIshra129th PR: PalisadoesFoundation/talawa-api#2795 File: example/linux/systemd/Talawa-api.sh:4-7 Timestamp: 2024-12-28T11:47:29.830Z Learning: When running Talawa-api.sh as a system service under a specific user, ensure the log file’s ownership and permissions align with that user to prevent "Permission denied" on /var/log/talawa-api.log.
schema.graphql (2)
241-242
: 🧹 Nitpick (assertive)Consider using a more structured duration field.
The
duration
field is defined as a String, which could lead to inconsistent formats. Consider using a more structured format for better validation and querying.- """Duration of the agenda item.""" - duration: String + """Duration of the agenda item in minutes.""" + durationMinutes: IntLikely invalid or redundant comment.
497-534
: 🧹 Nitpick (assertive)Standardize avatar field naming convention.
The schema uses both
avatarURL
andavatarURI
for similar fields. Standardize to useavatarURL
consistently across all types.type Chat { - """URI to the avatar of the chat.""" - avatarURI: String + """URL to the avatar of the chat.""" + avatarURL: StringLikely invalid or redundant comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge with the latest upstream. We had to update the .gitignore
file based on some of the sensitive data you uploaded in this PR.
Please exclude this file from the PR. It's not required for the issue.
schema.graphql
@palisadoes ok |
…dation#2597) * wipe everything the old codebase is largely incompatible with the new changes that will be made and it is a huge hassle to do it incrementally while keeping the backwards compatibility as such the entire codebase is being wiped to start from scratch and the redundant stuff or new changes from the old codebase will be manually copied into the new codebase as needed * initialize node.js and esm project initialized an empty node.js esm project added some documents from the previous project modified dependabot config from npm to pnpm package manager * integrated lefthook for configuring git hooks added the lefthook package added the package.json scripts for enabling/disabling the git hooks * integrate typescript for node.js and esm added dependencies for typescript and node.js integration added tsconfig.json with configuration for node.js and esmodules added package.json script for checking type errors in the codebase added root /src directory for storing runtime typescript application logic * integrate biome.js for format/lint added dependencies for integrating biome.js added biome.jsonc for configuring biome.js format/lint added package.json scripts for checking and fixing format/lint issues with biome.js added git hook commands for biome.js * integrate swc for typescript to javascript transpilation added dependencies for swc transpilation added package.json script for transpiling typescript code in /src directory to javascript for production usage * integrate fastify server added dependencies for fastify added initial code for starting a fastify server added type-safe json schema parsing for environment variables added .env file for development and production environments * integrate mercurius graphql handler and pothos graphql schema builder added packages for graphql, mercurius and pothos integrated fastify graphql route handling using mercurius added docs for pothos and developer workflows related to it added script for generating the sdl graphql schema from pothos schema * integrate drizzle orm and postgres added packages for drizzle orm and postgres added drizzle schema definition in postgres dialect reflecting the domain models of talawa application added configuration environment variables for postgres client added fastify plugin for registering the drizzle client on the global fastify instance added package.json scripts for drizzle orm, postgres and sql related workflows added zod enums for easily reusing type and runtime values between the drizzle schema and the graphql schema * integrated general and graphql specific testing infrastructure added the packages for general and graphql specific testing needs added the configuration for vitest added the tooling for writing type safe graphql operations in tests added the scripts for checking schema errors in graphql operations used in the tests added a dummy query for showing the testing workflow, will be removed in the future added relevant documentation for the test directory added the env file for ci environment * integrated docker, docker compose and devcontainer added OCI compliant Containerfile with multi-staged builds for creating talawa api docker images for different environments added docker compose configuration for automating setup of talawa api infrastructure in different environments added devcontainer configuration for automating talawa api development environment setup added env files specific to different talawa api environments * added pull request github actions workflow
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
data/.minio.sys/format.json
(1 hunks)
🧰 Additional context used
📓 Learnings (1)
📓 Common learnings
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/installation.md:31-39
Timestamp: 2024-12-29T21:42:33.048Z
Learning: In the context of the Talawa API installation guide for systemd, “talawa-api” is the directory path, while “talawa” is the user created for running the service.
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Test Deployment to https://docs-api.talawa.io
- GitHub Check: Analyse Code With CodeQL (typescript)
* Added GitHub Actions python script linter * Fixed reference * Linted
…lisadoesFoundation#2858) * fix postgres test devcontainer env file * remove confirmed password sign up input
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
schema.graphql
(2 hunks)
🧰 Additional context used
📓 Learnings (2)
📓 Common learnings
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2795
File: example/linux/installation.md:31-39
Timestamp: 2024-12-29T21:42:33.048Z
Learning: In the context of the Talawa API installation guide for systemd, “talawa-api” is the directory path, while “talawa” is the user created for running the service.
schema.graphql (1)
Learnt from: PurnenduMIshra129th
PR: PalisadoesFoundation/talawa-api#2809
File: schema.graphql:164-203
Timestamp: 2025-01-10T06:19:43.820Z
Learning: Duplicate type definitions in schema.graphql are auto-generated and should not be flagged as issues.
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Test Deployment to https://docs-api.talawa.io
- GitHub Check: Analyse Code With CodeQL (typescript)
🔇 Additional comments (3)
schema.graphql (3)
166-384
: Duplicate type definitions are auto-generated.Based on the retrieved learnings, these duplicate type definitions are auto-generated and should not be flagged as issues.
241-242
: 🛠️ Refactor suggestionStandardize duration format in AgendaItem type.
Using String for duration without a standardized format could lead to inconsistent data entry and parsing difficulties.
Consider one of these alternatives:
- Use minutes as an integer:
- """Duration of the agenda item.""" - duration: String + """Duration of the agenda item in minutes.""" + durationMinutes: Int
- Create a custom scalar for duration:
+""" +A scalar that validates duration strings in ISO 8601 format (e.g., PT1H30M) +""" +scalar Duration + - """Duration of the agenda item.""" - duration: String + """Duration of the agenda item in ISO 8601 format.""" + duration: DurationLikely invalid or redundant comment.
497-534
:⚠️ Potential issueStandardize avatar field naming in Chat type.
The Chat type has inconsistent field naming:
- One definition uses
avatarURL
andavatarMimeType
- Another uses
avatarURI
This inconsistency could lead to confusion. Standardize on either URL or URI consistently.
Apply this diff to standardize the field naming:
- """URI to the avatar of the chat.""" - avatarURI: String + """URL to the avatar of the chat.""" + avatarURL: String + + """Mime type of the avatar of the chat.""" + avatarMimeType: StringLikely invalid or redundant comment.
@palisadoes see once updated the code with latest upstream .see once if i done it perfectly or not i became confuse during this . |
What kind of change does this PR introduce?
Feature
Issue Number:
Fixes #2737
Did you add tests for your changes?
No
Snapshots/Videos:
2024-12-25.18-11-09.1.mp4
If relevant, did you update the documentation?
Yes I added document named installation.md on /example/linux/
Summary
Running the Talawa API service as a system daemon using systemd offers numerous benefits, including automatic startup and restart, centralized management, and dependency handling. It enhances security by running the service as a specific user and group, and improves reliability by automatically restarting the service if it crashes. Systemd provides centralized logging and monitoring, making it easier to diagnose issues. It also ensures consistent service states and resource management, preventing resource exhaustion. Overall, using systemd simplifies service management, enhances security, and ensures high availability and reliability of the Talawa API service.
Does this PR introduce a breaking change?
No
Other information
running the Talawa API service as a system daemon using systemd, highlighting the improvements in reliability, security, and manageability.Dynamically starts the development and production server on .env file configuration.Easily Log files are avaliable we don't have to go deeper in the file configuration It is under the /example/linux/talawa.api.log Every detailed error u can see here.
Have you read the contributing guide?
Yes
Summary by CodeRabbit
Release Notes
Documentation
New Features
Security Improvements
New JSON Structure