├── .gitignore ├── Gemfile ├── Gemfile.lock ├── README.md ├── Rakefile ├── app ├── assets │ ├── config │ │ └── manifest.js │ ├── images │ │ └── .keep │ ├── javascripts │ │ ├── application.js │ │ ├── audio_to_json.coffee │ │ ├── cable.js │ │ ├── channels │ │ │ └── .keep │ │ └── jobstatuses.coffee │ └── stylesheets │ │ ├── application.css │ │ ├── audio_to_json.scss │ │ ├── jobstatuses.scss │ │ └── scaffolds.scss ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── controllers │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ └── deepspeech_controller.rb ├── helpers │ ├── application_helper.rb │ ├── audio_to_json_helper.rb │ └── jobstatuses_helper.rb ├── jobs │ └── application_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── application_record.rb │ ├── concerns │ │ └── .keep │ └── job_status.rb └── views │ └── layouts │ ├── application.html.erb │ ├── mailer.html.erb │ └── mailer.text.erb ├── bin ├── bundle ├── rails ├── rake ├── setup ├── spring ├── update └── yarn ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── credentials.yml.enc ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── application_controller_renderer.rb │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── content_security_policy.rb │ ├── cookies_serializer.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── redis.rb │ └── wrap_parameters.rb ├── locales │ └── en.yml ├── puma.rb ├── routes.rb ├── spring.rb └── storage.yml ├── db ├── migrate │ └── 20190911175040_create_job_statuses.rb ├── schema.rb └── seeds.rb ├── deepspeech-service.rb ├── deepspeech-worker.rb ├── development ├── .ruby-version ├── setup.sh ├── start-service.sh └── start-worker.sh ├── dump.rdb ├── example-credentials.yaml ├── lib ├── assets │ └── .keep ├── deepspeech.rb ├── deepspeech │ └── mozilla_deepspeech_worker.rb └── tasks │ └── .keep ├── log └── .keep ├── old_README.md ├── package.json ├── public ├── 404.html ├── 422.html ├── 500.html ├── apple-touch-icon-precomposed.png ├── apple-touch-icon.png ├── favicon.ico └── robots.txt ├── service ├── deepspeech_rails.service ├── deepspeech_service.service └── deepspeech_worker.service ├── settings.yaml ├── storage └── .keep ├── systemd └── ari-caddy.service ├── test ├── application_system_test_case.rb ├── controllers │ ├── .keep │ ├── audio_to_json_controller_test.rb │ └── jobstatuses_controller_test.rb ├── fixtures │ ├── .keep │ ├── files │ │ └── .keep │ ├── job_statuses.yml │ └── jobstatuses.yml ├── helpers │ └── .keep ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── job_status_test.rb │ └── jobstatus_test.rb ├── system │ ├── .keep │ └── jobstatuses_test.rb └── test_helper.rb ├── tmp └── .keep └── vendor └── .keep /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/* 16 | /tmp/* 17 | !/log/.keep 18 | !/tmp/.keep 19 | 20 | # Ignore uploaded files in development 21 | /storage/* 22 | !/storage/.keep 23 | 24 | /node_modules 25 | /yarn-error.log 26 | 27 | /public/assets 28 | .byebug_history 29 | 30 | # Ignore master key for decrypting credentials and more. 31 | /config/master.key 32 | credentials.yaml -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source 'https://rubygems.org' # source rubygems.org 4 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 5 | 6 | ruby '2.6.3' 7 | 8 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 9 | gem 'rails', '~> 5.2.3' 10 | # Use sqlite3 as the database for Active Record 11 | 12 | gem 'speech_to_text', '0.1.7' 13 | gem 'sqlite3' 14 | # Use Puma as the app server 15 | gem 'puma', '~> 3.12' 16 | # Use SCSS for stylesheets 17 | gem 'faktory_worker_ruby' 18 | gem 'redis', '4.1.2' 19 | gem 'redis-namespace' 20 | gem 'redis-rack-cache' 21 | gem 'redis-rails' 22 | gem 'sass-rails', '~> 5.0' 23 | # Use Uglifier as compressor for JavaScript assets 24 | gem 'uglifier', '>= 1.3.0' 25 | # See https://github.com/rails/execjs#readme for more supported runtimes 26 | # gem 'mini_racer', platforms: :ruby 27 | 28 | # Use CoffeeScript for .coffee assets and views 29 | gem 'coffee-rails', '~> 4.2' 30 | # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 31 | gem 'turbolinks', '~> 5' 32 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 33 | gem 'jbuilder', '~> 2.5' 34 | # Use Redis adapter to run Action Cable in production 35 | # gem 'redis', '~> 4.0' 36 | # Use ActiveModel has_secure_password 37 | # gem 'bcrypt', '~> 3.1.7' 38 | 39 | # Use ActiveStorage variant 40 | # gem 'mini_magick', '~> 4.8' 41 | # gem 'speech_to_text', :git => 'https://github.com/parthikmodi/speech_to_text.git' 42 | # Use Capistrano for deployment 43 | # gem 'capistrano-rails', group: :development 44 | 45 | # Reduces boot times through caching; required in config/boot.rb 46 | gem 'bootsnap', '>= 1.1.0', require: false 47 | 48 | group :development, :test do 49 | # Call 'byebug' anywhere in the code to stop execution and 50 | # get a debugger console 51 | gem 'byebug', platforms: %i[mri mingw x64_mingw] 52 | end 53 | 54 | group :development do 55 | # Access an interactive console on exception pages or 56 | # by calling 'console' anywhere in the code. 57 | gem 'listen', '>= 3.0.5', '< 3.2' 58 | gem 'web-console', '>= 3.3.0' 59 | # Spring speeds up development by 60 | # keeping your application running in the background. 61 | # Read more: https://github.com/rails/spring 62 | gem 'spring' 63 | gem 'spring-watcher-listen', '~> 2.0.0' 64 | end 65 | 66 | group :test do 67 | # Adds support for Capybara system testing and selenium driver 68 | gem 'capybara', '>= 2.15' 69 | gem 'selenium-webdriver' 70 | # Easy installation and use of chromedriver to run system tests with Chrome 71 | gem 'chromedriver-helper' 72 | end 73 | 74 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 75 | gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] 76 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actioncable (5.2.3) 5 | actionpack (= 5.2.3) 6 | nio4r (~> 2.0) 7 | websocket-driver (>= 0.6.1) 8 | actionmailer (5.2.3) 9 | actionpack (= 5.2.3) 10 | actionview (= 5.2.3) 11 | activejob (= 5.2.3) 12 | mail (~> 2.5, >= 2.5.4) 13 | rails-dom-testing (~> 2.0) 14 | actionpack (5.2.3) 15 | actionview (= 5.2.3) 16 | activesupport (= 5.2.3) 17 | rack (~> 2.0) 18 | rack-test (>= 0.6.3) 19 | rails-dom-testing (~> 2.0) 20 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 21 | actionview (5.2.3) 22 | activesupport (= 5.2.3) 23 | builder (~> 3.1) 24 | erubi (~> 1.4) 25 | rails-dom-testing (~> 2.0) 26 | rails-html-sanitizer (~> 1.0, >= 1.0.3) 27 | activejob (5.2.3) 28 | activesupport (= 5.2.3) 29 | globalid (>= 0.3.6) 30 | activemodel (5.2.3) 31 | activesupport (= 5.2.3) 32 | activerecord (5.2.3) 33 | activemodel (= 5.2.3) 34 | activesupport (= 5.2.3) 35 | arel (>= 9.0) 36 | activestorage (5.2.3) 37 | actionpack (= 5.2.3) 38 | activerecord (= 5.2.3) 39 | marcel (~> 0.3.1) 40 | activesupport (5.2.3) 41 | concurrent-ruby (~> 1.0, >= 1.0.2) 42 | i18n (>= 0.7, < 2) 43 | minitest (~> 5.1) 44 | tzinfo (~> 1.1) 45 | addressable (2.6.0) 46 | public_suffix (>= 2.0.2, < 4.0) 47 | archive-zip (0.12.0) 48 | io-like (~> 0.3.0) 49 | arel (9.0.0) 50 | bindex (0.8.1) 51 | bootsnap (1.4.4) 52 | msgpack (~> 1.0) 53 | builder (3.2.3) 54 | byebug (11.0.1) 55 | capybara (3.28.0) 56 | addressable 57 | mini_mime (>= 0.1.3) 58 | nokogiri (~> 1.8) 59 | rack (>= 1.6.0) 60 | rack-test (>= 0.6.3) 61 | regexp_parser (~> 1.5) 62 | xpath (~> 3.2) 63 | childprocess (1.0.1) 64 | rake (< 13.0) 65 | chromedriver-helper (2.1.1) 66 | archive-zip (~> 0.10) 67 | nokogiri (~> 1.8) 68 | coffee-rails (4.2.2) 69 | coffee-script (>= 2.2.0) 70 | railties (>= 4.0.0) 71 | coffee-script (2.4.1) 72 | coffee-script-source 73 | execjs 74 | coffee-script-source (1.12.2) 75 | concurrent-ruby (1.1.5) 76 | connection_pool (2.2.2) 77 | crass (1.0.5) 78 | declarative (0.0.10) 79 | declarative-option (0.1.0) 80 | digest-crc (0.4.1) 81 | domain_name (0.5.20190701) 82 | unf (>= 0.0.5, < 1.0.0) 83 | erubi (1.8.0) 84 | eventmachine (1.2.7) 85 | execjs (2.7.0) 86 | faktory_worker_ruby (0.8.1) 87 | connection_pool (~> 2.2, >= 2.2.1) 88 | faraday (0.17.3) 89 | multipart-post (>= 1.2, < 3) 90 | faye-websocket (0.10.9) 91 | eventmachine (>= 0.12.0) 92 | websocket-driver (>= 0.5.1) 93 | ffi (1.11.1) 94 | globalid (0.4.2) 95 | activesupport (>= 4.2.0) 96 | google-api-client (0.37.1) 97 | addressable (~> 2.5, >= 2.5.1) 98 | googleauth (~> 0.9) 99 | httpclient (>= 2.8.1, < 3.0) 100 | mini_mime (~> 1.0) 101 | representable (~> 3.0) 102 | retriable (>= 2.0, < 4.0) 103 | signet (~> 0.12) 104 | google-cloud-core (1.5.0) 105 | google-cloud-env (~> 1.0) 106 | google-cloud-errors (~> 1.0) 107 | google-cloud-env (1.3.0) 108 | faraday (~> 0.11) 109 | google-cloud-errors (1.0.0) 110 | google-cloud-speech (0.35.0) 111 | google-gax (~> 1.3) 112 | google-cloud-storage (1.18.2) 113 | addressable (~> 2.5) 114 | digest-crc (~> 0.4) 115 | google-api-client (~> 0.26) 116 | google-cloud-core (~> 1.2) 117 | googleauth (>= 0.6.2, < 0.10.0) 118 | mime-types (~> 3.0) 119 | google-gax (1.8.1) 120 | google-protobuf (~> 3.9) 121 | googleapis-common-protos (>= 1.3.9, < 2.0) 122 | googleauth (~> 0.9) 123 | grpc (~> 1.24) 124 | rly (~> 0.2.3) 125 | google-protobuf (3.11.4) 126 | googleapis-common-protos (1.3.9) 127 | google-protobuf (~> 3.0) 128 | googleapis-common-protos-types (~> 1.0) 129 | grpc (~> 1.0) 130 | googleapis-common-protos-types (1.0.4) 131 | google-protobuf (~> 3.0) 132 | googleauth (0.9.0) 133 | faraday (~> 0.12) 134 | jwt (>= 1.4, < 3.0) 135 | memoist (~> 0.16) 136 | multi_json (~> 1.11) 137 | os (>= 0.9, < 2.0) 138 | signet (~> 0.7) 139 | grpc (1.27.0) 140 | google-protobuf (~> 3.11) 141 | googleapis-common-protos-types (~> 1.0) 142 | http (4.1.1) 143 | addressable (~> 2.3) 144 | http-cookie (~> 1.0) 145 | http-form_data (~> 2.0) 146 | http_parser.rb (~> 0.6.0) 147 | http-cookie (1.0.3) 148 | domain_name (~> 0.5) 149 | http-form_data (2.2.0) 150 | http_parser.rb (0.6.0) 151 | httpclient (2.8.3) 152 | i18n (1.6.0) 153 | concurrent-ruby (~> 1.0) 154 | ibm_cloud_sdk_core (0.3.3) 155 | concurrent-ruby (~> 1.0) 156 | http (~> 4.1.0) 157 | jwt (~> 2.2.1) 158 | ibm_watson (0.18.2) 159 | concurrent-ruby (~> 1.0) 160 | eventmachine (~> 1.2) 161 | faye-websocket (~> 0.10) 162 | http (~> 4.1.0) 163 | ibm_cloud_sdk_core (~> 0.3.1) 164 | jwt (~> 2.2.1) 165 | io-like (0.3.0) 166 | jbuilder (2.9.1) 167 | activesupport (>= 4.2.0) 168 | jwt (2.2.1) 169 | listen (3.1.5) 170 | rb-fsevent (~> 0.9, >= 0.9.4) 171 | rb-inotify (~> 0.9, >= 0.9.7) 172 | ruby_dep (~> 1.2) 173 | loofah (2.3.1) 174 | crass (~> 1.0.2) 175 | nokogiri (>= 1.5.9) 176 | mail (2.7.1) 177 | mini_mime (>= 0.1.1) 178 | marcel (0.3.3) 179 | mimemagic (~> 0.3.2) 180 | memoist (0.16.2) 181 | method_source (0.9.2) 182 | mime-types (3.3.1) 183 | mime-types-data (~> 3.2015) 184 | mime-types-data (3.2019.1009) 185 | mimemagic (0.3.3) 186 | mini_mime (1.0.2) 187 | mini_portile2 (2.4.0) 188 | minitest (5.11.3) 189 | msgpack (1.3.1) 190 | multi_json (1.14.1) 191 | multipart-post (2.1.1) 192 | nio4r (2.4.0) 193 | nokogiri (1.10.5) 194 | mini_portile2 (~> 2.4.0) 195 | os (1.0.1) 196 | public_suffix (3.1.1) 197 | puma (3.12.3) 198 | rack (2.1.2) 199 | rack-cache (1.9.0) 200 | rack (>= 0.4) 201 | rack-test (1.1.0) 202 | rack (>= 1.0, < 3) 203 | rails (5.2.3) 204 | actioncable (= 5.2.3) 205 | actionmailer (= 5.2.3) 206 | actionpack (= 5.2.3) 207 | actionview (= 5.2.3) 208 | activejob (= 5.2.3) 209 | activemodel (= 5.2.3) 210 | activerecord (= 5.2.3) 211 | activestorage (= 5.2.3) 212 | activesupport (= 5.2.3) 213 | bundler (>= 1.3.0) 214 | railties (= 5.2.3) 215 | sprockets-rails (>= 2.0.0) 216 | rails-dom-testing (2.0.3) 217 | activesupport (>= 4.2.0) 218 | nokogiri (>= 1.6) 219 | rails-html-sanitizer (1.2.0) 220 | loofah (~> 2.2, >= 2.2.2) 221 | railties (5.2.3) 222 | actionpack (= 5.2.3) 223 | activesupport (= 5.2.3) 224 | method_source 225 | rake (>= 0.8.7) 226 | thor (>= 0.19.0, < 2.0) 227 | rake (12.3.3) 228 | rb-fsevent (0.10.3) 229 | rb-inotify (0.10.0) 230 | ffi (~> 1.0) 231 | redis (4.1.2) 232 | redis-actionpack (5.1.0) 233 | actionpack (>= 4.0, < 7) 234 | redis-rack (>= 1, < 3) 235 | redis-store (>= 1.1.0, < 2) 236 | redis-activesupport (5.2.0) 237 | activesupport (>= 3, < 7) 238 | redis-store (>= 1.3, < 2) 239 | redis-namespace (1.6.0) 240 | redis (>= 3.0.4) 241 | redis-rack (2.0.5) 242 | rack (>= 1.5, < 3) 243 | redis-store (>= 1.2, < 2) 244 | redis-rack-cache (2.1.0) 245 | rack-cache (>= 1.6, < 2) 246 | redis-store (>= 1.6, < 2) 247 | redis-rails (5.0.2) 248 | redis-actionpack (>= 5.0, < 6) 249 | redis-activesupport (>= 5.0, < 6) 250 | redis-store (>= 1.2, < 2) 251 | redis-store (1.6.0) 252 | redis (>= 2.2, < 5) 253 | regexp_parser (1.6.0) 254 | representable (3.0.4) 255 | declarative (< 0.1.0) 256 | declarative-option (< 0.2.0) 257 | uber (< 0.2.0) 258 | retriable (3.1.2) 259 | rly (0.2.3) 260 | ruby_dep (1.5.0) 261 | rubyzip (1.3.0) 262 | sass (3.7.4) 263 | sass-listen (~> 4.0.0) 264 | sass-listen (4.0.0) 265 | rb-fsevent (~> 0.9, >= 0.9.4) 266 | rb-inotify (~> 0.9, >= 0.9.7) 267 | sass-rails (5.1.0) 268 | railties (>= 5.2.0) 269 | sass (~> 3.1) 270 | sprockets (>= 2.8, < 4.0) 271 | sprockets-rails (>= 2.0, < 4.0) 272 | tilt (>= 1.1, < 3) 273 | selenium-webdriver (3.142.3) 274 | childprocess (>= 0.5, < 2.0) 275 | rubyzip (~> 1.2, >= 1.2.2) 276 | signet (0.13.0) 277 | addressable (~> 2.3) 278 | faraday (>= 0.17.3, < 2.0) 279 | jwt (>= 1.5, < 3.0) 280 | multi_json (~> 1.10) 281 | speech_to_text (0.1.7) 282 | google-cloud-speech (= 0.35.0) 283 | google-cloud-storage (= 1.18.2) 284 | ibm_watson (~> 0.18.2) 285 | spring (2.1.0) 286 | spring-watcher-listen (2.0.1) 287 | listen (>= 2.7, < 4.0) 288 | spring (>= 1.2, < 3.0) 289 | sprockets (3.7.2) 290 | concurrent-ruby (~> 1.0) 291 | rack (> 1, < 3) 292 | sprockets-rails (3.2.1) 293 | actionpack (>= 4.0) 294 | activesupport (>= 4.0) 295 | sprockets (>= 3.0.0) 296 | sqlite3 (1.4.1) 297 | thor (0.20.3) 298 | thread_safe (0.3.6) 299 | tilt (2.0.9) 300 | turbolinks (5.2.0) 301 | turbolinks-source (~> 5.2) 302 | turbolinks-source (5.2.0) 303 | tzinfo (1.2.5) 304 | thread_safe (~> 0.1) 305 | uber (0.1.0) 306 | uglifier (4.1.20) 307 | execjs (>= 0.3.0, < 3) 308 | unf (0.1.4) 309 | unf_ext 310 | unf_ext (0.0.7.6) 311 | web-console (3.7.0) 312 | actionview (>= 5.0) 313 | activemodel (>= 5.0) 314 | bindex (>= 0.4.0) 315 | railties (>= 5.0) 316 | websocket-driver (0.7.1) 317 | websocket-extensions (>= 0.1.0) 318 | websocket-extensions (0.1.4) 319 | xpath (3.2.0) 320 | nokogiri (~> 1.8) 321 | 322 | PLATFORMS 323 | ruby 324 | 325 | DEPENDENCIES 326 | bootsnap (>= 1.1.0) 327 | byebug 328 | capybara (>= 2.15) 329 | chromedriver-helper 330 | coffee-rails (~> 4.2) 331 | faktory_worker_ruby 332 | jbuilder (~> 2.5) 333 | listen (>= 3.0.5, < 3.2) 334 | puma (~> 3.12) 335 | rails (~> 5.2.3) 336 | redis (= 4.1.2) 337 | redis-namespace 338 | redis-rack-cache 339 | redis-rails 340 | sass-rails (~> 5.0) 341 | selenium-webdriver 342 | speech_to_text (= 0.1.7) 343 | spring 344 | spring-watcher-listen (~> 2.0.0) 345 | sqlite3 346 | turbolinks (~> 5) 347 | tzinfo-data 348 | uglifier (>= 1.3.0) 349 | web-console (>= 3.3.0) 350 | 351 | RUBY VERSION 352 | ruby 2.6.3p62 353 | 354 | BUNDLED WITH 355 | 2.0.2 356 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Create Sudo user 2 | STEP 1. ssh into your server. 3 | ``` 4 | ssh root@ 5 | ``` 6 | 7 | STEP 2. Use the adduser command to add a new user to your system and set the password for the user 8 | ``` 9 | adduser texttrack 10 | ``` 11 | 12 | STEP 3. Use the usermod command to add the user to the sudo group. 13 | ``` 14 | usermod -aG sudo texttrack 15 | ``` 16 | 17 | STEP 4. Test sudo access on new user account. Use the su command to switch to the new user account. 18 | ``` 19 | su texttrack or su - texttrack 20 | ``` 21 | Then execute any command with sudo to test the user. 22 | ``` 23 | sudo mkdir abc 24 | ``` 25 | # Installing Ruby 26 | Make sure you are logged in with new sudo user (not as root user) 27 | 28 | Adding Node.js 10 repository 29 | ``` 30 | curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - 31 | ``` 32 | 33 | Adding Yarn repository 34 | ``` 35 | curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - 36 | echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 37 | sudo add-apt-repository ppa:chris-lea/redis-server 38 | ``` 39 | Refresh packege 40 | ``` 41 | sudo apt-get update 42 | ``` 43 | Install our dependencies for compiiling Ruby along with Node.js and Yarn 44 | ``` 45 | sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev dirmngr gnupg apt-transport-https ca-certificates redis-server redis-tools nodejs yarn 46 | ``` 47 | 48 | # Install Rbenv 49 | ``` 50 | git clone https://github.com/rbenv/rbenv.git ~/.rbenv 51 | echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc 52 | echo 'eval "$(rbenv init -)"' >> ~/.bashrc 53 | git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build 54 | echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc 55 | git clone https://github.com/rbenv/rbenv-vars.git ~/.rbenv/plugins/rbenv-vars 56 | exec $SHELL 57 | rbenv install 2.6.3 58 | sudo chown -R texttrack.texttrack ~/.rbenv 59 | rbenv global 2.6.3 60 | ruby -v 61 | #ruby 2.6.3 62 | ``` 63 | 64 | This installs the latest Bundler, currently 2.x. 65 | ``` 66 | gem install bundler 67 | ``` 68 | 69 | For older apps that require Bundler 1.x, you can install it as well. 70 | ``` 71 | gem install bundler -v 1.17.3 72 | ``` 73 | 74 | Test and make sure bundler is installed correctly, you should see a version number. 75 | ``` 76 | bundle -v 77 | #Bundler version 2.0 78 | ``` 79 | 80 | Install rails 81 | ``` 82 | gem install rails 83 | ``` 84 | 85 | # Some errors and solutions. 86 | for example, 87 | Rails application : deepspeech-web (rails root dir) 88 | sudo user : texttrack 89 | 90 | ``` 91 | Error: if you get error related .ruby-version file 92 | solution: delete .ruby-version file from your rails application root directory 93 | 94 | Error: Your Ruby version is 2.6.3, but your Gemfile specified 2.6.1 95 | solution: open your Gemfile and change the Gemfile version to 2.6.3 96 | 97 | Error: There was an error while trying to write to `/deepspeech-web/Gemfile.lock`. It is likely that you need to grant write permissions for that path. 98 | 99 | solution 100 | sudo chown -R : path-to-rails_root 101 | 102 | Example: 103 | sudo chown -R texttrack:texttrack /usr/local/deepspeech-web 104 | ``` 105 | 106 | # Running Rails Application 107 | Go to rails root directory and execute following commands 108 | 109 | Install dependencies 110 | ``` 111 | bundle install 112 | ``` 113 | 114 | Execute migration to create database 115 | ``` 116 | rake db:migrate 117 | ``` 118 | 119 | # Security 120 | ** Create credentials and add apikey 121 | ``` 122 | touch credentials.yaml 123 | 124 | * you can generate your own apikey. You don't need to go anywhere to get apikey. 125 | sudo nano credentials.yaml (refer example-credentails.yaml in the working dir) 126 | 127 | ``` 128 | 129 | You can use port_number = 3000 or 4000 130 | 131 | # Install Mozilla deepspeech 132 | 1. Install dependencies 133 | ``` 134 | sudo apt-get install build-essential 135 | sudo apt-get install aptitude 136 | sudo apt-get install libstdc++6 137 | sudo apt-get install libsox-dev 138 | cd /usr/lib/x86_64-linux-gnu 139 | sudo ln -s libsox.so.3 libsox.so.2 140 | export PATH="$PATH:/usr/lib/x86_64-linux-gnu" 141 | ``` 142 | 143 | 2. Install Python 144 | ``` 145 | sudo apt-get install python3-dev 146 | 147 | #other dependencies 148 | sudo apt-get install pkg-config zip g++ zlib1g-dev unzip wget 149 | export PYTHON_INCLUDE_PATH="/usr/include/python3.6m" 150 | export PYTHON_BIN_PATH="/usr/bin/python3.6" 151 | ``` 152 | 153 | 3. Install Bazel and update PATH variable 154 | 3.1 Download Bazel 0.15 compatible to tensorflow 1.12.0 155 | 156 | Create installation dir called deepspeech 157 | ``` 158 | sudo mkdir deepspeech 159 | cd deepspeech 160 | sudo mkdir temp 161 | sudo apt-get install wget 162 | sudo wget https://github.com/bazelbuild/bazel/releases/download/0.15.0/bazel-0.15.0-installer-linux-x86_64.sh 163 | ``` 164 | 165 | 3.2 Run the Bazel installer 166 | ``` 167 | sudo chmod +x bazel-0.15.0-installer-linux-x86_64.sh 168 | sudo ./bazel-0.15.0-installer-linux-x86_64.sh –-user --bin=$HOME/bin 169 | 170 | #if you get an error in above command then remove user flag 171 | $user/deepspeech: sudo ./bazel-0.15.0-installer-linux-x86_64.sh 172 | $user/deepspeech: export PATH="$PATH:/home//bin" 173 | #you will get path after successfully executing command 174 | #for example: make sure you have /home/user/bin dir in your system 175 | #The --user flag installs Bazel to the $HOME/bin directory on your system and sets the .bazelrc path to $HOME/.bazelrc. 176 | ``` 177 | 178 | 3.3 Set up your environment 179 | ``` 180 | export PATH="$PATH:$HOME/bin" 181 | ``` 182 | 183 | 4. Build deepspeech native 184 | 4.1 DeepSpeech clone and checkout 185 | ``` 186 | sudo apt-get install git 187 | sudo git clone https://github.com/dabinat/DeepSpeech.git 188 | cd DeepSpeech/ 189 | sudo git checkout timing-info 190 | cd .. 191 | ``` 192 | 193 | 4.2 Tensorflow clone and checkout 194 | ``` 195 | sudo git clone https://github.com/mozilla/tensorflow.git 196 | cd tensorflow/ 197 | sudo git checkout origin/r1.12 198 | ``` 199 | 4.3 create a symbolic link to the DeepSpeech native_client directory. 200 | ``` 201 | sudo ln -s ../DeepSpeech/native_client ./ 202 | ``` 203 | 204 | 5. Build DeepSpeech 205 | 5.1 make sure you have a python 206 | ``` 207 | sudo apt-get install python 208 | ``` 209 | 210 | 5.2 execute build command and have a cup of tea because usually it takes 20-25 mins to build. However, time is depending on server configurations 211 | ``` 212 | sudo bazel build --config=monolithic -c opt --copt=-O3 --copt="-D_GLIBCXX_USE_CXX11_ABI=0" --copt=-fvisibility=hidden //native_client:libdeepspeech.so //native_client:generate_trie 213 | ``` 214 | 215 | 5.3 set environment variable 216 | ``` 217 | export TFDIR=~/workspace/tensorflow 218 | ``` 219 | 220 | 5.4 make sure you have deepspeech file in your DeepSpeech dir and tensaflow dir. If file exist in both dir then execute following command. 221 | ``` 222 | cd ../DeepSpeech/native_client 223 | make deepspeech 224 | ``` 225 | 226 | 6. Copy binaries into deepspeech/temp folder 227 | ``` 228 | cp deepspeech ~/deepspeech/temp/deepspeech 229 | cp ~/deepspeech/tensorflow/bazel-bin/native_client/libdeepspeech.so ~/deepspeech/temp/libdeepspeech.so 230 | cd ~/deepspeech/temp 231 | ``` 232 | 233 | 7. Download model and audio files 234 | ``` 235 | sudo curl -LO https://github.com/mozilla/DeepSpeech/releases/download/v0.6.1/deepspeech-0.6.1-models.tar.gz 236 | sudo tar xvf deepspeech-0.6.1-models.tar.gz 237 | sudo curl -LO https://github.com/mozilla/DeepSpeech/releases/download/v0.6.1/audio-0.6.1.tar.gz 238 | sudo tar xvf audio-0.6.1.tar.gz 239 | ``` 240 | 241 | 8. If you want to update the deepspeech version in future (depending on if you want to use the gpu or not - only install 1 `both pip & pip3`) 242 | ``` 243 | pip install deepspeech==0.6.1 244 | pip3 install deepspeech==0.6.1 245 | 246 | pip install deepspeech-gpu==0.6.1 247 | pip3 install deepspeech-gpu==0.6.1 248 | ``` 249 | 250 | Now we need to replace our old deepspeech with the new one in `home/deepspeech/temp` 251 | ``` 252 | cd /home/deepspeech/temp 253 | sudo mv deepspeech deepspeech_old 254 | which deepspeech 255 | ``` 256 | which deepspeech will give you the link to where the new one is located (now to copy that to `/home/deepspeech/temp`) 257 | ``` 258 | sudo cp /home/texttrack/.local/bin/deepspeech /home/deepspeech/temp 259 | ``` 260 | 261 | 9. Check if deepspeech native is working 262 | ``` 263 | cd /home/deepspeech/temp 264 | ./deepspeech --model deepspeech-0.6.1-models/output_graph.pbmm --lm deepspeech-0.6.1-models/lm.binary --trie deepspeech-0.6.1-models/trie --audio audio/2830-3980-0043.wav 265 | 266 | * if you have installed models on the different path then you need to update the setting.yaml file 267 | ``` 268 | 269 | At this point, you should get words for sample audios inside the temp/audio directory. 270 | # Redis server 271 | ``` 272 | sudo apt-get update 273 | sudo apt-get upgrade 274 | ``` 275 | 276 | 1. Install & enable Redis server 277 | ``` 278 | sudo apt-get install redis-server 279 | sudo systemctl enable redis-server.service 280 | ``` 281 | 282 | 2. Configure redis server 283 | ``` 284 | sudo vim /etc/redis/redis.conf 285 | #you can use nano instead of vim 286 | #copy following lines or find and remove comments for these lines 287 | maxmemory 256mb 288 | maxmemory-policy allkeys-lru 289 | #save and exit 290 | ``` 291 | 292 | 3. Restart service 293 | ``` 294 | sudo systemctl restart redis-server.service 295 | ``` 296 | 297 | 4. Install redis php extension 298 | ``` 299 | sudo apt-get install php-redis 300 | ``` 301 | 302 | 5. Test the connection 303 | ``` 304 | redis-cli ping 305 | #you should get response "PONG" 306 | ``` 307 | 308 | 6. Important commands 309 | ``` 310 | #restart redis server 311 | sudo systemctl restart redis 312 | #redis-cli commands 313 | redis-cli info 314 | redis-cli stats 315 | redis-cli server 316 | ``` 317 | 318 | # Install faktory worker 319 | ``` 320 | sudo wget https://github.com/contribsys/faktory/releases/download/v1.0.1-1/faktory_1.0.1-1_amd64.deb 321 | 322 | sudo dpkg -i faktory_1.0.1-1_amd64.deb 323 | 324 | sudo cat /etc/faktory/password (Manually find password if ever needed) 325 | ``` 326 | 327 | # Set password for worker and Service 328 | 329 | Find password 330 | ``` 331 | cat /etc/faktory/password 332 | ``` 333 | # Set password 334 | Open working_dir/service/deepspeech_worker.service and find this line given below. 335 | `Environment=LANG=en_US.UTF-8 FAKTORY_PROVIDER=FAKTORY_URL FAKTORY_URL=tcp://:@localhost:7419` 336 | Replace your pasword with . save & exit 337 | Do the same thing for `working_dir/service/deepspeech_service.service` 338 | 339 | 340 | # Copy /usr/local/deepspeech-web/service/.service to /etc/systemd/system 341 | ``` 342 | cd /usr/local/deepspeech-web/service/ 343 | sudo cp *.service /etc/systemd/system 344 | ``` 345 | 346 | # Start all services 347 | ``` 348 | sudo systemctl enable deepspeech_rails 349 | sudo systemctl start deepspeech_rails 350 | 351 | sudo systemctl enable deepspeech_service 352 | sudo systemctl start deepspeech_service 353 | 354 | sudo systemctl enable deepspeech_worker 355 | sudo systemctl start deepspeech_worker 356 | ``` 357 | 358 | # Restart/stop services 359 | ``` 360 | sudo systemctl restart service-name 361 | sudo systemctl stop service-name 362 | ``` 363 | 364 | # Check status 365 | ``` 366 | sudo systemctl status service-name 367 | ``` 368 | 369 | # Edit service 370 | ``` 371 | sudo systemctl edit service-name --full 372 | sudo systemctl daemon-reload (After editing) 373 | sudo journalctl -u service-name.service 374 | ``` 375 | 376 | # Check logs 377 | ``` 378 | sudo journalctl -u service-name.service 379 | ``` 380 | 381 | # Clear logs 382 | ``` 383 | sudo journalctl --rotate 384 | sudo journalctl --vacuum-time=1s 385 | ``` 386 | 387 | # Keep your code clean with Rubocop 388 | 1. Install rubocop 389 | ``` 390 | gem install rubocop 391 | ``` 392 | 2. Run rubocop to find coding offences 393 | ``` 394 | cd 395 | rubocop 396 | ``` 397 | 3. Safe auto corrections 398 | ``` 399 | rubocop --safe-auto-correct --disable-uncorrectable 400 | ``` 401 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Add your own tasks in files placed in lib/tasks ending in .rake, 4 | # for example lib/tasks/capistrano.rake, 5 | # and they will automatically be available to Rake. 6 | 7 | require_relative 'config/application' 8 | 9 | Rails.application.load_tasks 10 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../javascripts .js 3 | //= link_directory ../stylesheets .css 4 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's 5 | // vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. JavaScript code in this file should be added after the last require_* statement. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require rails-ujs 14 | //= require activestorage 15 | //= require turbolinks 16 | //= require_tree . 17 | -------------------------------------------------------------------------------- /app/assets/javascripts/audio_to_json.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/cable.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the `rails generate channel` command. 3 | // 4 | //= require action_cable 5 | //= require_self 6 | //= require_tree ./channels 7 | 8 | (function() { 9 | this.App || (this.App = {}); 10 | 11 | App.cable = ActionCable.createConsumer(); 12 | 13 | }).call(this); 14 | -------------------------------------------------------------------------------- /app/assets/javascripts/channels/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/app/assets/javascripts/channels/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/jobstatuses.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's 6 | * vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /app/assets/stylesheets/audio_to_json.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the audio_to_json controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/jobstatuses.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Jobstatuses controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/scaffolds.scss: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fff; 3 | color: #333; 4 | margin: 33px; 5 | font-family: verdana, arial, helvetica, sans-serif; 6 | font-size: 13px; 7 | line-height: 18px; 8 | } 9 | 10 | p, ol, ul, td { 11 | font-family: verdana, arial, helvetica, sans-serif; 12 | font-size: 13px; 13 | line-height: 18px; 14 | } 15 | 16 | pre { 17 | background-color: #eee; 18 | padding: 10px; 19 | font-size: 11px; 20 | } 21 | 22 | a { 23 | color: #000; 24 | 25 | &:visited { 26 | color: #666; 27 | } 28 | 29 | &:hover { 30 | color: #fff; 31 | background-color: #000; 32 | } 33 | } 34 | 35 | th { 36 | padding-bottom: 5px; 37 | } 38 | 39 | td { 40 | padding: 0 5px 7px; 41 | } 42 | 43 | div { 44 | &.field, &.actions { 45 | margin-bottom: 10px; 46 | } 47 | } 48 | 49 | #notice { 50 | color: green; 51 | } 52 | 53 | .field_with_errors { 54 | padding: 2px; 55 | background-color: red; 56 | display: table; 57 | } 58 | 59 | #error_explanation { 60 | width: 450px; 61 | border: 2px solid red; 62 | padding: 7px 7px 0; 63 | margin-bottom: 20px; 64 | background-color: #f0f0f0; 65 | 66 | h2 { 67 | text-align: left; 68 | font-weight: bold; 69 | padding: 5px 5px 5px 15px; 70 | font-size: 12px; 71 | margin: -7px -7px 0; 72 | background-color: #c00; 73 | color: #fff; 74 | } 75 | 76 | ul li { 77 | font-size: 12px; 78 | list-style: square; 79 | } 80 | } 81 | 82 | label { 83 | display: block; 84 | } 85 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationCable 4 | class Channel < ActionCable::Channel::Base 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationCable 4 | class Connection < ActionCable::Connection::Base 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | # rubocop:disable Style/Documentation 2 | # frozen_string_literal: true 3 | 4 | class ApplicationController < ActionController::Base 5 | protect_from_forgery with: :null_session 6 | end 7 | # rubocop:enable Style/Documentation 8 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/deepspeech_controller.rb: -------------------------------------------------------------------------------- 1 | # rubocop:disable Style/Documentation 2 | # frozen_string_literal: true 3 | class DeepspeechController < ApplicationController 4 | protect_from_forgery with: :null_session 5 | skip_before_action :verify_authenticity_token 6 | 7 | def home 8 | data = { message: 'hello' } 9 | # rubocop:disable Style/GlobalVars 10 | $redis.lpush('create_job', data.to_json) 11 | # rubocop:enable Style/GlobalVars 12 | end 13 | 14 | def create_job # rubocop:disable Metrics/MethodLength 15 | props = YAML.load_file('credentials.yaml') 16 | api_key = props['api_key'] 17 | param_key = params[:api_key] 18 | 19 | if api_key == param_key 20 | audio = params[:file] 21 | 22 | if audio.nil? 23 | data = '{"message" : "file not found"}' 24 | render json: data 25 | return 26 | end 27 | job_id = generate_job_id 28 | File.open("#{Rails.root}/storage/#{job_id}/audio.wav", 'wb') do |file| 29 | file.write audio.read 30 | end 31 | set_status(job_id) 32 | data = { 'job_id' => job_id } 33 | render json: data 34 | # rubocop:disable Style/GlobalVars 35 | $redis.lpush('transcript', data.to_json) 36 | # rubocop:enable Style/GlobalVars 37 | else 38 | data = '{"message" : "incorrect api_key"}' 39 | render json: data 40 | end 41 | end 42 | 43 | def check_status # rubocop:disable Metrics/MethodLength 44 | props = YAML.load_file('credentials.yaml') 45 | api_key = props['api_key'] 46 | param_key = params[:api_key] 47 | 48 | if api_key == param_key 49 | job_id = params[:job_id] 50 | if job_id.nil? 51 | data = '{"message" : "job_id not found"}' 52 | render json: data 53 | return 54 | end 55 | job = JobStatus.find_by(job_id: job_id) 56 | if job.nil? 57 | data = '{"message" : "No job found"}' 58 | render json: data 59 | return 60 | end 61 | data = "{\"status\" : \"#{job.status}\"}" 62 | render json: data 63 | else 64 | data = '{"message" : "incorrect api_key"}' 65 | render json: data 66 | end 67 | end 68 | 69 | def transcript # rubocop:disable Metrics/MethodLength 70 | props = YAML.load_file('credentials.yaml') 71 | api_key = props['api_key'] 72 | param_key = params[:api_key] 73 | 74 | if api_key == param_key 75 | job_id = params[:job_id] 76 | if job_id.nil? 77 | data = '{"message" : "job_id is nil"}' 78 | render json: data 79 | return 80 | end 81 | data = '{"message" : "File not found. Please check job_id and status"}' 82 | if File.exist?("#{Rails.root}/storage/#{job_id}/audio.json") 83 | file = File.open("#{Rails.root}/storage/#{job_id}/audio.json") 84 | data = JSON.load file 85 | end 86 | render json: data 87 | 88 | if Dir.exist?("#{Rails.root}/storage/#{job_id}") 89 | system("rm -r #{Rails.root}/storage/#{job_id}") 90 | end 91 | else 92 | data = '{"message" : "incorrect api_key"}' 93 | render json: data 94 | end 95 | end 96 | 97 | private 98 | 99 | def generate_job_id 100 | job_id = SecureRandom.hex(10) 101 | time = (Time.now.to_f * 1000).to_i 102 | job_id += "_#{time}" 103 | Dir.chdir "#{Rails.root}/storage" 104 | system("mkdir #{job_id}") 105 | Dir.chdir Rails.root.to_s 106 | job_id 107 | end 108 | 109 | def set_status(job_id) # rubocop:disable Naming/AccessorMethodName 110 | job = JobStatus.new 111 | job.job_id = job_id 112 | job.status = 'pending' 113 | job.created_at = Time.now 114 | job.updated_at = Time.now 115 | job.save 116 | end 117 | end 118 | # rubocop:enable Style/Documentation 119 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationHelper # rubocop:disable Style/Documentation 4 | end 5 | -------------------------------------------------------------------------------- /app/helpers/audio_to_json_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module AudioToJsonHelper # rubocop:disable Style/Documentation 4 | end 5 | -------------------------------------------------------------------------------- /app/helpers/jobstatuses_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module JobstatusesHelper # rubocop:disable Style/Documentation 4 | end 5 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationJob < ActiveJob::Base 4 | end 5 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | # rubocop:disable Style/Documentation 2 | # frozen_string_literal: true 3 | 4 | class ApplicationMailer < ActionMailer::Base 5 | default from: 'from@example.com' 6 | layout 'mailer' 7 | end 8 | # rubocop:enable Style/Documentation 9 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | # rubocop:disable Style/Documentation 2 | # frozen_string_literal: true 3 | 4 | class ApplicationRecord < ActiveRecord::Base 5 | self.abstract_class = true 6 | end 7 | # rubocop:enable Style/Documentation 8 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/job_status.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class JobStatus < ApplicationRecord 4 | end 5 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DeepspeechServer 5 | <%= csrf_meta_tags %> 6 | <%= csp_meta_tag %> 7 | 8 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 9 | <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 10 | 11 | 12 | 13 | <%= yield %> 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 5 | load Gem.bin_path('bundler', 'bundle') 6 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | begin 5 | load File.expand_path('spring', __dir__) 6 | rescue LoadError => e 7 | raise unless e.message.include?('spring') 8 | end 9 | APP_PATH = File.expand_path('../config/application', __dir__) 10 | require_relative '../config/boot' 11 | require 'rails/commands' 12 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | begin 5 | load File.expand_path('spring', __dir__) 6 | rescue LoadError => e 7 | raise unless e.message.include?('spring') 8 | end 9 | require_relative '../config/boot' 10 | require 'rake' 11 | Rake.application.run 12 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | require 'fileutils' 5 | include FileUtils # rubocop:disable Style/MixinUsage 6 | 7 | # path to your application root. 8 | APP_ROOT = File.expand_path('..', __dir__) 9 | 10 | def system!(*args) 11 | system(*args) || abort("\n== Command #{args} failed ==") 12 | end 13 | 14 | chdir APP_ROOT do 15 | # This script is a starting point to setup your application. 16 | # Add necessary setup steps to this file. 17 | 18 | puts '== Installing dependencies ==' 19 | system! 'gem install bundler --conservative' 20 | system('bundle check') || system!('bundle install') 21 | 22 | # Install JavaScript dependencies if using Yarn 23 | # system('bin/yarn') 24 | 25 | # puts "\n== Copying sample files ==" 26 | # unless File.exist?('config/database.yml') 27 | # cp 'config/database.yml.sample', 'config/database.yml' 28 | # end 29 | 30 | puts "\n== Preparing database ==" 31 | system! 'bin/rails db:setup' 32 | 33 | puts "\n== Removing old logs and tempfiles ==" 34 | system! 'bin/rails log:clear tmp:clear' 35 | 36 | puts "\n== Restarting application server ==" 37 | system! 'bin/rails restart' 38 | end 39 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # This file loads Spring without using Bundler, in order to be fast. 5 | # It gets overwritten when you run the `spring binstub` command. 6 | 7 | unless defined?(Spring) 8 | require 'rubygems' 9 | require 'bundler' 10 | 11 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) 12 | spring = lockfile.specs.detect { |spec| spec.name == 'spring' } 13 | if spring 14 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path 15 | gem 'spring', spring.version 16 | require 'spring/binstub' 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | require 'fileutils' 5 | include FileUtils # rubocop:disable Style/MixinUsage 6 | 7 | # path to your application root. 8 | APP_ROOT = File.expand_path('..', __dir__) 9 | 10 | def system!(*args) 11 | system(*args) || abort("\n== Command #{args} failed ==") 12 | end 13 | 14 | chdir APP_ROOT do 15 | # This script is a way to update your development environment automatically. 16 | # Add necessary update steps to this file. 17 | 18 | puts '== Installing dependencies ==' 19 | system! 'gem install bundler --conservative' 20 | system('bundle check') || system!('bundle install') 21 | 22 | # Install JavaScript dependencies if using Yarn 23 | # system('bin/yarn') 24 | 25 | puts "\n== Updating database ==" 26 | system! 'bin/rails db:migrate' 27 | 28 | puts "\n== Removing old logs and tempfiles ==" 29 | system! 'bin/rails log:clear tmp:clear' 30 | 31 | puts "\n== Restarting application server ==" 32 | system! 'bin/rails restart' 33 | end 34 | -------------------------------------------------------------------------------- /bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | APP_ROOT = File.expand_path('..', __dir__) 5 | Dir.chdir(APP_ROOT) do 6 | exec 'yarnpkg', *ARGV 7 | rescue Errno::ENOENT 8 | warn 'Yarn executable was not detected in the system.' 9 | warn 'Download Yarn at https://yarnpkg.com/en/docs/install' 10 | exit 1 11 | end 12 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This file is used by Rack-based servers to start the application. 4 | 5 | require_relative 'config/environment' 6 | 7 | run Rails.application 8 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative 'boot' 4 | 5 | require 'rails/all' 6 | 7 | # Require the gems listed in Gemfile, including any gems 8 | # you've limited to :test, :development, or :production. 9 | Bundler.require(*Rails.groups) 10 | 11 | module DeepspeechServer 12 | class Application < Rails::Application # rubocop:disable Style/Documentation 13 | # Initialize configuration defaults for originally generated Rails version. 14 | config.load_defaults 5.2 15 | 16 | # Settings in config/environments/* 17 | # take precedence over those specified here. 18 | # Application configuration can go into files in config/initializers 19 | # -- all .rb files in that directory are automatically loaded after loading 20 | # the framework and any gems in your application. 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 4 | 5 | require 'bundler/setup' # Set up gems listed in the Gemfile. 6 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations. 7 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: async 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: deepspeechServer_production 11 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | U5MXPnb1FpXS+tzGYAvOSXO+6jzEZ7/3O0Pum1cAL3nlMVPKkij9qq9qXbfYGM9qnjJ8FB72+T2SrDnaa0+zDqn5lNt7K0RN6D3S1abd+Jla6b3BIwxEnkkrRFFSUVLC/ODE0OzuZAkjBQyDL22Wi2SNQbDx38SZtrXiha6c7f8Fc+boTY5YDu8ZOC7jSRlFhyqLRTzb58dpxb3nh0qDgvhloneEnudWxVtUdAiEYLlENZJaIvSAQiGH8Y6TPEaFmLq8RHzujYGoQlZ0HxcbSYZ7BdGQrTxPjIcX51F+NnrXhjeqBM8phuXqs4NSkMBheYzDzlKZwG+94ll27QLqGphUvlvL2VPmd/p0hVRb2BWaE92y2cHqGz7v3YBK10yKVkeobARgVxzJ43D3nWg8bqCtex4hnaYtjJFf--UfCnBK5UwSC/WYR2--EyKdlMkFqaL2adQcJZAivw== -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | # 7 | default: &default 8 | adapter: sqlite3 9 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 10 | timeout: 5000 11 | 12 | development: 13 | <<: *default 14 | database: db/development.sqlite3 15 | 16 | # Warning: The database defined as "test" will be erased and 17 | # re-generated from your development database when you run "rake". 18 | # Do not set this db to the same as development or production. 19 | test: 20 | <<: *default 21 | database: db/test.sqlite3 22 | 23 | production: 24 | <<: *default 25 | database: db/production.sqlite3 26 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Load the Rails application. 4 | require_relative 'application' 5 | 6 | # Initialize the Rails application. 7 | Rails.application.initialize! 8 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those 5 | # in config/application.rb. 6 | 7 | # In the development environment your application's code is reloaded on 8 | # every request. This slows down response time but is perfect for development 9 | # since you don't have to restart the web server when you make code changes. 10 | config.cache_classes = false 11 | 12 | # Do not eager load code on boot. 13 | config.eager_load = false 14 | 15 | # Show full error reports. 16 | config.consider_all_requests_local = true 17 | 18 | # Enable/disable caching. By default caching is disabled. 19 | # Run rails dev:cache to toggle caching. 20 | if Rails.root.join('tmp', 'caching-dev.txt').exist? 21 | config.action_controller.perform_caching = true 22 | 23 | config.cache_store = :memory_store 24 | config.public_file_server.headers = { 25 | 'Cache-Control' => "public, max-age=#{2.days.to_i}" 26 | } 27 | else 28 | config.action_controller.perform_caching = false 29 | 30 | config.cache_store = :null_store 31 | end 32 | 33 | # Store uploaded files on the local file system 34 | # (see config/storage.yml for options) 35 | config.active_storage.service = :local 36 | 37 | # Don't care if the mailer can't send. 38 | config.action_mailer.raise_delivery_errors = false 39 | 40 | config.action_mailer.perform_caching = false 41 | 42 | # Print deprecation notices to the Rails logger. 43 | config.active_support.deprecation = :log 44 | 45 | # Raise an error on page load if there are pending migrations. 46 | config.active_record.migration_error = :page_load 47 | 48 | # Highlight code that triggered database queries in logs. 49 | config.active_record.verbose_query_logs = true 50 | 51 | # Debug mode disables concatenation and preprocessing of assets. 52 | # This option may cause significant delays in view rendering with a large 53 | # number of complex assets. 54 | config.assets.debug = true 55 | 56 | # Suppress logger output for asset requests. 57 | config.assets.quiet = true 58 | 59 | # Raises error for missing translations 60 | # config.action_view.raise_on_missing_translations = true 61 | 62 | # Use an evented file watcher to asynchronously detect changes in source code, 63 | # routes, locales, etc. This feature depends on the listen gem. 64 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 65 | end 66 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in 5 | # config/application.rb. 6 | 7 | # Code is not reloaded between requests. 8 | config.cache_classes = true 9 | 10 | # Eager load code on boot. This eager loads most of Rails and 11 | # your application in memory, allowing both threaded web servers 12 | # and those relying on copy on write to perform better. 13 | # Rake tasks automatically ignore this option for performance. 14 | config.eager_load = true 15 | 16 | # Full error reports are disabled and caching is turned on. 17 | config.consider_all_requests_local = false 18 | config.action_controller.perform_caching = true 19 | 20 | # Ensures that a master key has been made available in either 21 | # ENV["RAILS_MASTER_KEY" or in config/master.key. 22 | # This key is used to decrypt credentials (and other encrypted files). 23 | # config.require_master_key = true 24 | 25 | # Disable serving static files from the `/public` folder by default since 26 | # Apache or NGINX already handles this. 27 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 28 | 29 | # Compress JavaScripts and CSS. 30 | config.assets.js_compressor = :uglifier 31 | # config.assets.css_compressor = :sass 32 | 33 | # Do not fallback to assets pipeline if a precompiled asset is missed. 34 | config.assets.compile = false 35 | 36 | # `config.assets.precompile` and `config.assets.version` have 37 | # moved to config/initializers/assets.rb 38 | 39 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 40 | # config.action_controller.asset_host = 'http://assets.example.com' 41 | 42 | # Specifies the header that your server uses for sending files. 43 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 44 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 45 | 46 | # Store uploaded files on the local file system 47 | # (see config/storage.yml for options) 48 | config.active_storage.service = :local 49 | 50 | # Mount Action Cable outside main process or domain 51 | # config.action_cable.mount_path = nil 52 | # config.action_cable.url = 'wss://example.com/cable' 53 | # config.action_cable.allowed_request_origins = 54 | # [ 'http://example.com', /http:\/\/example.*/ ] 55 | 56 | # Force all access to the app over SSL, use Strict-Transport-Security, 57 | # and use secure cookies. 58 | # config.force_ssl = true 59 | 60 | # Use the lowest log level to ensure availability of diagnostic information 61 | # when problems arise. 62 | config.log_level = :debug 63 | 64 | # Prepend all log lines with the following tags. 65 | config.log_tags = [:request_id] 66 | 67 | # Use a different cache store in production. 68 | # config.cache_store = :mem_cache_store 69 | 70 | # Use a real queuing backend for Active Job 71 | # (and separate queues per environment) 72 | # config.active_job.queue_adapter = :resque 73 | # config.active_job.queue_name_prefix = "deepspeechServer_#{Rails.env}" 74 | 75 | config.action_mailer.perform_caching = false 76 | 77 | # Ignore bad email addresses and do not raise email delivery errors. 78 | # Set this to true and configure the email server for 79 | # immediate delivery to raise delivery errors. 80 | # config.action_mailer.raise_delivery_errors = false 81 | 82 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 83 | # the I18n.default_locale when a translation cannot be found). 84 | config.i18n.fallbacks = true 85 | 86 | # Send deprecation notices to registered listeners. 87 | config.active_support.deprecation = :notify 88 | 89 | # Use default logging formatter so that PID and timestamp are not suppressed. 90 | config.log_formatter = ::Logger::Formatter.new 91 | 92 | # Use a different logger for distributed setups. 93 | # require 'syslog/logger' 94 | # config.logger = ActiveSupport::TaggedLogging.new 95 | # (Syslog::Logger.new 'app-name') 96 | 97 | if ENV['RAILS_LOG_TO_STDOUT'].present? 98 | logger = ActiveSupport::Logger.new(STDOUT) 99 | logger.formatter = config.log_formatter 100 | config.logger = ActiveSupport::TaggedLogging.new(logger) 101 | end 102 | 103 | # Do not dump schema after migrations. 104 | config.active_record.dump_schema_after_migration = false 105 | end 106 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in 5 | # config/application.rb. 6 | 7 | # The test environment is used exclusively to run your application's 8 | # test suite. You never need to work with it otherwise. Remember that 9 | # your test database is "scratch space" for the test suite and is wiped 10 | # and recreated between test runs. Don't rely on the data there! 11 | config.cache_classes = true 12 | 13 | # Do not eager load code on boot. This avoids loading your whole application 14 | # just for the purpose of running a single test. If you are using a tool that 15 | # preloads Rails for running tests, you may have to set it to true. 16 | config.eager_load = false 17 | 18 | # Configure public file server for tests with Cache-Control for performance. 19 | config.public_file_server.enabled = true 20 | config.public_file_server.headers = { 21 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}" 22 | } 23 | 24 | # Show full error reports and disable caching. 25 | config.consider_all_requests_local = true 26 | config.action_controller.perform_caching = false 27 | 28 | # Raise exceptions instead of rendering exception templates. 29 | config.action_dispatch.show_exceptions = false 30 | 31 | # Disable request forgery protection in test environment. 32 | config.action_controller.allow_forgery_protection = false 33 | 34 | # Store uploaded files on the local file system in a temporary directory 35 | config.active_storage.service = :test 36 | 37 | config.action_mailer.perform_caching = false 38 | 39 | # Tell Action Mailer not to deliver emails to the real world. 40 | # The :test delivery method accumulates sent emails in the 41 | # ActionMailer::Base.deliveries array. 42 | config.action_mailer.delivery_method = :test 43 | 44 | # Print deprecation notices to the stderr. 45 | config.active_support.deprecation = :stderr 46 | 47 | # Raises error for missing translations 48 | # config.action_view.raise_on_missing_translations = true 49 | end 50 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # ActiveSupport::Reloader.to_prepare do 6 | # ApplicationController.renderer.defaults.merge!( 7 | # http_host: 'example.org', 8 | # https: false 9 | # ) 10 | # end 11 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # Version of your assets, change this if you want to expire all your assets. 6 | Rails.application.config.assets.version = '1.0' 7 | 8 | # Add additional assets to the asset load path. 9 | # Rails.application.config.assets.paths << Emoji.images_path 10 | # Add Yarn node_modules folder to the asset load path. 11 | Rails.application.config.assets.paths << Rails.root.join('node_modules') 12 | 13 | # Precompile additional assets. 14 | # application.js, application.css, and all non-JS/CSS in the app/assets 15 | # folder are already added. 16 | # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 17 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # You can add backtrace silencers for libraries that 6 | # you're using but don't wish to see in your backtraces. 7 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 8 | 9 | # You can also remove all the silencers if 10 | # you're trying to debug a problem that might stem from framework code. 11 | # Rails.backtrace_cleaner.remove_silencers! 12 | -------------------------------------------------------------------------------- /config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # Define an application-wide content security policy 6 | # For further information see the following documentation 7 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy 8 | 9 | # Rails.application.config.content_security_policy do |policy| 10 | # policy.default_src :self, :https 11 | # policy.font_src :self, :https, :data 12 | # policy.img_src :self, :https, :data 13 | # policy.object_src :none 14 | # policy.script_src :self, :https 15 | # policy.style_src :self, :https 16 | 17 | # # Specify URI for violation reports 18 | # # policy.report_uri "/csp-violation-report-endpoint" 19 | # end 20 | 21 | # If you are using UJS then enable automatic nonce generation 22 | # Rails.application.config.content_security_policy_nonce_generator = -> request 23 | # { SecureRandom.base64(16) } 24 | 25 | # Report CSP violations to a specified URI 26 | # For further information see the following documentation: 27 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only 28 | # Rails.application.config.content_security_policy_report_only = true 29 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # Specify a serializer for the signed and encrypted cookie jars. 6 | # Valid options are :json, :marshal, and :hybrid. 7 | Rails.application.config.action_dispatch.cookies_serializer = :json 8 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # Configure sensitive parameters which will be filtered from the log file. 6 | Rails.application.config.filter_parameters += [:password] 7 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # Add new inflection rules using the following format. Inflections 6 | # are locale specific, and you may define rules for as many different 7 | # locales as you wish. All of these examples are active by default: 8 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 9 | # inflect.plural /^(ox)$/i, '\1en' 10 | # inflect.singular /^(ox)en/i, '\1' 11 | # inflect.irregular 'person', 'people' 12 | # inflect.uncountable %w( fish sheep ) 13 | # end 14 | 15 | # These inflection rules are supported but not enabled by default: 16 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 17 | # inflect.acronym 'RESTful' 18 | # end 19 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # Add new mime types for use in respond_to blocks: 6 | # Mime::Type.register "text/richtext", :rtf 7 | -------------------------------------------------------------------------------- /config/initializers/redis.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'yaml' 4 | 5 | props = YAML.safe_load(File.open('settings.yaml')) 6 | redis_namespace = props['redis_list_namespace'] 7 | 8 | # Namespace our keys to bbb_texttrack_service: 9 | # $redis.lpush("foo", "bar") is really bbb_texttrack_service:foo 10 | # $redis.llen("foo") is really bbb_texttrack_service:foo 11 | # rubocop:disable Style/GlobalVars 12 | $redis = Redis::Namespace.new(redis_namespace, redis: Redis.new) 13 | # rubocop:enable Style/GlobalVars 14 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # This file contains settings for ActionController::ParamsWrapper which 6 | # is enabled by default. 7 | 8 | # Enable parameter wrapping for JSON. 9 | # You can disable this by setting :format to an empty array. 10 | ActiveSupport.on_load(:action_controller) do 11 | wrap_parameters format: [:json] 12 | end 13 | 14 | # To enable root element in JSON for ActiveRecord objects. 15 | # ActiveSupport.on_load(:active_record) do 16 | # self.include_root_in_json = true 17 | # end 18 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # The following keys must be escaped otherwise they will not be retrieved by 20 | # the default I18n backend: 21 | # 22 | # true, false, on, off, yes, no 23 | # 24 | # Instead, surround them with single quotes. 25 | # 26 | # en: 27 | # 'true': 'foo' 28 | # 29 | # To learn more, please read the Rails Internationalization guide 30 | # available at http://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Puma can serve each request in a thread from an internal thread pool. 4 | # The `threads` method setting takes two numbers: a minimum and maximum. 5 | # Any libraries that use thread pools should be configured to match 6 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 7 | # and maximum; this matches the default thread size of Active Record. 8 | # 9 | threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 } 10 | threads threads_count, threads_count 11 | 12 | # Specifies the `port` that Puma will listen on to receive requests; 13 | # default is 3000. 14 | # 15 | port ENV.fetch('PORT') { 3000 } 16 | 17 | # Specifies the `environment` that Puma will run in. 18 | # 19 | environment ENV.fetch('RAILS_ENV') { 'development' } 20 | 21 | # Specifies the number of `workers` to boot in clustered mode. 22 | # Workers are forked webserver processes. If using threads and workers together 23 | # the concurrency of the application would be max `threads` * `workers`. 24 | # Workers do not work on JRuby or Windows (both of which do not support 25 | # processes). 26 | # 27 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 28 | 29 | # Use the `preload_app!` method when specifying a `workers` number. 30 | # This directive tells Puma to first boot the application and load code 31 | # before forking the application. This takes advantage of Copy On Write 32 | # process behavior so workers use less memory. 33 | # 34 | # preload_app! 35 | 36 | # Allow puma to be restarted by `rails restart` command. 37 | plugin :tmp_restart 38 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.routes.draw do 4 | resources :jobstatuses 5 | # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 6 | get 'deepspeech/home', to: 'deepspeech#home' 7 | post 'deepspeech/createjob/:api_key', to: 'deepspeech#create_job' 8 | post 'deepspeech/checkstatus/:job_id/:api_key', to: 'deepspeech#check_status' 9 | post 'deepspeech/transcript/:job_id/:api_key', to: 'deepspeech#transcript' 10 | end 11 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | %w[ 4 | .ruby-version 5 | .rbenv-vars 6 | tmp/restart.txt 7 | tmp/caching-dev.txt 8 | ].each { |path| Spring.watch(path) } 9 | -------------------------------------------------------------------------------- /config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | 9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 10 | # amazon: 11 | # service: S3 12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 14 | # region: us-east-1 15 | # bucket: your_own_bucket 16 | 17 | # Remember not to checkin your GCS keyfile to a repository 18 | # google: 19 | # service: GCS 20 | # project: your_project 21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 22 | # bucket: your_own_bucket 23 | 24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 25 | # microsoft: 26 | # service: AzureStorage 27 | # storage_account_name: your_account_name 28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 29 | # container: your_container_name 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | -------------------------------------------------------------------------------- /db/migrate/20190911175040_create_job_statuses.rb: -------------------------------------------------------------------------------- 1 | # rubocop:disable Style/Documentation 2 | # frozen_string_literal: true 3 | 4 | class CreateJobStatuses < ActiveRecord::Migration[5.2] 5 | def change 6 | create_table :job_statuses do |t| 7 | t.string :job_id 8 | t.string :status 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | # rubocop:enable Style/Documentation 15 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # Note that this schema.rb definition is the authoritative source for your 6 | # database schema. If you need to create the application database on another 7 | # system, you should be using db:schema:load, not running all the migrations 8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 9 | # you'll amass, the slower it'll run and the greater likelihood for issues). 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(version: 2019_09_11_175040) do 14 | 15 | create_table "job_statuses", force: :cascade do |t| 16 | t.string "job_id" 17 | t.string "status" 18 | t.datetime "created_at", null: false 19 | t.datetime "updated_at", null: false 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This file should contain all the record creation needed 4 | # to seed the database with its default values. 5 | # The data can then be loaded with the rails db:seed command 6 | # (or created alongside the database with db:setup). 7 | # 8 | # Examples: 9 | # 10 | # movies = Movie.create([{ name: 'Star Wars' }, 11 | # { name: 'Lord of the Rings' }]) 12 | # Character.create(name: 'Luke', movie: movies.first) 13 | -------------------------------------------------------------------------------- /deepspeech-service.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require './lib/deepspeech' 4 | 5 | props = YAML.load_file('settings.yaml') 6 | 7 | redis = if ENV['REDIS_URL'].nil? 8 | Redis.new 9 | else 10 | Redis.new(url: ENV['REDIS_URL']) 11 | end 12 | 13 | JOB_KEY = props['redis_jobs_transcript'] 14 | num_entries = redis.llen(JOB_KEY) 15 | puts "num_entries = #{num_entries}" 16 | 17 | loop do 18 | # for i in 1..num_entries do 19 | _job_list, data = redis.blpop(JOB_KEY) 20 | job_entry = JSON.parse(data) 21 | puts "job_entry...#{job_entry['job_id']}" 22 | MozillaDeepspeech::TranscriptWorker.perform_async(job_entry['job_id']) 23 | end 24 | -------------------------------------------------------------------------------- /deepspeech-worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require './lib/deepspeech' 4 | -------------------------------------------------------------------------------- /development/.ruby-version: -------------------------------------------------------------------------------- 1 | 2.6.1 2 | -------------------------------------------------------------------------------- /development/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #set -e 3 | 4 | # Setup Faktory password 5 | faktory_password=$( cat /etc/faktory/password ) 6 | sed -i -E "s/[0-9a-zA-Z]+@localhost/$faktory_password@localhost/" start-service.sh 7 | sed -i -E "s/[0-9a-zA-Z]+@localhost/$faktory_password@localhost/" start-worker.sh 8 | -------------------------------------------------------------------------------- /development/start-service.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | FAKTORY_PROVIDER=FAKTORY_URL FAKTORY_URL=tcp://:1d2a579a0460a257@localhost:7419 bundle exec ruby ./deepspeech-service.rb 3 | -------------------------------------------------------------------------------- /development/start-worker.sh: -------------------------------------------------------------------------------- 1 | FAKTORY_PROVIDER=FAKTORY_URL FAKTORY_URL=tcp://:1d2a579a0460a257@localhost:7419 bundle exec faktory-worker -r ./deepspeech-worker.rb 2 | -------------------------------------------------------------------------------- /dump.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/dump.rdb -------------------------------------------------------------------------------- /example-credentials.yaml: -------------------------------------------------------------------------------- 1 | api_key: {api_key} -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/lib/assets/.keep -------------------------------------------------------------------------------- /lib/deepspeech.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Set encoding to utf-8 4 | # encoding: UTF-8 5 | 6 | # 7 | # BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ 8 | # 9 | # Copyright (c) 2019 BigBlueButton Inc. and by respective authors (see below). 10 | # 11 | 12 | # path = File.expand_path(File.join(File.dirname(__FILE__), '../lib')) 13 | # $LOAD_PATH << path 14 | 15 | require_relative './deepspeech/mozilla_deepspeech_worker' 16 | 17 | module Deepspeech # rubocop:disable Style/Documentation 18 | def self.logger=(log) 19 | @logger = log 20 | end 21 | 22 | def self.logger 23 | return @logger if @logger 24 | 25 | logger = Logger.new(STDOUT) 26 | logger.level = Logger::DEBUG 27 | @logger = logger 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/deepspeech/mozilla_deepspeech_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'faktory_worker_ruby' 4 | require 'connection_pool' 5 | require 'securerandom' 6 | require 'faktory' 7 | require 'json' 8 | require 'sqlite3' 9 | require 'speech_to_text' 10 | require 'yaml' 11 | 12 | rails_environment_path = File.expand_path( 13 | File.join(__dir__, '..', '..', 'config', 'environment') 14 | ) 15 | require rails_environment_path 16 | 17 | module MozillaDeepspeech 18 | class TranscriptWorker # rubocop:disable Style/Documentation 19 | include Faktory::Job 20 | faktory_options retry: 2, concurrency: 5 21 | 22 | def perform(job_id) # rubocop:disable Metrics/MethodLength 23 | status = 'inProgress' 24 | update_status(job_id, status) 25 | props = YAML.load_file('settings.yaml') 26 | model_path = props['model_path'] 27 | puts model_path 28 | filepath = "#{Rails.root}/storage/#{job_id}" 29 | 30 | SpeechToText::MozillaDeepspeechS2T.generate_transcript( 31 | "#{filepath}/audio.wav", 32 | "#{filepath}/audio.json", 33 | model_path 34 | ) 35 | 36 | if File.exist?("#{Rails.root}/storage/#{job_id}/audio.json") 37 | file = File.open("#{Rails.root}/storage/#{job_id}/audio.json", 'r') 38 | data = JSON.load file 39 | status = if data['words'].nil? 40 | 'failed' 41 | else 42 | 'completed' 43 | end 44 | else 45 | status = 'failed' 46 | end 47 | update_status(job_id, status) 48 | end 49 | 50 | def update_status(job_id, status) 51 | ActiveRecord::Base.connection_pool.with_connection do 52 | job = JobStatus.find_by(job_id: job_id) 53 | job.status = status 54 | job.updated_at = Time.now 55 | job.save 56 | end 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/lib/tasks/.keep -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/log/.keep -------------------------------------------------------------------------------- /old_README.md: -------------------------------------------------------------------------------- 1 | # README 2 | 3 | This README would normally document whatever steps are necessary to get the 4 | application up and running. 5 | 6 | Things you may want to cover: 7 | 8 | * Ruby version 9 | 10 | * System dependencies 11 | 12 | * Configuration 13 | 14 | * Database creation 15 | 16 | * Database initialization 17 | 18 | * How to run the test suite 19 | 20 | * Services (job queues, cache servers, search engines, etc.) 21 | 22 | * Deployment instructions 23 | 24 | * ... 25 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "deepspeechServer", 3 | "private": true, 4 | "dependencies": {} 5 | } 6 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /service/deepspeech_rails.service: -------------------------------------------------------------------------------- 1 | # deepspeech_rails.service 2 | [Unit] 3 | Description=Deepspeech Rails 4 | [Service] 5 | Type=simple 6 | Environment=LANG=en_US.UTF-8 7 | User=ubuntu 8 | # WorkingDirectory=/home/ubuntu/worker/deepspeech-web 9 | WorkingDirectory=/usr/local/worker/deepspeech-web 10 | ExecStart=/home/ubuntu/.rbenv/shims/bundle exec rails s -b 0.0.0.0 -e development -p 3000 11 | Restart=always 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /service/deepspeech_service.service: -------------------------------------------------------------------------------- 1 | # deepspeech_service.service 2 | [Unit] 3 | Description=Deepspeech service 4 | [Service] 5 | # Environment=LANG=en_US.UTF-8 FAKTORY_PROVIDER=FAKTORY_URL FAKTORY_URL=tcp://:64922309996db536@localhost:7419 6 | Environment=LANG=en_US.UTF-8 FAKTORY_PROVIDER=FAKTORY_URL FAKTORY_URL=tcp://:ab1b8c1c516b1f6d@localhost:7419 7 | User=ubuntu 8 | # WorkingDirectory=/home/ubuntu/worker/deepspeech-web 9 | WorkingDirectory=/usr/local/worker/deepspeech-web 10 | ExecStart=/home/ubuntu/.rbenv/shims/bundle exec ruby ./deepspeech-service.rb 11 | Restart=always 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /service/deepspeech_worker.service: -------------------------------------------------------------------------------- 1 | # deepspeech_worker.service 2 | [Unit] 3 | Description=Deepspeech Worker 4 | [Service] 5 | # Environment=LANG=en_US.UTF-8 FAKTORY_PROVIDER=FAKTORY_URL FAKTORY_URL=tcp://:64922309996db536@localhost:7419 6 | Environment=LANG=en_US.UTF-8 FAKTORY_PROVIDER=FAKTORY_URL FAKTORY_URL=tcp://:ab1b8c1c516b1f6d@localhost:7419 7 | User=ubuntu 8 | # WorkingDirectory=/home/ubuntu/worker/deepspeech-web 9 | WorkingDirectory=/usr/local/worker/deepspeech-web 10 | ExecStart=/home/ubuntu/.rbenv/shims/bundle exec faktory-worker -r ./deepspeech-worker.rb 11 | Restart=always 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /settings.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | redis_host: 127.0.0.1 3 | redis_port: 6379 4 | # Uncomment and set password if redis require it. 5 | # redis_password: changeme 6 | 7 | log_to_file: false 8 | 9 | # Used to namespace the redis keys used by rails. 10 | # see config/initializers/redis.rb 11 | # 12 | redis_list_namespace: "bbb_texttrack_service" 13 | redis_jobs_transcript: "bbb_texttrack_service:transcript" 14 | model_path: "/home/speech/deepspeech/temp" -------------------------------------------------------------------------------- /storage/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/storage/.keep -------------------------------------------------------------------------------- /systemd/ari-caddy.service: -------------------------------------------------------------------------------- 1 | # deepspeech_rails.service 2 | [Unit] 3 | Description=ari-caddy 4 | [Service] 5 | Type=simple 6 | Environment=LANG=en_US.UTF-8 7 | User=root 8 | # WorkingDirectory=/home/ubuntu/worker/deepspeech-web 9 | WorkingDirectory=/home/ari/ 10 | ExecStart=/home/ari/caddy reverse-proxy --from ari-deepspeech.blindside-dev.com --to localhost:3000 11 | Restart=always 12 | [Install] 13 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /test/application_system_test_case.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase 6 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400] 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/test/controllers/.keep -------------------------------------------------------------------------------- /test/controllers/audio_to_json_controller_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class AudioToJsonControllerTest < ActionDispatch::IntegrationTest 6 | # test "the truth" do 7 | # assert true 8 | # end 9 | end 10 | -------------------------------------------------------------------------------- /test/controllers/jobstatuses_controller_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class JobstatusesControllerTest < ActionDispatch::IntegrationTest 6 | setup do 7 | @jobstatus = jobstatuses(:one) 8 | end 9 | 10 | test 'should get index' do 11 | get jobstatuses_url 12 | assert_response :success 13 | end 14 | 15 | test 'should get new' do 16 | get new_jobstatus_url 17 | assert_response :success 18 | end 19 | 20 | test 'should create jobstatus' do 21 | assert_difference('Jobstatus.count') do 22 | post jobstatuses_url, params: 23 | { jobstatus: { jobID: @jobstatus.jobID, 24 | status: @jobstatus.status } } 25 | end 26 | 27 | assert_redirected_to jobstatus_url(Jobstatus.last) 28 | end 29 | 30 | test 'should show jobstatus' do 31 | get jobstatus_url(@jobstatus) 32 | assert_response :success 33 | end 34 | 35 | test 'should get edit' do 36 | get edit_jobstatus_url(@jobstatus) 37 | assert_response :success 38 | end 39 | 40 | test 'should update jobstatus' do 41 | patch jobstatus_url(@jobstatus), params: 42 | { jobstatus: { jobID: @jobstatus.jobID, 43 | status: @jobstatus.status } } 44 | assert_redirected_to jobstatus_url(@jobstatus) 45 | end 46 | 47 | test 'should destroy jobstatus' do 48 | assert_difference('Jobstatus.count', -1) do 49 | delete jobstatus_url(@jobstatus) 50 | end 51 | 52 | assert_redirected_to jobstatuses_url 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/test/fixtures/.keep -------------------------------------------------------------------------------- /test/fixtures/files/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/test/fixtures/files/.keep -------------------------------------------------------------------------------- /test/fixtures/job_statuses.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | job_id: MyString 5 | status: MyString 6 | 7 | two: 8 | job_id: MyString 9 | status: MyString 10 | -------------------------------------------------------------------------------- /test/fixtures/jobstatuses.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | jobID: MyString 5 | status: MyString 6 | 7 | two: 8 | jobID: MyString 9 | status: MyString 10 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/test/helpers/.keep -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/test/integration/.keep -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/test/mailers/.keep -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/test/models/.keep -------------------------------------------------------------------------------- /test/models/job_status_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class JobStatusTest < ActiveSupport::TestCase 6 | # test "the truth" do 7 | # assert true 8 | # end 9 | end 10 | -------------------------------------------------------------------------------- /test/models/jobstatus_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class JobstatusTest < ActiveSupport::TestCase 6 | # test "the truth" do 7 | # assert true 8 | # end 9 | end 10 | -------------------------------------------------------------------------------- /test/system/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/test/system/.keep -------------------------------------------------------------------------------- /test/system/jobstatuses_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'application_system_test_case' 4 | 5 | class JobstatusesTest < ApplicationSystemTestCase 6 | setup do 7 | @jobstatus = jobstatuses(:one) 8 | end 9 | 10 | test 'visiting the index' do 11 | visit jobstatuses_url 12 | assert_selector 'h1', text: 'Jobstatuses' 13 | end 14 | 15 | test 'creating a Jobstatus' do 16 | visit jobstatuses_url 17 | click_on 'New Jobstatus' 18 | 19 | fill_in 'Jobid', with: @jobstatus.jobID 20 | fill_in 'Status', with: @jobstatus.status 21 | click_on 'Create Jobstatus' 22 | 23 | assert_text 'Jobstatus was successfully created' 24 | click_on 'Back' 25 | end 26 | 27 | test 'updating a Jobstatus' do 28 | visit jobstatuses_url 29 | click_on 'Edit', match: :first 30 | 31 | fill_in 'Jobid', with: @jobstatus.jobID 32 | fill_in 'Status', with: @jobstatus.status 33 | click_on 'Update Jobstatus' 34 | 35 | assert_text 'Jobstatus was successfully updated' 36 | click_on 'Back' 37 | end 38 | 39 | test 'destroying a Jobstatus' do 40 | visit jobstatuses_url 41 | page.accept_confirm do 42 | click_on 'Destroy', match: :first 43 | end 44 | 45 | assert_text 'Jobstatus was successfully destroyed' 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ENV['RAILS_ENV'] ||= 'test' 4 | require_relative '../config/environment' 5 | require 'rails/test_help' 6 | 7 | class ActiveSupport::TestCase 8 | # Set all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 9 | fixtures :all 10 | 11 | # Add more helper methods to be used by all tests here... 12 | end 13 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/tmp/.keep -------------------------------------------------------------------------------- /vendor/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigbluebutton/deepspeech-web/2dccec12f08b34af833d7a37a615a334c00f747f/vendor/.keep --------------------------------------------------------------------------------