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

Devcontainer #2429

Open
wants to merge 53 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
fb46cd9
added installation script
AVtheking Jun 11, 2024
5e5b3ba
Merge branch 'PalisadoesFoundation:develop' into develop
AVtheking Jul 5, 2024
94483db
shell.nix file
AVtheking Jul 5, 2024
0d85405
nix script
AVtheking Jul 6, 2024
3453a01
nix flakes
AVtheking Jul 7, 2024
63db829
Merge branch 'develop' into nix-script
AVtheking Jul 7, 2024
5af03b9
made script cross-platform
AVtheking Jul 15, 2024
30a60c3
test
AVtheking Jul 21, 2024
37ebcd9
test
AVtheking Jul 21, 2024
294c279
test
AVtheking Jul 21, 2024
ea8bbfd
test
AVtheking Jul 21, 2024
c1efe35
test
AVtheking Jul 21, 2024
0711a90
test
AVtheking Jul 21, 2024
cd64b9b
test
AVtheking Jul 21, 2024
978aa6e
test
AVtheking Jul 21, 2024
af49f26
fix nix flake
AVtheking Jul 21, 2024
3e62b40
fix
AVtheking Jul 21, 2024
c2f0029
fix
AVtheking Jul 21, 2024
a0d736d
fix
AVtheking Jul 21, 2024
a35e64f
Merge branch 'develop' into nix-script
AVtheking Jul 21, 2024
2e82058
fix
AVtheking Jul 28, 2024
56a7770
added dev container for devpods
AVtheking Aug 1, 2024
ffb745a
fix
AVtheking Aug 2, 2024
9a9f2c6
fix
AVtheking Aug 2, 2024
72ce9a1
fix
AVtheking Aug 2, 2024
b0a99c8
fix
AVtheking Aug 2, 2024
4765b00
fix
AVtheking Aug 2, 2024
6a7f6d4
temp fix
AVtheking Aug 2, 2024
6600ce2
temp fix
AVtheking Aug 2, 2024
63dcde3
temp fix
AVtheking Aug 2, 2024
034a06b
temp fix
AVtheking Aug 2, 2024
a69ed74
temp fix
AVtheking Aug 2, 2024
f84ec55
Merge branch 'PalisadoesFoundation:develop' into develop
AVtheking Aug 2, 2024
64d8f7d
shell.nix file
AVtheking Jul 5, 2024
682fdff
Merge branch 'develop' into devcontainer
AVtheking Aug 2, 2024
ac0ebee
removed nix file
AVtheking Aug 2, 2024
91b90fc
fix
AVtheking Aug 2, 2024
6faf0c7
docker file
AVtheking Aug 4, 2024
7023c8d
fix
AVtheking Aug 4, 2024
6723695
fix
AVtheking Aug 4, 2024
48d2845
fix
AVtheking Aug 4, 2024
413dc84
fix
AVtheking Aug 7, 2024
6c08aa4
made changes
AVtheking Aug 19, 2024
36b1820
Merge branch 'develop' into devcontainer
AVtheking Aug 19, 2024
a4872ac
Update INSTALLATION.md
AVtheking Aug 25, 2024
8709207
Merge pull request #1 from AVtheking/develop
AVtheking Aug 25, 2024
bf8b54b
Merge branch 'develop' into devcontainer
AVtheking Aug 25, 2024
fd7b6f7
Update INSTALLATION.md
AVtheking Aug 28, 2024
b283c70
made changes
AVtheking Aug 28, 2024
2f0bf4c
Merge branch 'develop' into devcontainer
AVtheking Aug 28, 2024
a412dd4
Merge branch 'develop' into devcontainer
AVtheking Aug 30, 2024
6cc696a
Update INSTALLATION.md
AVtheking Aug 31, 2024
b868a11
fix docker file
AVtheking Aug 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Use Debian Bookworm as the base image
FROM ubuntu:latest as builder
AVtheking marked this conversation as resolved.
Show resolved Hide resolved

# Update package list and install dependencies
RUN apt-get update && \
apt-get install -y \
git \
vim \
curl \
gnupg2 \
lsb-release \
ca-certificates

# Install Node.js (latest LTS version) and npm
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs

# Install additional developer tools (optional)
RUN apt-get install -y \
neovim \
gh # GitHub CLI

# Default command (to keep the container running)
CMD ["tail", "-f", "/dev/null"]
36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "talawa api dev environment",
"dockerComposeFile": "docker-compose.yaml",
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't you utilize the already existing docker-compose.dev.yaml file?

Copy link
Author

Choose a reason for hiding this comment

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

When I was using the compose file outside the .decontainer.json file it was having some issues related to the project directory, that's why I used the file inside it. If I move the already existing file to that folder, developers can have issues, if they use docker for db.

"service": "devcontainer",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
// Settings to apply to the workspace.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"typescript.tsdk": "node_modules/typescript/lib",
"database.host": "mongodb",
"redis.host": "redis-stack-server"
},
// List of extensions to install inside the container
"extensions": [
"dbaeumer.vscode-eslint",
"ms-azuretools.vscode-docker",
"esbenp.prettier-vscode",
"redhat.vscode-yaml"
]
}
},
// Set up forward ports
"forwardPorts": [
4000, // Server port
27017, // MongoDB port
6379 // Redis port
],
// Post-create commands to run after creating the container
"postCreateCommand": "npm install",

// Volumes from docker-compose are already included
"shutdownAction": "stopCompose"
}
34 changes: 34 additions & 0 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
services:
mongodb:
image: mongo:latest
ports:
- 27017:27017
volumes:
- mongodb-data:/data/db
Comment on lines +2 to +7
Copy link

Choose a reason for hiding this comment

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

Specify a version for the MongoDB image.

Using the latest tag can introduce breaking changes unexpectedly. It is recommended to specify a version to ensure stability.

    image: mongo:6.0


redis-stack-server:
image: redis/redis-stack-server:latest
ports:
- 6379:6379
volumes:
- redis-data:/data
Comment on lines +9 to +14
Copy link

Choose a reason for hiding this comment

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

Specify a version for the Redis Stack Server image.

Using the latest tag can introduce breaking changes unexpectedly. It is recommended to specify a version to ensure stability.

    image: redis/redis-stack-server:6.2.6


devcontainer:
build:
context: .
dockerfile: Dockerfile
ports:
- "${SERVER_PORT:-4000}:4000"
volumes:
- ../..:/workspaces:cached
depends_on:
- mongodb
- redis-stack-server
environment:
- MONGO_DB_URL=mongodb://mongodb:27017
- REDIS_HOST=redis-stack-server
- REDIS_PORT=6379

volumes:
mongodb-data:
redis-data:
2 changes: 0 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/usr/bin/env sh

# Disable the hooks in CI
[ -n "$CI" ] && exit 0

# Change to the current directory
. "$(dirname -- "$0")/_/husky.sh"

# Checks code for typescript type errors and throws errors if found.
npm run typecheck
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ COPY . .

EXPOSE 4000

CMD ["npm", "run", "dev"]
CMD ["npm", "run", "dev"]
67 changes: 67 additions & 0 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This document provides instructions on how to set up and start a running instanc
- [Install node.js](#install-nodejs)
- [Install TypeScript](#install-typescript)
- [Install Required Packages](#install-required-packages)
- [Installation Using Devpod](#install-using-devpod)
AVtheking marked this conversation as resolved.
Show resolved Hide resolved
- [Installation Using Docker](#installation-using-docker)
- [Run the Talawa-API Setup](#run-the-talawa-api-setup)
- [Install the Docker Application](#install-the-docker-application)
Expand Down Expand Up @@ -288,6 +289,72 @@ We have created a setup script to make configuring Talawa-API easier.
```
npm run setup
```
# Install Using Devpod

This guide provides a step-by-step guide to setting up a Talawa-Api server using Devpod.

## Setting Up Talawa-Api with Devpod (CLI Version)

1. **Install Devpod CLI**:
- Download and install the Devpod CLI from [Devpod CLI Installation Guide](https://devpod.sh/docs/getting-started/install#optional-install-devpod-cli).

2. **Add a Provider**:
- Use Docker or a compatible provider like Podman or Colima.
- Install Docker from their [official documentation](https://docs.docker.com/engine/install/).
- Add a provider using the CLI by following [this guide](https://devpod.sh/docs/getting-started/quickstart-devpod-cli#add-a-provider).

3. **Create a Workspace**:
- Run the following command in your terminal to start the workspace:
```bash
devpod up https://github.com/PalisadoesFoundation/talawa-api@develop
```
- For more information on creating a workspace, refer to the [Devpod CLI workspace guide](https://devpod.sh/docs/developing-in-workspaces/create-a-workspace#git-repository).

4. **Select Your IDE**:
- To choose your ide refer to [Devpod CLI ide guide](https://devpod.sh/docs/developing-in-workspaces/connect-to-a-workspace#vs-code)

5. **Set Up Talawa-Api**:
- Once your IDE is open and the workspace is ready, set up the environment by running:
```bash
npm run setup
```
- Start the Talawa API server by running:
```bash
npm run dev
```

## Setting Up Talawa-Api with Devpod (GUI Version)

1. **Install Devpod GUI Application**:
- Download and install the Devpod GUI from [Devpod GUI Installation Guide](https://devpod.sh/docs/getting-started/install).

2. **Add a Provider**:
- Use Docker or a compatible provider like Podman or Colima.
- Install Docker from their [official documentation](https://docs.docker.com/engine/install/).
- Add a provider using the GUI app by following [this guide](https://devpod.sh/docs/getting-started/quickstart-vscode#add-a-provider).

3. **Create a Workspace**:
- Open the Devpod GUI application.
- Start a new workspace by entering the following URL in the GUI:
```
https://github.com/PalisadoesFoundation/talawa-api@develop
```
- For more information on starting a workspace in the GUI, refer to [this guide](https://devpod.sh/docs/getting-started/quickstart-vscode#start-a-workspace-with-vs-code).

4. **Select Your IDE**:
- In the Devpod GUI, select your desired IDE from the available options.

5. **Set Up Talawa-Api**:
- Once your IDE is open and the workspace is ready, set up the environment by running:
```bash
npm run setup
```
- Start the Talawa API server by running:
```bash
npm run dev
```



## Install the Docker Application

Expand Down
Loading