portainer-redeploy
Version:
A TypeScript client for redeploy a stack in Portainer
152 lines (97 loc) • 2.96 kB
Markdown
# Portainer API Client
## 📝 Overview
A powerful TypeScript-based client for interacting with the Portainer API, designed to manage Docker stacks and endpoints with ease.
## ✨ Features
- 🌐 Retrieve Portainer endpoints
- 📋 List and retrieve stack information
- 🔄 Redeploy stacks with custom configurations
- 💻 Command-line interface for seamless interaction
## 🛠 Prerequisites
- **Node.js**: v14 or later
- **npm**: v6 or later
## 🚀 Installation
1. Clone the repository
2. Install dependencies:
```bash
npm install
```
## 🔧 Configuration
The client supports configuration through command-line arguments:
| Argument | Description | Default | Required |
| ---------------------- | ------------------------------------------ | -------------- | -------- |
| `-b, --base_domain` | Portainer base domain | - | No |
| `-a, --api_key` | Portainer API key | - | Yes |
| `-s, --stack_id` | Stack ID to interact with | - | Yes |
| `-d, --docker_id` | Docker image ID for redeployment | - | No |
| `-n, --docker_id_name` | Environment variable name for Docker image | `DOCKER_IMAGE` | No |
## 📖 Usage Examples
### Get Stack Information
```bash
npm start -- stack -s <STACK_ID> -a <API_KEY>
```
### Redeploy Stack
```bash
npm start -- redeploy -s <STACK_ID> -a <API_KEY> -d <NEW_DOCKER_IMAGE>
```
## 🛠 Development
### Build
```bash
npm run build
```
### Run
```bash
npm start
```
## ⚠️ Error Handling
The client will exit with a non-zero status code if:
- API request fails
- Stack redeployment is unsuccessful
- Invalid arguments are provided
## 🔒 Security Notes
- **Never** commit your API key to version control
- Use environment variables or secure credential management for API keys
## 🤝 Contributing
1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create a new Pull Request
## 📄 License
ISC License
# Portainer Redeploy CLI
## Description
A command-line tool for redeploying stacks in Portainer quickly and easily.
## Installation
You can install this package globally using npm:
```bash
npm install -g portainer-redeploy
```
## Usage
```bash
portainer-redeploy [options]
```
### Options
- `--help`: Show help information
- `--version`: Show package version
## Development
### Prerequisites
- Node.js 16.0.0 or higher
- npm
### Local Setup
1. Clone the repository
2. Install dependencies:
```bash
npm install
```
3. Build the project:
```bash
npm run build
```
4. Run in development mode:
```bash
npm run dev
```
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
MIT License