Class: Mimas::CLI::Commands::Provision
- Inherits:
-
BaseCommand
- Object
- Dry::CLI::Command
- BaseCommand
- Mimas::CLI::Commands::Provision
- Defined in:
- lib/mimas/commands/provision.rb
Constant Summary
Constants included from Template
Instance Method Summary collapse
Methods inherited from BaseCommand
Methods included from Terminal::Printer
Methods included from SSH
Methods included from Template
#copy_file, lookup_paths, #read_file, #template
Constructor Details
This class inherits a constructor from Mimas::CLI::Commands::BaseCommand
Instance Method Details
#call(server_name:, **options) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/mimas/commands/provision.rb', line 18 def call(server_name:, **) server = Config.current.servers[server_name.to_sym] sudo_user = [:user] skip_ruby = [:skip_ruby] server.harden say "Waiting for server to come back online ..." sleep 30 connection_retries = 0 begin connection_retries += 1 Net::SSH.start(server.host, sudo_user, **server.)&.close rescue sleep 5 retry if connection_retries < 5 say "Unable to re-connect to server." say "Wait for the server to come online, then run `bin/mimas setup`" end server.setup_deploy_user(sudo_user: sudo_user) server.install_caddy(sudo_user: sudo_user) unless skip_ruby server.install_server_software(sudo_user: sudo_user) server.install_ruby end say "" say "Your server is provisioned and ready to serve websites." end |