smartmachine 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/smart_machine/apps/container.rb +2 -1
- data/lib/smart_machine/buildpackers/buildpacker.rb +1 -1
- data/lib/smart_machine/machine.rb +53 -40
- data/lib/smart_machine/syncer.rb +3 -1
- data/lib/smart_machine/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ead0adeacd301bcd2ef709762b390ebdd7391bd22b1281bfb5816c61d5e5898
|
4
|
+
data.tar.gz: 951b8525f250d09e74c2a9941e4f9ced364368094f3be6ab1c7f0a3d237f8b3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42c85a60e0a958b1b0261c44cace2a9aedadb9615341e098e274068284e71643525ffe2793ecc026c55023fb017ae8b4cc2c6fb3c8cb2436b4c69f09eea5dd16
|
7
|
+
data.tar.gz: 1dfaf1d47f11b054831f69507c07acafd80f55ec3af82cceefd718212c72636fa6332d079e17a552741601957e313f59afe5d001ffcaaf89110a96b4e384e09c
|
data/README.md
CHANGED
@@ -65,6 +65,11 @@ Install the engine and buildpacker:
|
|
65
65
|
|
66
66
|
## Usage
|
67
67
|
|
68
|
+
### Setup your Network
|
69
|
+
|
70
|
+
$ smartmachine machine network up
|
71
|
+
$ smartmachine machine network down
|
72
|
+
|
68
73
|
### Choose Your Grids
|
69
74
|
|
70
75
|
Choose only the grids you need. You can start or stop a grid at anytime using <b>up</b> or <b>down</b> commands respectively.
|
@@ -33,10 +33,11 @@ module SmartMachine
|
|
33
33
|
"--volume='#{@home_dir}/smartmachine/apps/containers/#{@appname}/app/public/packs:/app/public/packs'",
|
34
34
|
"--volume='#{@home_dir}/smartmachine/apps/containers/#{@appname}/app/node_modules:/app/node_modules'",
|
35
35
|
"--volume='#{@home_dir}/smartmachine/apps/containers/#{@appname}/app/storage:/app/storage'",
|
36
|
+
(using_buildpacker ? "--cpus=1 --memory=512m --memory-swap=1024m" : nil),
|
36
37
|
"--restart='always'",
|
37
38
|
"--init",
|
38
39
|
# "--network='nginx-network'",
|
39
|
-
|
40
|
+
(using_buildpacker ? "smartmachine/buildpackers/rails:#{SmartMachine.version}" : @appimage)
|
40
41
|
]
|
41
42
|
command.push(using_command) if using_command.present?
|
42
43
|
|
@@ -95,7 +95,7 @@ module SmartMachine
|
|
95
95
|
poppler-utils && \
|
96
96
|
rm -rf /var/lib/apt/lists/* && \
|
97
97
|
# ImageMagick 7. Remove this after its dependency is gone from ruby on rails.
|
98
|
-
cd /opt && wget https://download.imagemagick.org/archive/ImageMagick-7.1.1-29.tar.gz && \
|
98
|
+
cd /opt && wget https://download.imagemagick.org/archive/releases/ImageMagick-7.1.1-29.tar.gz && \
|
99
99
|
tar xvzf ImageMagick-7.1.1-29.tar.gz && \
|
100
100
|
cd ImageMagick-7.1.1-29 && \
|
101
101
|
./configure && \
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require "net/ssh"
|
2
3
|
|
3
4
|
module SmartMachine
|
@@ -60,36 +61,23 @@ module SmartMachine
|
|
60
61
|
def setup
|
61
62
|
getting_started
|
62
63
|
securing_your_server
|
64
|
+
setup_services
|
63
65
|
end
|
64
66
|
|
65
67
|
private
|
66
68
|
|
67
69
|
def getting_started
|
68
|
-
|
70
|
+
end
|
69
71
|
|
70
|
-
|
71
|
-
#
|
72
|
-
#
|
73
|
-
# sysctl_lines.push('# When getting a VM from a service provider, you will usually get a VM guest and not a VM host and hence these lines should not be added.')
|
74
|
-
# sysctl_lines.push('# Prevent bridged traffic from being processed by iptables rules.')
|
75
|
-
# sysctl_lines.push('net.bridge.bridge-nf-call-ip6tables=0')
|
76
|
-
# sysctl_lines.push('net.bridge.bridge-nf-call-iptables=0')
|
77
|
-
# sysctl_lines.push('net.bridge.bridge-nf-call-arptables=0')
|
78
|
-
sysctl_lines.push('# Redis uses this.')
|
79
|
-
sysctl_lines.push('vm.overcommit_memory=1')
|
80
|
-
sysctl_lines.push('# Elasticsearch uses this.')
|
81
|
-
sysctl_lines.push('vm.max_map_count=262144')
|
82
|
-
commands = [
|
83
|
-
"sudo touch /etc/sysctl.d/99-smartmachine.conf",
|
84
|
-
"echo -e '#{sysctl_lines.join('\n')}' | sudo tee /etc/sysctl.d/99-smartmachine.conf",
|
85
|
-
"sudo sysctl -p /etc/sysctl.d/99-smartmachine.conf"
|
86
|
-
]
|
87
|
-
run_on_machine(commands: commands)
|
72
|
+
def securing_your_server
|
73
|
+
# apt update && apt upgrade
|
74
|
+
# puts 'When updating some packages, you may be prompted to use updated configuration files. If prompted, it is typically safer to keep the locally installed version.'
|
88
75
|
|
89
76
|
# apt install locales-all
|
90
|
-
|
91
77
|
# puts 'You may be prompted to make a menu selection when the Grub package is updated on Ubuntu. If prompted, select keep the local version currently installed.'
|
92
|
-
|
78
|
+
|
79
|
+
# dpkg-reconfigure tzdata
|
80
|
+
# date
|
93
81
|
|
94
82
|
# hostnamectl set-hostname SmartMachine.credentials.machine[:name]
|
95
83
|
|
@@ -99,24 +87,6 @@ module SmartMachine
|
|
99
87
|
# 203.0.113.10 SmartMachine.credentials.machine[:name].example.com SmartMachine.credentials.machine[:name]
|
100
88
|
# 2600:3c01::a123:b456:c789:d012 SmartMachine.credentials.machine[:name].example.com SmartMachine.credentials.machine[:name]
|
101
89
|
|
102
|
-
# dpkg-reconfigure tzdata
|
103
|
-
# date
|
104
|
-
end
|
105
|
-
|
106
|
-
def securing_your_server
|
107
|
-
# apt install unattended-upgrades
|
108
|
-
# dpkg-reconfigure --priority=low unattended-upgrades
|
109
|
-
|
110
|
-
# nano /etc/apt/apt.conf.d/20auto-upgrades
|
111
|
-
# APT::Periodic::Update-Package-Lists "1";
|
112
|
-
# APT::Periodic::Download-Upgradeable-Packages "1";
|
113
|
-
# APT::Periodic::AutocleanInterval "7";
|
114
|
-
# APT::Periodic::Unattended-Upgrade "1";
|
115
|
-
|
116
|
-
# apt install apticron
|
117
|
-
# /usr/lib/apticron/apticron.conf
|
118
|
-
# EMAIL="root@example.com"
|
119
|
-
|
120
90
|
# adduser example_user
|
121
91
|
# adduser example_user sudo
|
122
92
|
|
@@ -143,10 +113,53 @@ module SmartMachine
|
|
143
113
|
# sudo apt install sendmail
|
144
114
|
# sudo cp /etc/fail2ban/fail2ban.conf /etc/fail2ban/fail2ban.local
|
145
115
|
# sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
|
146
|
-
# Change destmail
|
116
|
+
# Change destmail
|
147
117
|
# Change action = %(action_mwl)s
|
148
118
|
# sudo fail2ban-client reload
|
149
119
|
# sudo fail2ban-client status
|
120
|
+
|
121
|
+
# Send email to show that there is a need for pending updates to be completed
|
122
|
+
# apt install apticron
|
123
|
+
# /usr/lib/apticron/apticron.conf
|
124
|
+
# EMAIL="root@example.com"
|
125
|
+
|
126
|
+
# Automatic Updates
|
127
|
+
# apt install unattended-upgrades
|
128
|
+
# sudo systemctl enable unattended-upgrades
|
129
|
+
# sudo systemctl start unattended-upgrades
|
130
|
+
# nano /etc/apt/apt.conf.d/50unattended-upgrades
|
131
|
+
# Unattended-Upgrade::Mail "destemail@domain.com";
|
132
|
+
# Unattended-Upgrade::SyslogEnable "true";
|
133
|
+
# Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
|
134
|
+
# Unattended-Upgrade::Remove-New-Unused-Dependencies "true";
|
135
|
+
# Unattended-Upgrade::Remove-Unused-Dependencies "true";
|
136
|
+
# nano /etc/apt/apt.conf.d/20auto-upgrades
|
137
|
+
# APT::Periodic::Update-Package-Lists "1";
|
138
|
+
# APT::Periodic::Unattended-Upgrade "1";
|
139
|
+
# APT::Periodic::AutocleanInterval "7";
|
140
|
+
end
|
141
|
+
|
142
|
+
def setup_services
|
143
|
+
run_on_machine(commands: "sudo apt update && sudo apt upgrade")
|
144
|
+
|
145
|
+
sysctl_lines = []
|
146
|
+
# sysctl_lines.push('# KVM uses this.')
|
147
|
+
# sysctl_lines.push('# These lines should only be activated for VM hosts and not for VM guests.')
|
148
|
+
# sysctl_lines.push('# When getting a VM from a service provider, you will get a VM guest and not a VM host and hence these lines should not be added.')
|
149
|
+
# sysctl_lines.push('# Prevent bridged traffic from being processed by iptables rules.')
|
150
|
+
# sysctl_lines.push('net.bridge.bridge-nf-call-ip6tables=0')
|
151
|
+
# sysctl_lines.push('net.bridge.bridge-nf-call-iptables=0')
|
152
|
+
# sysctl_lines.push('net.bridge.bridge-nf-call-arptables=0')
|
153
|
+
sysctl_lines.push('# Redis uses this.')
|
154
|
+
sysctl_lines.push('vm.overcommit_memory=1')
|
155
|
+
sysctl_lines.push('# Elasticsearch uses this.')
|
156
|
+
sysctl_lines.push('vm.max_map_count=262144')
|
157
|
+
commands = [
|
158
|
+
"sudo touch /etc/sysctl.d/99-smartmachine.conf",
|
159
|
+
"echo -e '#{sysctl_lines.join('\n')}' | sudo tee /etc/sysctl.d/99-smartmachine.conf",
|
160
|
+
"sudo sysctl -p /etc/sysctl.d/99-smartmachine.conf"
|
161
|
+
]
|
162
|
+
run_on_machine(commands: commands)
|
150
163
|
end
|
151
164
|
end
|
152
165
|
end
|
data/lib/smart_machine/syncer.rb
CHANGED
@@ -8,7 +8,9 @@ module SmartMachine
|
|
8
8
|
|
9
9
|
push if initial
|
10
10
|
|
11
|
-
pull
|
11
|
+
# Uncomment this if you want to implement pull in sync.
|
12
|
+
# Ideally please remove this functionality in favour of entire server folder backup feature.
|
13
|
+
#pull
|
12
14
|
push
|
13
15
|
|
14
16
|
puts "-----> Syncing SmartMachine Complete"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartmachine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- plainsource
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -417,8 +417,8 @@ licenses:
|
|
417
417
|
metadata:
|
418
418
|
homepage_uri: https://github.com/plainsource/smartmachine
|
419
419
|
bug_tracker_uri: https://github.com/plainsource/smartmachine/issues
|
420
|
-
changelog_uri: https://github.com/plainsource/smartmachine/releases/tag/v1.2.
|
421
|
-
source_code_uri: https://github.com/plainsource/smartmachine/tree/v1.2.
|
420
|
+
changelog_uri: https://github.com/plainsource/smartmachine/releases/tag/v1.2.2
|
421
|
+
source_code_uri: https://github.com/plainsource/smartmachine/tree/v1.2.2
|
422
422
|
post_install_message:
|
423
423
|
rdoc_options: []
|
424
424
|
require_paths:
|