[fix] default parameter run records parameters in session for replay[fix] remove default parameters for several cubes
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
# docker
|
||||
|
||||
**Install Docker and tools**
|
||||
|
||||
## Purpose
|
||||
|
||||
This cube installs Docker Engine, Docker Compose, and popular Docker management tools to enable containerized application deployment and management.
|
||||
|
||||
## What is Docker?
|
||||
|
||||
Docker is a platform for developing, shipping, and running applications in containers. Containers package an application with all its dependencies, ensuring it runs consistently across different environments.
|
||||
|
||||
Key benefits:
|
||||
- **Isolation**: Each container runs independently with its own filesystem, network, and processes
|
||||
- **Portability**: Containers run the same way on any system that supports Docker
|
||||
- **Efficiency**: Containers share the host OS kernel, making them lighter than virtual machines
|
||||
- **Scalability**: Easily deploy and scale containerized applications
|
||||
|
||||
## What This Cube Does
|
||||
|
||||
1. **Adds Docker's official repository**
|
||||
- Downloads and installs Docker's GPG key
|
||||
- Configures APT to use Docker's official package repository
|
||||
|
||||
2. **Installs Docker components**
|
||||
- `docker-ce` - Docker Community Edition engine
|
||||
- `docker-ce-cli` - Command-line interface for Docker
|
||||
- `containerd.io` - Container runtime
|
||||
- `docker-buildx-plugin` - Extended build capabilities with BuildKit
|
||||
- `docker-compose-plugin` - Tool for defining multi-container applications
|
||||
|
||||
3. **Installs management tools**
|
||||
- **lazydocker** - Terminal UI for Docker and Docker Compose management
|
||||
- **docker-ctop** - Container metrics and monitoring (top-like interface for containers)
|
||||
|
||||
## Configuration
|
||||
|
||||
This cube currently has no configurable parameters.
|
||||
|
||||
## Dependencies
|
||||
|
||||
None - this cube can run standalone.
|
||||
|
||||
## Post-Installation
|
||||
|
||||
After deployment:
|
||||
- Add users to the `docker` group to run Docker without sudo: `sudo usermod -aG docker username`
|
||||
- Start using Docker: `docker run hello-world`
|
||||
- Use lazydocker for easy management: `lazydocker`
|
||||
- Monitor containers: `ctop`
|
||||
|
||||
## Notes
|
||||
|
||||
The Docker daemon starts automatically on boot. You can manage it with systemd:
|
||||
- Check status: `sudo systemctl status docker`
|
||||
- Restart: `sudo systemctl restart docker`
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [Installation tutorial Ubuntu 24.04](https://www.cherryservers.com/blog/install-docker-ubuntu)
|
||||
@@ -0,0 +1,75 @@
|
||||
from pyinfra import host
|
||||
from pyinfra.operations import server, apt
|
||||
|
||||
|
||||
DISTRO = host.data.DISTRO
|
||||
|
||||
server.shell(
|
||||
commands=[
|
||||
"install -m 0755 -d /etc/apt/keyrings",
|
||||
f"curl -fsSL https://download.docker.com/linux/{DISTRO}/gpg | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg",
|
||||
"sudo chmod a+r /etc/apt/keyrings/docker.gpg",
|
||||
f""" echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/{DISTRO} "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null """,
|
||||
"apt update"
|
||||
],
|
||||
_sudo=True
|
||||
)
|
||||
|
||||
apt.packages(
|
||||
packages=[
|
||||
"docker-ce",
|
||||
"docker-ce-cli",
|
||||
"containerd.io",
|
||||
"docker-buildx-plugin",
|
||||
"docker-compose-plugin",
|
||||
],
|
||||
present=True,
|
||||
_sudo=True
|
||||
)
|
||||
|
||||
|
||||
server.shell(
|
||||
name="Install Lazydocker system-wide",
|
||||
commands=[
|
||||
'export DIR=/usr/local/bin && curl -fsSL https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash -s --'
|
||||
],
|
||||
_sudo=True
|
||||
)
|
||||
|
||||
# Install required packages
|
||||
apt.packages(
|
||||
name="Install required dependencies",
|
||||
packages=["ca-certificates", "curl", "gnupg", "lsb-release"],
|
||||
update=True,
|
||||
_sudo=True
|
||||
)
|
||||
|
||||
# Download and store the GPG key
|
||||
server.shell(
|
||||
name="Download and store Azlux repo GPG key",
|
||||
commands=[
|
||||
"curl -fsSL https://azlux.fr/repo.gpg.key | gpg --dearmor --yes -o /usr/share/keyrings/azlux-archive-keyring.gpg"
|
||||
],
|
||||
_sudo=True
|
||||
)
|
||||
|
||||
# Add the repository to sources.list
|
||||
server.shell(
|
||||
name="Add Azlux repository to APT sources",
|
||||
commands=[
|
||||
""" echo "deb [arch="$(dpkg --print-architecture)" signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian bookworm main" | sudo tee /etc/apt/sources.list.d/azlux.list > /dev/null """,
|
||||
],
|
||||
_sudo=True
|
||||
)
|
||||
|
||||
# Update APT and install docker-ctop
|
||||
apt.update(
|
||||
name="Update package lists",
|
||||
_sudo=True
|
||||
)
|
||||
|
||||
apt.packages(
|
||||
name="Install docker-ctop",
|
||||
packages=["docker-ctop"],
|
||||
_sudo=True
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Manifest } from '@bitsquare/nopy-cube';
|
||||
import { z } from 'zod';
|
||||
|
||||
export default Manifest({
|
||||
id: 'runtime:docker',
|
||||
name: 'Install docker and tools',
|
||||
dependencies: () => [],
|
||||
schema: z.object({
|
||||
DISTRO: z.enum(['ubuntu', 'debian']).default('ubuntu').describe('Linux distribution to target'),
|
||||
}),
|
||||
});
|
||||
@@ -0,0 +1,83 @@
|
||||
# nodevm
|
||||
|
||||
**Install Node.js with essential global packages**
|
||||
|
||||
## Purpose
|
||||
|
||||
This cube installs the latest LTS (Long Term Support) version of Node.js along with essential global npm packages commonly needed for development and deployment.
|
||||
|
||||
## What is Node.js?
|
||||
|
||||
Node.js is a JavaScript runtime built on Chrome's V8 engine that allows you to run JavaScript on the server. It's widely used for:
|
||||
|
||||
- Building web servers and APIs
|
||||
- Command-line tools
|
||||
- Build tools and task runners
|
||||
- Real-time applications (chat, notifications)
|
||||
- Microservices
|
||||
|
||||
## What This Cube Does
|
||||
|
||||
1. **Installs Node.js LTS**
|
||||
- Downloads and runs the official NodeSource setup script
|
||||
- Installs the latest LTS version of Node.js
|
||||
- Includes npm (Node Package Manager)
|
||||
|
||||
2. **Installs build dependencies**
|
||||
- `libssl-dev` - SSL/TLS libraries
|
||||
- `libtool` - Library building tools
|
||||
- `cmake` - Cross-platform build system
|
||||
- `libpng-dev`, `libjpeg-dev`, `libvips-dev` - Image processing libraries
|
||||
|
||||
3. **Installs global npm packages**
|
||||
- **npm@11.1.0** - Latest npm version
|
||||
- **pm2** - Production process manager for Node.js apps
|
||||
- **yarn** - Alternative package manager
|
||||
- **local-web-server** - Local development web server
|
||||
- **node-gyp** - Node.js native addon build tool
|
||||
- **inquirer** - Interactive command-line prompts
|
||||
- **execa** - Better child process execution
|
||||
- **@dotenvx/dotenvx** - Environment variable management
|
||||
|
||||
## Configuration
|
||||
|
||||
This cube currently has no configurable parameters.
|
||||
|
||||
## Dependencies
|
||||
|
||||
None - this cube can run standalone.
|
||||
|
||||
## Post-Installation
|
||||
|
||||
Verify installation:
|
||||
```bash
|
||||
node --version
|
||||
npm --version
|
||||
```
|
||||
|
||||
Common commands:
|
||||
- Run a Node.js app: `node app.js`
|
||||
- Start with PM2: `pm2 start app.js`
|
||||
- Install packages: `npm install <package>`
|
||||
- Use yarn: `yarn add <package>`
|
||||
|
||||
## PM2 - Process Manager
|
||||
|
||||
PM2 is included for production deployments. Common PM2 commands:
|
||||
|
||||
```bash
|
||||
pm2 start app.js # Start application
|
||||
pm2 list # List running apps
|
||||
pm2 stop app # Stop application
|
||||
pm2 restart app # Restart application
|
||||
pm2 logs # View logs
|
||||
pm2 startup # Enable PM2 on boot
|
||||
pm2 save # Save current process list
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- Node.js is installed system-wide
|
||||
- Global packages are accessible to all users
|
||||
- npm cache is stored in `~/.npm`
|
||||
- Use `nvm` if you need multiple Node.js versions
|
||||
@@ -0,0 +1,58 @@
|
||||
from pyinfra.operations import server, apt, npm, python
|
||||
from pyinfra import host
|
||||
from pyinfra.facts.files import Directory
|
||||
from pyinfra.facts.server import Which
|
||||
|
||||
hasNode = host.get_fact(Which, 'node')
|
||||
VERSION = host.data.VERSION
|
||||
ALIAS = host.data.ALIAS
|
||||
GLOBAL_PACKAGES = host.data.GLOBAL_PACKAGES
|
||||
USER = host.data.USER
|
||||
|
||||
apt.packages(
|
||||
name=f'Install nodejs tools',
|
||||
no_recommends=True,
|
||||
packages=[
|
||||
'build-essential',
|
||||
'libssl-dev',
|
||||
'libtool',
|
||||
'cmake',
|
||||
'libcairo2-dev',
|
||||
'libpango1.0-de',
|
||||
'libpng-dev',
|
||||
'libgif-dev',
|
||||
'libjpeg-dev',
|
||||
'libvips-dev',
|
||||
'librsvg2-dev',
|
||||
'libpixman-1-dev',
|
||||
],
|
||||
_sudo = True,
|
||||
)
|
||||
|
||||
server.shell(
|
||||
commands=[
|
||||
"curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash",
|
||||
"omf install nvm",
|
||||
f"nvm install {VERSION}",
|
||||
f"nvm alias {ALIAS} {VERSION}",
|
||||
"set -gx NVM_DIR $HOME/.nvm",
|
||||
],
|
||||
_sudo=True,
|
||||
_su_user=USER,
|
||||
_use_su_login=True,
|
||||
_shell_executable='/usr/bin/fish'
|
||||
)
|
||||
|
||||
|
||||
server.shell(
|
||||
commands=[
|
||||
"npm install -g pm2 yarn local-web-server node-gyp inquirer execa @dotenvx/dotenvx"
|
||||
],
|
||||
_sudo=True,
|
||||
_su_user=USER,
|
||||
_use_su_login=True,
|
||||
_shell_executable='/usr/bin/fish'
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Manifest } from '@bitsquare/nopy-cube';
|
||||
import { z } from 'zod';
|
||||
|
||||
export default Manifest({
|
||||
id: 'runtime:nodevm',
|
||||
name: 'Install nvm and nodejs with global packages',
|
||||
dependencies: () => [],
|
||||
schema: z.object({
|
||||
VERSION: z
|
||||
.nullable(z.string())
|
||||
.describe('Node.js version to install. It is recommended to use semver notation')
|
||||
.default('v22.20.0'),
|
||||
USER: z.string().describe('Username for which to install nodejs').default('vagrant'),
|
||||
ALIAS: z.string().describe('The alias for this node version').default('nodelts'),
|
||||
GLOBAL_PACKAGES: z
|
||||
.string()
|
||||
.describe('Space-separated list of global npm packages to install')
|
||||
.default('npm-check-updates'),
|
||||
}),
|
||||
});
|
||||
Reference in New Issue
Block a user