# This is a sample VM definition showing all possible settings. It will # create a LAMP machine hosting a Wordpress instance. # Usage: # mulch vm create sample-vm-full.toml name = "testvm" hostname = "testvm.localdomain" # default: localhost or first domain if provided (see below) timezone = "Europe/Paris" # default app_user = "app" # default seed = "debian_12" # Will speed up creation for this test (no update/upgrade) # (but install will not be up to date, don't do this in production!) init_upgrade = false disk_size = "20G" ram_size = "2G" cpu_count = 1 # Define system-wide environment variables env = [ ["TEST1", "foo"], ["TEST2", "bar"], # this one actually works with default apache prepare scripts ["MULCH_HTTP_BASIC_AUTH", "mulch:secret"], ] env_raw = ''' TEST3="regular .env format" ''' # Tags will allow you to search a group of VM # ex: mulch vm search 'has_tag("myclient")' # You can also add a tag from a prepare script, print a line like: _MULCH_TAG_ADD=pgsql tags = ["online-shop", "ruby"] # DNS domains # 'test1.localhost->1234' means that 'test1.localhost' HTTP requests # are going to be proxied to VM's 1234 port. Default is 80. domains = ['test1.localhost->1234', 'dev.localhost->8080'] redirect_to_https = false # (false = proxy also from tcp/80) redirects = [ ["www.test1.localhost", "test1.localhost"], ["old.test1.localhost", "test1.localhost", "301"], # default HTTP redirect is 302 ] # Allow communications **between VMs** of the same @group using a TCP-proxy # Notes: # - only TCP is supported currently # - groups are automatically declared # - you can import a non-existing (yet) port (with a warning) ports = [ # Export a port: # any VMs can then connect to my PgSQL server using "5432/tcp<-@mygroup" "5432/tcp->@mygroup", # Access an exported port: # you can connect to the Redis server of another VM using: # host: $_MULCH_PROXY_IP # port: $_6379_TCP (or $_PORT1, see below) "6379/tcp<-@mygroup", # In some cases, $_6379_TCP is not good option (variable may not exist yet # because of a recent vm redefine or because you imported two 6379 port # from two different groups). In this case, use $_PORTx variables: # $_PORT1 is for the first "<-" port in the list # $_PORT2 the second one, and so on… # Another example with rsync, connect to: # $_MULCH_PROXY_IP:$_873_TCP or # $_MULCH_PROXY_IP:$_PORT2 "873/tcp<-@mygroup", # Expose IRC server of this VM to the outside world (PUBLIC keyword) # (will listen on all host's interfaces) "6667/tcp->@PUBLIC", # For PUBLIC, you may specify a different port on both sides "6667/tcp->@PUBLIC:6668", # Port ranges are available, too "8080-8090/tcp->@PUBLIC", "9080-9090/tcp->@PUBLIC:4000-4010", # PROXY protocol is supported, see deb-proxy-proto.sh prepare script # for transparent client IP forwarding "8081/tcp->@PUBLIC (PROXY)", # default PROXY protocol server port is 8443 "8082/tcp->@PUBLIC (PROXY:8888)", # … but you can change it ] backup_disk_size = "2G" # backup speed vs back size (it depends a lot on backup content) backup_compress = true # Auto-rebuild this VM every week, possible values: daily/weekly/monthly # See also auto_rebuild_time global setting. # Default is "" (auto-rebuild disabled) # You must have backup and restore scripts to enable auto-rebuild. auto_rebuild = "weekly" # Maximum time allowed for a VM creation / rebuild (not including backup/restore) # (see https://pkg.go.dev/time#ParseDuration for syntax) build_timeout = "10m" # Lifecyle scripts # If all prepare scripts share the same base URL, you can use prepare_prefix_url. # Otherwise, use absolute URL in 'prepare': admin@https://server/script.sh # It supports the following schemes: file://, http://, https:// # You can also use 'origins', allowing GIT repositories and a cleaner syntax (see mulchd.toml) # ex: admin@{core}/prepare/deb-comfort.sh prepare_prefix_url = "https://raw.githubusercontent.com/OnitiFR/mulch/master/scripts/prepare/" prepare = [ # user@script "admin@deb-comfort.sh", "admin@test-warn.sh", "admin@deb-lamp.sh", # "admin@file:///tmp/test.sh", ] # from this point, we use {origins} instead of prefixes # Install (done after prepare, and not replayed on VM rebuild) install = [ "app@{core}/install/deb-wordpress.sh", ] # Backup backup = [ "app@{core}/backup/lamp.sh", ] # Restore restore = [ "app@{core}/restore/wordpress.sh", ] # Scripts for usual tasks on the VM # example : mulch do myvm open #[[do-actions]] #name = "open" #script = "{core}/actions/open.sh" #user = "app" #description = "Open VM first domain in the browser" # Do actions can also be added via 'prepare' scripts # Print the following lines: # _MULCH_ACTION_NAME=open # _MULCH_ACTION_SCRIPT={core}/actions/open.sh # _MULCH_ACTION_USER=app # _MULCH_ACTION_DESCRIPTION=Open VM first domain in the browser # _MULCH_ACTION=commit # Multiple actions per script are allowed, just repeat the previous "block". # Do actions may execute special commands on the client, ex: # echo "_MULCH_OPEN_URL=https://$_DOMAIN_FIRST/test" # echo "_MULCH_DOWNLOAD_FILE=$USER@$filename"