mirror of
https://github.com/namibia/awesome-cheatsheets.git
synced 2024-12-19 16:53:15 +00:00
Tools: add Nanobox
This commit is contained in:
parent
ccb9f907d5
commit
234241a6cf
250
tools/nanobox_boxfile.yml
Normal file
250
tools/nanobox_boxfile.yml
Normal file
@ -0,0 +1,250 @@
|
||||
# *****************************************************************************
|
||||
# SECTIONS OF THE BOXFILE
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
# Boxfiles consist of a handful of sections or "nodes": run.config, deploy.config, web, worker, data.
|
||||
# These are covered in detail in the next few docs, but here are some quick descriptions:
|
||||
|
||||
# run.config - Defines the build, environment, and configuration for web and worker components.
|
||||
# deploy.config - Defines deploy hooks and possible code transformations.
|
||||
# web - Defines settings unique to each web component.
|
||||
# worker - Defines settings unique to each worker component.
|
||||
# data - Defines settings unique to a specific data component.
|
||||
|
||||
|
||||
# *****************************************************************************
|
||||
# RUN.CONFIG
|
||||
# https://docs.nanobox.io/boxfile/run-config/
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
run.config:
|
||||
# Engine
|
||||
engine: engine-name
|
||||
|
||||
# Configuration used by the engine
|
||||
engine.config:
|
||||
runtime: ruby-2.3
|
||||
|
||||
# Contents of these dirs to be cached inside of Nanobox
|
||||
cache_dirs:
|
||||
- vendor
|
||||
- packages
|
||||
|
||||
# Extra Packages (in addition to what the engine installs)
|
||||
extra_packages:
|
||||
- nodejs
|
||||
- newrelic
|
||||
|
||||
# Dev Packages
|
||||
dev_packages:
|
||||
- psutils
|
||||
|
||||
# Build Triggers - Changes to these files automatically
|
||||
# trigger a new build the next time a build is required.
|
||||
build_triggers:
|
||||
- Gemfile
|
||||
- Gemfile.lock
|
||||
- package.json
|
||||
|
||||
# Additions to $PATH
|
||||
extra_path_dirs:
|
||||
- vendor/bin
|
||||
|
||||
# Custom commands to prepare the environment
|
||||
extra_steps:
|
||||
- npm install
|
||||
|
||||
# Enable filesystem watcher
|
||||
fs_watch: true
|
||||
|
||||
|
||||
# *****************************************************************************
|
||||
# DEPLOY.CONFIG
|
||||
# https://docs.nanobox.io/boxfile/deploy-config/
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
deploy.config:
|
||||
# Custom commands to prepare the production environment
|
||||
extra_steps:
|
||||
- mv config-prod.yml config.yml
|
||||
|
||||
# Run after your code has been deployed to your live app,
|
||||
# but before everything is locked down with read-only permissions and distributed into new containers/servers.
|
||||
transform:
|
||||
- 'sed -i /HOST/$DATA_DB_HOST/g config/database.xml'
|
||||
- 'if [ "$ENV" = "prod" ]; then mv config-prod.yml config.yml; fi'
|
||||
|
||||
# Run command on any one instance of web.main component before activation
|
||||
before_live:
|
||||
web.main:
|
||||
- 'bundle exec rake clear-cache'
|
||||
|
||||
# Run command on all instances of web.main component before activation
|
||||
before_live_all:
|
||||
web.main:
|
||||
- 'bundle exec rake register-nodes'
|
||||
|
||||
# Run command on any one instance of web.main component after activation
|
||||
after_live:
|
||||
worker.mail:
|
||||
- 'bundle exec rake prime-cache'
|
||||
|
||||
# Run command on all instances of web.main component after activation
|
||||
after_live_all:
|
||||
worker.mail:
|
||||
- 'bundle exec rake prime-local-cache'
|
||||
|
||||
# Set a timeout for your deploy hooks
|
||||
hook_timeout: 300
|
||||
|
||||
|
||||
# *****************************************************************************
|
||||
# WEB
|
||||
# https://docs.nanobox.io/boxfile/web/
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
web.site:
|
||||
# Start Command
|
||||
start: start-command
|
||||
|
||||
# Stop Config
|
||||
stop: stop-command
|
||||
stop_force: false
|
||||
stop_timeout: 60
|
||||
|
||||
# Current Working Directory
|
||||
cwd: directory
|
||||
|
||||
# Routing
|
||||
routes:
|
||||
- 'sub:/path/'
|
||||
- '/admin/'
|
||||
|
||||
# Port Mapping
|
||||
ports:
|
||||
- tcp:21:3420
|
||||
- udp:53:3000
|
||||
|
||||
# Network Storage
|
||||
network_dirs:
|
||||
data.files:
|
||||
- path/to/directoryA
|
||||
- path/to/directoryB
|
||||
data.unfs:
|
||||
- path/to/directoryC
|
||||
|
||||
# Writable Dirs
|
||||
writable_dirs:
|
||||
- path/to/dirA
|
||||
- path/to/dirB
|
||||
|
||||
# Custom Logs
|
||||
log_watch:
|
||||
app[error]: /app/path/to/error.log
|
||||
|
||||
# Cron
|
||||
cron:
|
||||
- id: flush_cache
|
||||
schedule: '0 0 * * *'
|
||||
command: rm -rf app/cache/*
|
||||
- id: echo_msg
|
||||
schedule: '*/3 */2 1-3 2,6,7 2'
|
||||
command: echo i\'m a little teapot
|
||||
|
||||
# Only provision component locally
|
||||
local_only: true
|
||||
|
||||
|
||||
# *****************************************************************************
|
||||
# WORKER
|
||||
# https://docs.nanobox.io/boxfile/worker/
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
worker.jobs:
|
||||
# Start Command
|
||||
start: ruby worker.rb
|
||||
|
||||
# Stop Config
|
||||
stop: stop-command
|
||||
stop_force: false
|
||||
stop_timeout: 30
|
||||
|
||||
# Current Working Directory
|
||||
cwd: directory
|
||||
|
||||
# Network Storage
|
||||
network_dirs:
|
||||
data.storage1:
|
||||
- path/to/directoryA
|
||||
- path/to/directoryB
|
||||
data.storage2:
|
||||
- path/to/directoryC
|
||||
|
||||
# Writable Dirs
|
||||
writable_dirs:
|
||||
- path/to/dirA
|
||||
- path/to/dirB
|
||||
|
||||
# Custom Logs
|
||||
log_watch:
|
||||
job[error]: /app/path/to/error.log
|
||||
|
||||
# Cron
|
||||
cron:
|
||||
- id: flush_cache
|
||||
schedule: '0 0 * * *'
|
||||
command: rm -rf app/cache/*
|
||||
- id: echo_msg
|
||||
schedule: '*/3 */2 1-3 2,6,7 2'
|
||||
command: echo i\'m a little teapot
|
||||
|
||||
# Only provision component locally
|
||||
local_only: true
|
||||
|
||||
|
||||
# *****************************************************************************
|
||||
# DATA
|
||||
# https://docs.nanobox.io/boxfile/data/
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
data.db:
|
||||
# Image
|
||||
image: nanobox/mysql:5.6
|
||||
|
||||
# Config Options Exposed by the Image
|
||||
config:
|
||||
plugins:
|
||||
- federated
|
||||
- audit_log
|
||||
event_scheduler: 'Off'
|
||||
|
||||
# Cron
|
||||
cron:
|
||||
- id: backup
|
||||
schedule: '0 0 * * *'
|
||||
command: 'bash /path/to/scripts/backup.sh'
|
||||
- id: echo_msg
|
||||
schedule: '*/3 */2 1-3 2,6,7 2'
|
||||
command: 'echo i\'m a little teapot'
|
||||
|
||||
# Extra Packages (in addition to what the image installs)
|
||||
extra_packages:
|
||||
- perl
|
||||
- curl
|
||||
|
||||
# Additions to $PATH
|
||||
extra_path_dirs:
|
||||
- /custom/bin
|
||||
|
||||
# Custom commands to prepare the environment
|
||||
extra_steps:
|
||||
- wget -o /path/to/scripts/cron.sh http://example.com/cron.sh
|
||||
|
||||
# Only provision component locally
|
||||
local_only: true
|
115
tools/nanobox_cli.sh
Normal file
115
tools/nanobox_cli.sh
Normal file
@ -0,0 +1,115 @@
|
||||
# *****************************************************************************
|
||||
# LOCAL ENVIRONMENT
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
# Add a convenient way to access your app from the browser
|
||||
nanobox dns add local vue.dev
|
||||
nanobox dns add local django.dev
|
||||
|
||||
# Run your app as you would normally, with Nanobox
|
||||
nanobox run npm run dev --host 0.0.0.0
|
||||
nanobox run python manage.py runserver 0.0.0.0:8000
|
||||
|
||||
# View info about the app and its components for a given environment
|
||||
nanobox info local
|
||||
|
||||
|
||||
# *****************************************************************************
|
||||
# DRY RUN ENVIRONMENT
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
# Add a DNS Alias to a dry-run app
|
||||
nanobox dns add dry-run django.preview
|
||||
|
||||
# Preview your app locally
|
||||
nanobox deploy dry-run
|
||||
|
||||
# Add environment variables to dry-run
|
||||
nanobox evar add dry-run ENV=staging PROCESS_JOBS=true
|
||||
|
||||
# Console into web.site in a dry-run app
|
||||
nanobox console dry-run web.site
|
||||
|
||||
# Output the connection credentials for your dry-run components
|
||||
nanobox info dry-run
|
||||
|
||||
|
||||
# *****************************************************************************
|
||||
# PRODUCTION ENVIRONMENT
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
# Add your live app as a remote
|
||||
nanobox remote add app-name
|
||||
|
||||
# Deploy to your remote server(s)
|
||||
nanobox deploy
|
||||
|
||||
# Drop you into an interactive console inside a component running on production
|
||||
nanobox console <component.id>
|
||||
|
||||
# View logs from your app
|
||||
nanobox log [<dry-run | {remote-alias}>]
|
||||
nanobox log [<dry-run | {remote-alias}>] -n 100
|
||||
|
||||
# Creates a secure tunnel from your local machine to a production data component
|
||||
# Local port can be omitted
|
||||
nanobox tunnel <component.id> -p <local_port>
|
||||
|
||||
|
||||
# *****************************************************************************
|
||||
# ENVIRONMENT VARIABLES
|
||||
# https://docs.nanobox.io/cli/evar/
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
# Add an environment variable
|
||||
nanobox evar add local KEY1=VALUE1 KEY2=VALUE2
|
||||
|
||||
# Add environment variables from a file
|
||||
nanobox evar load local path/to/evar-file
|
||||
|
||||
# Remove an environment variable
|
||||
nanobox evar rm local KEY1
|
||||
|
||||
# List all variables for a given environment
|
||||
nanobox evar ls local
|
||||
|
||||
|
||||
# *****************************************************************************
|
||||
# CLI COMMANDS SUMMARY
|
||||
# https://docs.nanobox.io/cli/
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
nanobox-update # Update your Nanobox CLI to the most recent version
|
||||
nanobox run # Starts your local environment, allowing you to run your app
|
||||
nanobox build # Builds your app's runtime
|
||||
nanobox compile # Compiles your app's code into a deployable package
|
||||
nanobox remote # Manages connections to remote applications
|
||||
nanobox deploy # Deploys your app to a live app
|
||||
nanobox console # Opens an interactive terminal from inside a component in your live app
|
||||
nanobox info # Displays information about the app and its components
|
||||
nanobox tunnel # Establishes a secure tunnel from your local machine to a running service
|
||||
nanobox evar # Manages environment variables on your production environment
|
||||
nanobox dns # Manage DNS aliases for local applications
|
||||
nanobox log # View and streams application logs
|
||||
nanobox configure # Walks through prompts to configure Nanobox
|
||||
nanobox update-images # Downloads the most recent versions of Nanobox docker images
|
||||
nanobox login # Authenticates your Nanobox client with your nanobox.io account
|
||||
nanobox logout # Removes your nanobox.io api token from your local nanobox client
|
||||
nanobox start # Starts the Nanobox container
|
||||
nanobox stop # Stops the Nanobox container
|
||||
nanobox status # Display the status of Nanobox & apps
|
||||
nanobox destroy # Destroys the current project and removes it from Nanobox
|
||||
nanobox clean # Clean out any environments that no longer exist
|
||||
nanobox implode # Removes all Nanobox-created containers, files, & data
|
||||
nanobox version # Show the current Nanobox version
|
||||
|
||||
--help # Displays help information about the CLI and specific commands
|
||||
--debug # In the event of a failure, drop into a debug context
|
||||
-t, --trace # Increases display output and sets level to 'trace'
|
||||
-v, --verbose # Increases display output and sets level to 'debug'
|
||||
-f, --force # Forces the command to run without any confirmation. Use responsibly!
|
Loading…
Reference in New Issue
Block a user