Before you begin, ensure you have met the following requirements:
- Node Version Manager (nvm) installed
- pnpm package manager installed
- Make sure to fill your .env (see .env.sample):
cat .env.sample
- Use the required Node.js version using nvm:
nvm use
On Windows, you can use the following command:
nvm use $(Get-Content .nvmrc)
This ensures that the project uses the specified Node.js version.
- Install project dependencies using pnpm:
pnpm install
This will install all the necessary dependencies for your project.
- Watch for changes and automatically restart the server in development:
pnpm dev
This command will use nodemon to watch for changes and restart your application when changes are detected.
- Generate TypeScript types for Mongoose using mongoose-tsgen:
pnpm gen-types
This command will generate TypeScript types based on your Mongoose models.
- Generate Swagger API doc with:
pnpm gen-swagger
This command will generate Swagger documentation, accessible at http://localhost:{port}/api-docs/#/
- Generate Source Code documentation with:
pnpm gen-docs
This command will generate documentation using TypeDoc for the source code and save it in a "docs" folder.
- Build the project:
pnpm build
This command will clean the build/
directory and compile your TypeScript code.
- Start your Node.js application:
pnpm start
This command will start your application using the compiled code.
- Clone the repository from GitHub:
git clone https://github.com/prometheus-x/contract-manager.git
- Navigate to the project directory:
cd contract-manager
- Configure the application by setting up the necessary environment variables. You will need to specify database connection details and other relevant settings.
- Create a docker network using
docker network create ptx
- Start the application:
docker-compose up -d
- If you need to rebuild the image
docker-compose build
and restart with:docker-compose up -d
- If you don't want to use the mongodb container from the docker compose you can use the command
docker run -d -p your-port:your-port --name contract-manager contract-manager
after runningdocker-compose build
- Install Terraform: Ensure Terraform is installed on your machine.
- Configure Kubernetes: Ensure you have access to your Kubernetes cluster and kubectl is configured.
- Initialize Terraform: Run the following commands from the terraform directory.
cd terraform
terraform init
- Apply the Configuration: Apply the Terraform configuration to create the resources.
terraform apply
- Retrieve Service IP: After applying the configuration, retrieve the service IP.
terraform output contract_manager_service_ip
- Replace placeholder values in the
kubernetes_secret
resource with actual values from your.env
.- Ensure the
server_port
value matches the port used in your application.- Adjust the
host_path
in thekubernetes_persistent_volume
resource to an appropriate path on your Kubernetes nodes.
-
Install Helm: Ensure Helm is installed on your machine. You can install it following the instructions here.
-
Package the Helm chart:
helm package ./path/to/contract-manager
-
Deploy the Helm chart:
helm install contract-manager ./path/to/contract-manager
-
Verify the deployment:
kubectl get all -n contract-manager
-
Retrieve Service IP:
kubectl get svc -n contract-manager
- Replace placeholder values in the
values.yaml
file with actual values from your.env
.- Ensure the
server_port
value matches the port used in your application.- Configure your MongoDB connection details in the values.yaml file to point to your managed MongoDB instance.
- Run tests:
pnpm test
This command will run your tests using Mocha. Make sure your tests are
located in ./src/tests/*.test.ts
.
This project is licensed under MIT License
- see the [LICENSE.md] file for details.