itsi 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +20 -0
  3. data/crates/itsi_error/src/from.rs +26 -29
  4. data/crates/itsi_server/Cargo.lock +2956 -0
  5. data/crates/itsi_server/Cargo.toml +1 -1
  6. data/crates/itsi_server/src/request/itsi_request.rs +7 -7
  7. data/crates/itsi_server/src/server/bind.rs +4 -3
  8. data/crates/itsi_server/src/server/itsi_server.rs +1 -8
  9. data/crates/itsi_server/src/server/listener.rs +98 -107
  10. data/crates/itsi_server/src/server/serve_strategy/single_mode.rs +22 -12
  11. data/crates/itsi_server/src/server/tls.rs +9 -5
  12. data/gems/scheduler/ext/itsi_error/src/from.rs +26 -29
  13. data/gems/scheduler/ext/itsi_server/Cargo.lock +2956 -0
  14. data/gems/scheduler/ext/itsi_server/Cargo.toml +1 -1
  15. data/gems/scheduler/ext/itsi_server/src/request/itsi_request.rs +7 -7
  16. data/gems/scheduler/ext/itsi_server/src/server/bind.rs +4 -3
  17. data/gems/scheduler/ext/itsi_server/src/server/itsi_server.rs +1 -8
  18. data/gems/scheduler/ext/itsi_server/src/server/listener.rs +98 -107
  19. data/gems/scheduler/ext/itsi_server/src/server/serve_strategy/single_mode.rs +22 -12
  20. data/gems/scheduler/ext/itsi_server/src/server/tls.rs +9 -5
  21. data/gems/scheduler/lib/itsi/scheduler/version.rb +1 -1
  22. data/gems/server/Cargo.lock +2917 -0
  23. data/gems/server/Cargo.toml +7 -0
  24. data/gems/server/ext/itsi_error/src/from.rs +26 -29
  25. data/gems/server/ext/itsi_server/Cargo.lock +2956 -0
  26. data/gems/server/ext/itsi_server/Cargo.toml +1 -1
  27. data/gems/server/ext/itsi_server/src/request/itsi_request.rs +7 -7
  28. data/gems/server/ext/itsi_server/src/server/bind.rs +4 -3
  29. data/gems/server/ext/itsi_server/src/server/itsi_server.rs +1 -8
  30. data/gems/server/ext/itsi_server/src/server/listener.rs +98 -107
  31. data/gems/server/ext/itsi_server/src/server/serve_strategy/single_mode.rs +22 -12
  32. data/gems/server/ext/itsi_server/src/server/tls.rs +9 -5
  33. data/gems/server/lib/itsi/index.html.erb +91 -0
  34. data/gems/server/lib/itsi/server/scheduler_mode.rb +1 -1
  35. data/gems/server/lib/itsi/server/version.rb +1 -1
  36. data/gems/server/lib/itsi/server.rb +22 -2
  37. data/lib/itsi/version.rb +1 -1
  38. data/sandbox/deploy/main.tf +237 -0
  39. data/sandbox/deploy/outputs.tf +4 -0
  40. data/sandbox/deploy/vars.tf +11 -0
  41. data/sandbox/falcon_benchmark/Gemfile +10 -0
  42. data/sandbox/falcon_benchmark/Gemfile.lock +140 -0
  43. data/sandbox/falcon_benchmark/config.ru +54 -0
  44. data/sandbox/itsi_sandbox_async/Gemfile +10 -0
  45. data/sandbox/itsi_sandbox_async/Gemfile.lock +69 -0
  46. data/sandbox/itsi_sandbox_async/config.ru +10 -0
  47. data/sandbox/itsi_sandbox_hanami/.env +2 -0
  48. data/sandbox/itsi_sandbox_hanami/.gitignore +6 -0
  49. data/sandbox/itsi_sandbox_hanami/.rspec +1 -0
  50. data/sandbox/itsi_sandbox_hanami/Gemfile +49 -0
  51. data/sandbox/itsi_sandbox_hanami/Gemfile.lock +440 -0
  52. data/sandbox/itsi_sandbox_hanami/Guardfile +9 -0
  53. data/sandbox/itsi_sandbox_hanami/Procfile.dev +2 -0
  54. data/sandbox/itsi_sandbox_hanami/README.md +1 -0
  55. data/sandbox/itsi_sandbox_hanami/Rakefile +3 -0
  56. data/sandbox/itsi_sandbox_hanami/app/action.rb +12 -0
  57. data/sandbox/itsi_sandbox_hanami/app/actions/.keep +0 -0
  58. data/sandbox/itsi_sandbox_hanami/app/assets/css/app.css +5 -0
  59. data/sandbox/itsi_sandbox_hanami/app/assets/images/favicon.ico +0 -0
  60. data/sandbox/itsi_sandbox_hanami/app/assets/js/app.js +1 -0
  61. data/sandbox/itsi_sandbox_hanami/app/db/relation.rb +10 -0
  62. data/sandbox/itsi_sandbox_hanami/app/db/repo.rb +10 -0
  63. data/sandbox/itsi_sandbox_hanami/app/db/struct.rb +10 -0
  64. data/sandbox/itsi_sandbox_hanami/app/operation.rb +9 -0
  65. data/sandbox/itsi_sandbox_hanami/app/relations/.keep +0 -0
  66. data/sandbox/itsi_sandbox_hanami/app/repos/.keep +0 -0
  67. data/sandbox/itsi_sandbox_hanami/app/structs/.keep +0 -0
  68. data/sandbox/itsi_sandbox_hanami/app/templates/layouts/app.html.erb +14 -0
  69. data/sandbox/itsi_sandbox_hanami/app/view.rb +9 -0
  70. data/sandbox/itsi_sandbox_hanami/app/views/helpers.rb +10 -0
  71. data/sandbox/itsi_sandbox_hanami/bin/dev +8 -0
  72. data/sandbox/itsi_sandbox_hanami/config/app.rb +8 -0
  73. data/sandbox/itsi_sandbox_hanami/config/assets.js +16 -0
  74. data/sandbox/itsi_sandbox_hanami/config/db/migrate/.keep +0 -0
  75. data/sandbox/itsi_sandbox_hanami/config/db/seeds.rb +15 -0
  76. data/sandbox/itsi_sandbox_hanami/config/puma.rb +47 -0
  77. data/sandbox/itsi_sandbox_hanami/config/routes.rb +7 -0
  78. data/sandbox/itsi_sandbox_hanami/config/settings.rb +9 -0
  79. data/sandbox/itsi_sandbox_hanami/config.ru +5 -0
  80. data/sandbox/itsi_sandbox_hanami/db/.keep +0 -0
  81. data/sandbox/itsi_sandbox_hanami/lib/itsi_hanami/types.rb +11 -0
  82. data/sandbox/itsi_sandbox_hanami/lib/tasks/.keep +0 -0
  83. data/sandbox/itsi_sandbox_hanami/package-lock.json +946 -0
  84. data/sandbox/itsi_sandbox_hanami/package.json +8 -0
  85. data/sandbox/itsi_sandbox_hanami/spec/requests/root_spec.rb +11 -0
  86. data/sandbox/itsi_sandbox_hanami/spec/spec_helper.rb +9 -0
  87. data/sandbox/itsi_sandbox_hanami/spec/support/db/cleaning.rb +42 -0
  88. data/sandbox/itsi_sandbox_hanami/spec/support/db.rb +10 -0
  89. data/sandbox/itsi_sandbox_hanami/spec/support/features.rb +5 -0
  90. data/sandbox/itsi_sandbox_hanami/spec/support/operations.rb +8 -0
  91. data/sandbox/itsi_sandbox_hanami/spec/support/requests.rb +13 -0
  92. data/sandbox/itsi_sandbox_hanami/spec/support/rspec.rb +61 -0
  93. data/sandbox/itsi_sandbox_rack/Gemfile +17 -0
  94. data/sandbox/itsi_sandbox_rack/Gemfile.lock +153 -0
  95. data/sandbox/itsi_sandbox_rack/config.ru +18 -0
  96. data/sandbox/itsi_sandbox_rack_lint/Gemfile +7 -0
  97. data/sandbox/itsi_sandbox_rack_lint/Gemfile.lock +27 -0
  98. data/sandbox/itsi_sandbox_rack_lint/config.ru +3 -0
  99. data/sandbox/itsi_sandbox_rails/.dockerignore +51 -0
  100. data/sandbox/itsi_sandbox_rails/.gitattributes +9 -0
  101. data/sandbox/itsi_sandbox_rails/.github/dependabot.yml +12 -0
  102. data/sandbox/itsi_sandbox_rails/.github/workflows/ci.yml +90 -0
  103. data/sandbox/itsi_sandbox_rails/.gitignore +34 -0
  104. data/sandbox/itsi_sandbox_rails/.kamal/hooks/docker-setup.sample +3 -0
  105. data/sandbox/itsi_sandbox_rails/.kamal/hooks/post-app-boot.sample +3 -0
  106. data/sandbox/itsi_sandbox_rails/.kamal/hooks/post-deploy.sample +14 -0
  107. data/sandbox/itsi_sandbox_rails/.kamal/hooks/post-proxy-reboot.sample +3 -0
  108. data/sandbox/itsi_sandbox_rails/.kamal/hooks/pre-app-boot.sample +3 -0
  109. data/sandbox/itsi_sandbox_rails/.kamal/hooks/pre-build.sample +51 -0
  110. data/sandbox/itsi_sandbox_rails/.kamal/hooks/pre-connect.sample +47 -0
  111. data/sandbox/itsi_sandbox_rails/.kamal/hooks/pre-deploy.sample +109 -0
  112. data/sandbox/itsi_sandbox_rails/.kamal/hooks/pre-proxy-reboot.sample +3 -0
  113. data/sandbox/itsi_sandbox_rails/.kamal/secrets +17 -0
  114. data/sandbox/itsi_sandbox_rails/.rubocop.yml +8 -0
  115. data/sandbox/itsi_sandbox_rails/.ruby-version +1 -0
  116. data/sandbox/itsi_sandbox_rails/Dockerfile +72 -0
  117. data/sandbox/itsi_sandbox_rails/Gemfile +72 -0
  118. data/sandbox/itsi_sandbox_rails/Gemfile.lock +480 -0
  119. data/sandbox/itsi_sandbox_rails/README.md +24 -0
  120. data/sandbox/itsi_sandbox_rails/Rakefile +6 -0
  121. data/sandbox/itsi_sandbox_rails/app/assets/images/.keep +0 -0
  122. data/sandbox/itsi_sandbox_rails/app/assets/stylesheets/application.css +10 -0
  123. data/sandbox/itsi_sandbox_rails/app/controllers/application_controller.rb +4 -0
  124. data/sandbox/itsi_sandbox_rails/app/controllers/concerns/.keep +0 -0
  125. data/sandbox/itsi_sandbox_rails/app/controllers/home_controller.rb +51 -0
  126. data/sandbox/itsi_sandbox_rails/app/controllers/live_controller.rb +41 -0
  127. data/sandbox/itsi_sandbox_rails/app/controllers/uploads_controller.rb +32 -0
  128. data/sandbox/itsi_sandbox_rails/app/helpers/application_helper.rb +2 -0
  129. data/sandbox/itsi_sandbox_rails/app/javascript/application.js +3 -0
  130. data/sandbox/itsi_sandbox_rails/app/javascript/controllers/application.js +9 -0
  131. data/sandbox/itsi_sandbox_rails/app/javascript/controllers/hello_controller.js +7 -0
  132. data/sandbox/itsi_sandbox_rails/app/javascript/controllers/index.js +4 -0
  133. data/sandbox/itsi_sandbox_rails/app/jobs/application_job.rb +7 -0
  134. data/sandbox/itsi_sandbox_rails/app/mailers/application_mailer.rb +4 -0
  135. data/sandbox/itsi_sandbox_rails/app/models/application_record.rb +3 -0
  136. data/sandbox/itsi_sandbox_rails/app/models/concerns/.keep +0 -0
  137. data/sandbox/itsi_sandbox_rails/app/models/post.rb +2 -0
  138. data/sandbox/itsi_sandbox_rails/app/views/layouts/application.html.erb +28 -0
  139. data/sandbox/itsi_sandbox_rails/app/views/layouts/mailer.html.erb +13 -0
  140. data/sandbox/itsi_sandbox_rails/app/views/layouts/mailer.text.erb +1 -0
  141. data/sandbox/itsi_sandbox_rails/app/views/pwa/manifest.json.erb +22 -0
  142. data/sandbox/itsi_sandbox_rails/app/views/pwa/service-worker.js +26 -0
  143. data/sandbox/itsi_sandbox_rails/bin/brakeman +7 -0
  144. data/sandbox/itsi_sandbox_rails/bin/bundle +109 -0
  145. data/sandbox/itsi_sandbox_rails/bin/dev +2 -0
  146. data/sandbox/itsi_sandbox_rails/bin/docker-entrypoint +14 -0
  147. data/sandbox/itsi_sandbox_rails/bin/importmap +4 -0
  148. data/sandbox/itsi_sandbox_rails/bin/jobs +6 -0
  149. data/sandbox/itsi_sandbox_rails/bin/kamal +27 -0
  150. data/sandbox/itsi_sandbox_rails/bin/rails +4 -0
  151. data/sandbox/itsi_sandbox_rails/bin/rake +4 -0
  152. data/sandbox/itsi_sandbox_rails/bin/rubocop +8 -0
  153. data/sandbox/itsi_sandbox_rails/bin/setup +34 -0
  154. data/sandbox/itsi_sandbox_rails/bin/thrust +5 -0
  155. data/sandbox/itsi_sandbox_rails/config/application.rb +61 -0
  156. data/sandbox/itsi_sandbox_rails/config/boot.rb +4 -0
  157. data/sandbox/itsi_sandbox_rails/config/cable.yml +17 -0
  158. data/sandbox/itsi_sandbox_rails/config/cache.yml +16 -0
  159. data/sandbox/itsi_sandbox_rails/config/credentials.yml.enc +1 -0
  160. data/sandbox/itsi_sandbox_rails/config/database.yml +40 -0
  161. data/sandbox/itsi_sandbox_rails/config/deploy.yml +116 -0
  162. data/sandbox/itsi_sandbox_rails/config/environment.rb +5 -0
  163. data/sandbox/itsi_sandbox_rails/config/environments/development.rb +72 -0
  164. data/sandbox/itsi_sandbox_rails/config/environments/production.rb +90 -0
  165. data/sandbox/itsi_sandbox_rails/config/environments/test.rb +53 -0
  166. data/sandbox/itsi_sandbox_rails/config/importmap.rb +7 -0
  167. data/sandbox/itsi_sandbox_rails/config/initializers/assets.rb +7 -0
  168. data/sandbox/itsi_sandbox_rails/config/initializers/content_security_policy.rb +25 -0
  169. data/sandbox/itsi_sandbox_rails/config/initializers/filter_parameter_logging.rb +8 -0
  170. data/sandbox/itsi_sandbox_rails/config/initializers/inflections.rb +16 -0
  171. data/sandbox/itsi_sandbox_rails/config/locales/en.yml +31 -0
  172. data/sandbox/itsi_sandbox_rails/config/puma.rb +41 -0
  173. data/sandbox/itsi_sandbox_rails/config/queue.yml +18 -0
  174. data/sandbox/itsi_sandbox_rails/config/recurring.yml +10 -0
  175. data/sandbox/itsi_sandbox_rails/config/routes.rb +21 -0
  176. data/sandbox/itsi_sandbox_rails/config/storage.yml +34 -0
  177. data/sandbox/itsi_sandbox_rails/config.ru +7 -0
  178. data/sandbox/itsi_sandbox_rails/db/cable_schema.rb +11 -0
  179. data/sandbox/itsi_sandbox_rails/db/cache_schema.rb +14 -0
  180. data/sandbox/itsi_sandbox_rails/db/migrate/20250301041554_create_posts.rb +10 -0
  181. data/sandbox/itsi_sandbox_rails/db/queue_schema.rb +129 -0
  182. data/sandbox/itsi_sandbox_rails/db/schema.rb +23 -0
  183. data/sandbox/itsi_sandbox_rails/db/seeds.rb +9 -0
  184. data/sandbox/itsi_sandbox_rails/lib/tasks/.keep +0 -0
  185. data/sandbox/itsi_sandbox_rails/log/.keep +0 -0
  186. data/sandbox/itsi_sandbox_rails/public/400.html +114 -0
  187. data/sandbox/itsi_sandbox_rails/public/404.html +114 -0
  188. data/sandbox/itsi_sandbox_rails/public/406-unsupported-browser.html +114 -0
  189. data/sandbox/itsi_sandbox_rails/public/422.html +114 -0
  190. data/sandbox/itsi_sandbox_rails/public/500.html +114 -0
  191. data/sandbox/itsi_sandbox_rails/public/icon.png +0 -0
  192. data/sandbox/itsi_sandbox_rails/public/icon.svg +3 -0
  193. data/sandbox/itsi_sandbox_rails/public/robots.txt +1 -0
  194. data/sandbox/itsi_sandbox_rails/script/.keep +0 -0
  195. data/sandbox/itsi_sandbox_rails/storage/.keep +0 -0
  196. data/sandbox/itsi_sandbox_rails/test/application_system_test_case.rb +5 -0
  197. data/sandbox/itsi_sandbox_rails/test/controllers/.keep +0 -0
  198. data/sandbox/itsi_sandbox_rails/test/fixtures/files/.keep +0 -0
  199. data/sandbox/itsi_sandbox_rails/test/fixtures/posts.yml +9 -0
  200. data/sandbox/itsi_sandbox_rails/test/helpers/.keep +0 -0
  201. data/sandbox/itsi_sandbox_rails/test/integration/.keep +0 -0
  202. data/sandbox/itsi_sandbox_rails/test/mailers/.keep +0 -0
  203. data/sandbox/itsi_sandbox_rails/test/models/.keep +0 -0
  204. data/sandbox/itsi_sandbox_rails/test/models/post_test.rb +7 -0
  205. data/sandbox/itsi_sandbox_rails/test/system/.keep +0 -0
  206. data/sandbox/itsi_sandbox_rails/test/test_helper.rb +15 -0
  207. data/sandbox/itsi_sandbox_rails/tmp/.keep +0 -0
  208. data/sandbox/itsi_sandbox_rails/tmp/pids/.keep +0 -0
  209. data/sandbox/itsi_sandbox_rails/tmp/storage/.keep +0 -0
  210. data/sandbox/itsi_sandbox_rails/vendor/.keep +0 -0
  211. data/sandbox/itsi_sandbox_rails/vendor/javascript/.keep +0 -0
  212. data/sandbox/itsi_sandbox_roda/Gemfile +5 -0
  213. data/sandbox/itsi_sandbox_roda/Gemfile.lock +44 -0
  214. data/sandbox/itsi_sandbox_roda/config.ru +39 -0
  215. data/sandbox/itsi_sinatra/Gemfile +9 -0
  216. data/sandbox/itsi_sinatra/Gemfile.lock +81 -0
  217. data/sandbox/itsi_sinatra/app.rb +9 -0
  218. data/sandbox/pebble/docker-compose.yml +11 -0
  219. data/tasks.txt +10 -4
  220. metadata +192 -5
@@ -0,0 +1,237 @@
1
+ terraform {
2
+ required_providers {
3
+ aws = {
4
+ source = "hashicorp/aws"
5
+ version = "~> 5.0"
6
+ }
7
+ cloudflare = {
8
+ source = "cloudflare/cloudflare"
9
+ version = "~> 5.0.0"
10
+ }
11
+ }
12
+
13
+ required_version = ">= 0.14.9"
14
+ }
15
+
16
+ provider "aws" {
17
+ region = var.aws_region
18
+ }
19
+
20
+
21
+ data "aws_region" "current" {
22
+ name = var.aws_region
23
+ }
24
+
25
+ data "aws_ami" "ubuntu" {
26
+ most_recent = true
27
+
28
+ filter {
29
+ name = "name"
30
+ values = ["ubuntu/images/hvm-ssd-gp3/*ubuntu-noble-24.04-arm64-server-*"]
31
+ }
32
+
33
+ filter {
34
+ name = "virtualization-type"
35
+ values = ["hvm"]
36
+ }
37
+
38
+ owners = ["099720109477"] # Canonical
39
+ }
40
+
41
+ # Create VPC
42
+ # terraform aws create vpc
43
+ resource "aws_vpc" "vpc" {
44
+ cidr_block = "10.0.0.0/16"
45
+ instance_tenancy = "default"
46
+ enable_dns_hostnames = true
47
+ tags = {
48
+ Name = "${var.environment}-vpc"
49
+ }
50
+ }
51
+ resource "aws_subnet" "public_subnet_a" {
52
+ vpc_id = aws_vpc.vpc.id
53
+ cidr_block = "10.0.1.0/24"
54
+ availability_zone = var.subnet_az
55
+ map_public_ip_on_launch = true
56
+
57
+ tags = {
58
+ Name = "${var.environment} Public Subnet A"
59
+ }
60
+ }
61
+
62
+ resource "aws_subnet" "private_subnet_a" {
63
+ vpc_id = aws_vpc.vpc.id
64
+ cidr_block = "10.0.2.0/24"
65
+ availability_zone = var.subnet_az
66
+
67
+ tags = {
68
+ Name = "${var.environment} Private Subnet A"
69
+ }
70
+ }
71
+
72
+ resource "aws_internet_gateway" "ig_a" {
73
+ vpc_id = aws_vpc.vpc.id
74
+
75
+ tags = {
76
+ Name = "${var.environment} Internet Gateway A"
77
+ }
78
+ }
79
+
80
+ resource "aws_route_table" "public_rt" {
81
+ vpc_id = aws_vpc.vpc.id
82
+
83
+ route {
84
+ cidr_block = "0.0.0.0/0"
85
+ gateway_id = aws_internet_gateway.ig_a.id
86
+ }
87
+
88
+ route {
89
+ ipv6_cidr_block = "::/0"
90
+ gateway_id = aws_internet_gateway.ig_a.id
91
+ }
92
+
93
+ tags = {
94
+ Name = "${var.environment} Public Route Table"
95
+ }
96
+ }
97
+
98
+ resource "aws_route_table_association" "public_1_rt_a" {
99
+ subnet_id = aws_subnet.public_subnet_a.id
100
+ route_table_id = aws_route_table.public_rt.id
101
+ }
102
+
103
+ resource "aws_security_group" "web_sg" {
104
+ name = "HTTP and SSH"
105
+ vpc_id = aws_vpc.vpc.id
106
+
107
+ ingress {
108
+ from_port = 443
109
+ to_port = 443
110
+ protocol = "tcp"
111
+ cidr_blocks = ["0.0.0.0/0"]
112
+ }
113
+
114
+
115
+ ingress {
116
+ from_port = 80
117
+ to_port = 80
118
+ protocol = "tcp"
119
+ cidr_blocks = ["0.0.0.0/0"]
120
+ }
121
+
122
+ ingress {
123
+ from_port = 22
124
+ to_port = 22
125
+ protocol = "tcp"
126
+ cidr_blocks = ["0.0.0.0/0"]
127
+ }
128
+
129
+ egress {
130
+ from_port = 0
131
+ to_port = 0
132
+ protocol = -1
133
+ cidr_blocks = ["0.0.0.0/0"]
134
+ }
135
+
136
+ tags = {
137
+ Name = "${var.environment} Web Security Group"
138
+ }
139
+ }
140
+
141
+
142
+ resource "aws_instance" "web" {
143
+ ami = data.aws_ami.ubuntu.id
144
+ instance_type = "t4g.micro"
145
+ key_name = "key-pair-aws-admin"
146
+ iam_instance_profile = aws_iam_instance_profile.web.name
147
+
148
+ tags = {
149
+ Name = "web-${var.environment}"
150
+ }
151
+
152
+ subnet_id = aws_subnet.public_subnet_a.id
153
+ security_groups = [aws_security_group.web_sg.id]
154
+ associate_public_ip_address = true
155
+
156
+ user_data = <<EOF
157
+ #!/bin/bash
158
+ apt-get update
159
+ apt-get install zlib1g-dev libyaml-dev libssl-dev libffi-dev libgmp3-dev libclang-dev build-essential -y && \
160
+ apt-get clean && rm -rf /var/lib/apt/lists/* && apt-get autoremove -y
161
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
162
+ curl https://mise.run | sh
163
+ echo "eval \"\$(/root/.local/bin/mise activate bash)\"" >> ~/.bashrc
164
+ eval "$(/root/.local/bin/mise activate bash)"
165
+ mise use ruby@3.4.2
166
+ gem install itsi
167
+ EOF
168
+
169
+ root_block_device {
170
+ encrypted = true
171
+ volume_type = "gp3"
172
+ volume_size = 12
173
+ tags = {
174
+ Name = "web-root-block-device-${var.environment}"
175
+ }
176
+ }
177
+
178
+ depends_on = [aws_route_table_association.public_1_rt_a]
179
+ }
180
+
181
+ locals {
182
+ role_policy_arns = [
183
+ "arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM",
184
+ "arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy"
185
+ ]
186
+ }
187
+
188
+ resource "aws_iam_instance_profile" "web" {
189
+ name = "EC2-Profile-${var.environment}"
190
+ role = aws_iam_role.web.name
191
+ }
192
+
193
+ resource "aws_iam_role_policy_attachment" "web" {
194
+ count = length(local.role_policy_arns)
195
+
196
+ role = aws_iam_role.web.name
197
+ policy_arn = element(local.role_policy_arns, count.index)
198
+ }
199
+
200
+ resource "aws_iam_role_policy" "web" {
201
+ name = "EC2-Inline-Policy-${var.environment}"
202
+ role = aws_iam_role.web.id
203
+ policy = jsonencode(
204
+ {
205
+ "Version" : "2012-10-17",
206
+ "Statement" : [
207
+ {
208
+ "Effect" : "Allow",
209
+ "Action" : [
210
+ "ssm:GetParameter"
211
+ ],
212
+ "Resource" : "*"
213
+ }
214
+ ]
215
+ }
216
+ )
217
+ }
218
+
219
+ resource "aws_iam_role" "web" {
220
+ name = "EC2-Role-${var.environment}"
221
+ path = "/"
222
+
223
+ assume_role_policy = jsonencode(
224
+ {
225
+ "Version" : "2012-10-17",
226
+ "Statement" : [
227
+ {
228
+ "Action" : "sts:AssumeRole",
229
+ "Principal" : {
230
+ "Service" : "ec2.amazonaws.com"
231
+ },
232
+ "Effect" : "Allow"
233
+ }
234
+ ]
235
+ }
236
+ )
237
+ }
@@ -0,0 +1,4 @@
1
+ output "ec2_public_ip" {
2
+ description = "Public IP of the EC2 instance"
3
+ value = aws_instance.web.public_ip
4
+ }
@@ -0,0 +1,11 @@
1
+ variable "aws_region" {
2
+ default = "ap-southeast-2"
3
+ }
4
+
5
+ variable "environment" {
6
+ default = "itsi-production"
7
+ }
8
+
9
+ variable "subnet_az" {
10
+ default = "ap-southeast-2a"
11
+ }
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'iodine'
4
+ gem 'unicorn'
5
+ gem 'puma'
6
+ gem 'passenger'
7
+ gem 'agoo'
8
+ gem 'falcon'
9
+ gem "itsi-server", path: "../../gems/server"
10
+ gem "itsi-scheduler", path: "../../gems/scheduler"
@@ -0,0 +1,140 @@
1
+ PATH
2
+ remote: ../../gems/scheduler
3
+ specs:
4
+ itsi-scheduler (0.1.0)
5
+ libclang (~> 14.0)
6
+ rb_sys (~> 0.9.91)
7
+
8
+ PATH
9
+ remote: ../../gems/server
10
+ specs:
11
+ itsi-server (0.1.1)
12
+ libclang (~> 14.0)
13
+ rack (~> 2.2)
14
+ rb_sys (~> 0.9.91)
15
+
16
+ GEM
17
+ remote: https://rubygems.org/
18
+ specs:
19
+ agoo (2.15.13)
20
+ async (2.23.1)
21
+ console (~> 1.29)
22
+ fiber-annotation
23
+ io-event (~> 1.9)
24
+ metrics (~> 0.12)
25
+ traces (~> 0.15)
26
+ async-container (0.24.0)
27
+ async (~> 2.22)
28
+ async-container-supervisor (0.5.1)
29
+ async-container (~> 0.22)
30
+ async-service
31
+ io-endpoint
32
+ memory-leak (~> 0.5)
33
+ async-http (0.87.0)
34
+ async (>= 2.10.2)
35
+ async-pool (~> 0.9)
36
+ io-endpoint (~> 0.14)
37
+ io-stream (~> 0.6)
38
+ metrics (~> 0.12)
39
+ protocol-http (~> 0.49)
40
+ protocol-http1 (~> 0.30)
41
+ protocol-http2 (~> 0.22)
42
+ traces (~> 0.10)
43
+ async-http-cache (0.4.5)
44
+ async-http (~> 0.56)
45
+ async-pool (0.10.3)
46
+ async (>= 1.25)
47
+ async-service (0.13.0)
48
+ async
49
+ async-container (~> 0.16)
50
+ console (1.30.2)
51
+ fiber-annotation
52
+ fiber-local (~> 1.1)
53
+ json
54
+ falcon (0.51.1)
55
+ async
56
+ async-container (~> 0.20)
57
+ async-container-supervisor (~> 0.5.0)
58
+ async-http (~> 0.75)
59
+ async-http-cache (~> 0.4)
60
+ async-service (~> 0.10)
61
+ bundler
62
+ localhost (~> 1.1)
63
+ openssl (~> 3.0)
64
+ protocol-http (~> 0.31)
65
+ protocol-rack (~> 0.7)
66
+ samovar (~> 2.3)
67
+ fiber-annotation (0.2.0)
68
+ fiber-local (1.1.0)
69
+ fiber-storage
70
+ fiber-storage (1.0.0)
71
+ io-endpoint (0.15.2)
72
+ io-event (1.10.0)
73
+ io-stream (0.6.1)
74
+ iodine (0.7.58)
75
+ json (2.10.2)
76
+ kgio (2.11.4)
77
+ libclang (14.0.6-aarch64-linux)
78
+ libclang (14.0.6-arm64-darwin)
79
+ libclang (14.0.6-x86_64-darwin)
80
+ libclang (14.0.6-x86_64-linux)
81
+ libclang (14.0.6-x86_64-linux-musl)
82
+ localhost (1.3.1)
83
+ mapping (1.1.1)
84
+ memory-leak (0.5.2)
85
+ metrics (0.12.2)
86
+ nio4r (2.7.4)
87
+ openssl (3.3.0)
88
+ passenger (6.0.23)
89
+ rack (>= 1.6.13)
90
+ rackup
91
+ rake (>= 12.3.3)
92
+ protocol-hpack (1.5.1)
93
+ protocol-http (0.49.0)
94
+ protocol-http1 (0.30.0)
95
+ protocol-http (~> 0.22)
96
+ protocol-http2 (0.22.1)
97
+ protocol-hpack (~> 1.4)
98
+ protocol-http (~> 0.47)
99
+ protocol-rack (0.11.2)
100
+ protocol-http (~> 0.43)
101
+ rack (>= 1.0)
102
+ puma (6.6.0)
103
+ nio4r (~> 2.0)
104
+ rack (2.2.13)
105
+ rackup (1.0.1)
106
+ rack (< 3)
107
+ webrick
108
+ raindrops (0.20.1)
109
+ rake (13.2.1)
110
+ rake-compiler-dock (1.9.1)
111
+ rb_sys (0.9.111)
112
+ rake-compiler-dock (= 1.9.1)
113
+ samovar (2.3.0)
114
+ console (~> 1.0)
115
+ mapping (~> 1.0)
116
+ traces (0.15.2)
117
+ unicorn (6.1.0)
118
+ kgio (~> 2.6)
119
+ raindrops (~> 0.7)
120
+ webrick (1.9.1)
121
+
122
+ PLATFORMS
123
+ aarch64-linux
124
+ arm64-darwin
125
+ x86_64-darwin
126
+ x86_64-linux
127
+ x86_64-linux-musl
128
+
129
+ DEPENDENCIES
130
+ agoo
131
+ falcon
132
+ iodine
133
+ itsi-scheduler!
134
+ itsi-server!
135
+ passenger
136
+ puma
137
+ unicorn
138
+
139
+ BUNDLED WITH
140
+ 2.6.3
@@ -0,0 +1,54 @@
1
+ require 'itsi/scheduler'
2
+ require 'itsi/server'
3
+
4
+ class Benchmark
5
+ def initialize(app)
6
+ @app = app
7
+ end
8
+
9
+ PATH_INFO = 'PATH_INFO'.freeze
10
+
11
+ SMALL = [200, {}, ["Hello World\n" * 10] * 10].freeze
12
+
13
+ def blocking(env)
14
+ Kernel::sleep(0.01)
15
+
16
+ SMALL
17
+ end
18
+
19
+ def nonblocking(env)
20
+ if defined? Async
21
+ Async::Task.current.sleep(0.01)
22
+ else
23
+ Kernel::sleep(0.01)
24
+ end
25
+
26
+ SMALL
27
+ end
28
+
29
+ def small(env)
30
+ SMALL
31
+ end
32
+
33
+ LARGE = [200, {}, ["Hello World\n" * 100] * 100].freeze
34
+
35
+ def large(env)
36
+ LARGE
37
+ end
38
+
39
+ def call(env)
40
+ _, name, *path = env[PATH_INFO].split("/")
41
+
42
+ method = name&.to_sym
43
+
44
+ if method and self.respond_to?(method)
45
+ self.send(method, env)
46
+ else
47
+ @app.call(env)
48
+ end
49
+ end
50
+ end
51
+
52
+ use Benchmark
53
+
54
+ run lambda {|env| [404, {}, ["Not Found"]]}
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # gem "rails"
6
+
7
+ # gem "async"
8
+ gem "debug"
9
+ gem "itsi-server", path: "../../gems/server"
10
+ gem "osprey_scheduler", path: "../../../osprey_scheduler"
@@ -0,0 +1,69 @@
1
+ PATH
2
+ remote: ../../../osprey_scheduler
3
+ specs:
4
+ osprey_scheduler (0.1.0)
5
+ async (= 2.21.1)
6
+ rb_sys (~> 0.9.91)
7
+
8
+ PATH
9
+ remote: ../../gems/server
10
+ specs:
11
+ itsi-server (0.1.1)
12
+ libclang (~> 14.0)
13
+ rack (~> 2.2)
14
+ rb_sys (~> 0.9.91)
15
+
16
+ GEM
17
+ remote: https://rubygems.org/
18
+ specs:
19
+ async (2.21.1)
20
+ console (~> 1.29)
21
+ fiber-annotation
22
+ io-event (~> 1.6, >= 1.6.5)
23
+ console (1.29.3)
24
+ fiber-annotation
25
+ fiber-local (~> 1.1)
26
+ json
27
+ date (3.4.1)
28
+ debug (1.10.0)
29
+ irb (~> 1.10)
30
+ reline (>= 0.3.8)
31
+ fiber-annotation (0.2.0)
32
+ fiber-local (1.1.0)
33
+ fiber-storage
34
+ fiber-storage (1.0.0)
35
+ io-console (0.8.0)
36
+ io-event (1.9.0)
37
+ irb (1.15.1)
38
+ pp (>= 0.6.0)
39
+ rdoc (>= 4.0.0)
40
+ reline (>= 0.4.2)
41
+ json (2.10.1)
42
+ libclang (14.0.6-arm64-darwin)
43
+ pp (0.6.2)
44
+ prettyprint
45
+ prettyprint (0.2.0)
46
+ psych (5.2.3)
47
+ date
48
+ stringio
49
+ rack (2.2.12)
50
+ rake-compiler-dock (1.9.1)
51
+ rb_sys (0.9.111)
52
+ rake-compiler-dock (= 1.9.1)
53
+ rdoc (6.12.0)
54
+ psych (>= 4.0.0)
55
+ reline (0.6.0)
56
+ io-console (~> 0.5)
57
+ stringio (3.1.5)
58
+
59
+ PLATFORMS
60
+ arm64-darwin-23
61
+ ruby
62
+
63
+ DEPENDENCIES
64
+ debug
65
+ itsi-server!
66
+ osprey_scheduler!
67
+
68
+ BUNDLED WITH
69
+ 2.6.3
@@ -0,0 +1,10 @@
1
+ require 'debug'
2
+ require "osprey/scheduler"
3
+
4
+ run lambda { |env|
5
+ # 5.times do |i|
6
+ # puts "#{i}"
7
+ # sleep 0.3
8
+ # end
9
+ [200, { 'Content-Type' => 'text/plain' }, ['foo']]
10
+ }
@@ -0,0 +1,2 @@
1
+ # This is checked into source control, so put sensitive values into `.env.local`
2
+ DATABASE_URL=sqlite://db/itsi_hanami.sqlite
@@ -0,0 +1,6 @@
1
+ .env*.local
2
+ log/*
3
+ public/
4
+ node_modules/
5
+ db/*.sqlite
6
+ spec/examples.txt
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "hanami", "~> 2.2"
6
+ gem "hanami-assets", "~> 2.2"
7
+ gem "hanami-controller", "~> 2.2"
8
+ gem "hanami-db", "~> 2.2"
9
+ gem "hanami-router", "~> 2.2"
10
+ gem "hanami-validations", "~> 2.2"
11
+ gem "hanami-view", "~> 2.2"
12
+
13
+ gem "dry-types", "~> 1.7"
14
+ gem "dry-operation"
15
+
16
+ gem "itsi-server", path: "../../gems/server"
17
+ gem "itsi-scheduler", path: "../../gems/scheduler"
18
+ gem 'falcon'
19
+ gem 'iodine'
20
+ gem 'puma'
21
+ gem 'unicorn'
22
+
23
+ gem "rake"
24
+ gem "sqlite3"
25
+
26
+ group :development do
27
+ gem "hanami-webconsole", "~> 2.2"
28
+ end
29
+
30
+ group :development, :test do
31
+ gem "dotenv"
32
+ end
33
+
34
+ group :cli, :development do
35
+ gem "hanami-reloader", "~> 2.2"
36
+ end
37
+
38
+ group :cli, :development, :test do
39
+ gem "hanami-rspec", "~> 2.2"
40
+ end
41
+
42
+ group :test do
43
+ # Database
44
+ gem "database_cleaner-sequel"
45
+
46
+ # Web integration
47
+ gem "capybara"
48
+ gem "rack-test"
49
+ end