thecore_background_jobs 1.1.11 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +57 -21
- data/lib/thecore_background_jobs.rb +1 -2
- data/lib/thecore_background_jobs/engine.rb +2 -2
- data/lib/thecore_background_jobs/version.rb +1 -1
- metadata +10 -15
- data/app/assets/config/thecore_background_jobs_manifest.js +0 -0
- data/config/initializers/thecore_background_jobs_after_initialize.rb +0 -6
- data/config/initializers/thecore_background_jobs_rails_admin_config.rb +0 -0
- data/lib/abilities_thecore_background_jobs_concern.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 026ac30d95e6929de773f0768742b6c098e0499d9edb4e8ac418f73e012e5727
|
4
|
+
data.tar.gz: b45957ef1586b45ecf330953c7b9a974d7e688b23a5563276eb8818cd5e74511
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6c2fd8152e161255c746371b7e5c569473687aabfb6ac5a9c1188165859823b68b953fd1e36c5b4e9872c3a0f8d69318afef6a8d433a6031dad91860a8a405a
|
7
|
+
data.tar.gz: ecf72774f0101ee954497cd464fb1d85902768e653bd4faaa6868cb9115548f96ebd8351d59dd0d90686fe50b0b921b7edb6e01506588e5d0068c5044d82c62f
|
data/README.md
CHANGED
@@ -1,28 +1,64 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
Dependencies
|
2
|
+
------------
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
This gem depends on tiny\_tds, which depends on some debian packages to
|
5
|
+
be installed:
|
6
6
|
|
7
|
-
|
8
|
-
Add this line to your application's Gemfile:
|
7
|
+
sudo apt install freetds-dev redis-server
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
```
|
9
|
+
Sidekiq setup
|
10
|
+
-------------
|
13
11
|
|
14
|
-
|
15
|
-
```bash
|
16
|
-
$ bundle
|
17
|
-
```
|
12
|
+
The following script asks for the installation directory of the main Thecore App and from that it retrieves the needed information.
|
18
13
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
echo "Please provide the path to the app:";read APPPATH
|
15
|
+
APPNAME=$(basename "$APPPATH")
|
16
|
+
CURDIR=$(pwd)
|
17
|
+
cd $APPPATH
|
18
|
+
BUNDLEBIN=$(which bundle)
|
19
|
+
cd $CURDIR
|
20
|
+
cat <<EOM | sudo tee "/lib/systemd/system/sidekiq-$APPNAME.service"
|
21
|
+
[Unit]
|
22
|
+
Description=sidekiq-$APPNAME
|
23
|
+
After=syslog.target network.target redis-server.service
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
[Service]
|
26
|
+
WorkingDirectory=$APPPATH
|
27
|
+
ExecStart=$BUNDLEBIN exec "sidekiq -e production"
|
28
|
+
User=${SUDO_USER:-$(whoami)}
|
29
|
+
Type=simple
|
30
|
+
RestartSec=1
|
31
|
+
Restart=on-failure
|
26
32
|
|
27
|
-
|
28
|
-
|
33
|
+
# output goes to /var/log/syslog
|
34
|
+
StandardOutput=syslog
|
35
|
+
StandardError=syslog
|
36
|
+
SyslogIdentifier=sidekiq-$APPNAME
|
37
|
+
|
38
|
+
[Install]
|
39
|
+
WantedBy=multi-user.target
|
40
|
+
EOM
|
41
|
+
|
42
|
+
Then enable it:
|
43
|
+
|
44
|
+
sudo systemctl enable sidekiq-$APPNAME
|
45
|
+
|
46
|
+
and start:
|
47
|
+
|
48
|
+
sudo service sidekiq-$APPNAME start
|
49
|
+
|
50
|
+
Now you can access the web ui, i.e.
|
51
|
+
|
52
|
+
https://yourtld/sidekiq
|
53
|
+
|
54
|
+
And you can manually test it in rails console:
|
55
|
+
|
56
|
+
RAILS_ENV=production rails runner ImportFromFtpWorker.perform_async
|
57
|
+
|
58
|
+
If you'd like to have the scheduled job run repeatedly, then add
|
59
|
+
**config/sidekiq.yml** with content like:
|
60
|
+
|
61
|
+
schedule:
|
62
|
+
hello_world:
|
63
|
+
cron: '0 * * * * *' # Runs once per minute
|
64
|
+
class: HelloWorld
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require '
|
1
|
+
require 'thecore_backend_commons'
|
2
2
|
module ThecoreBackgroundJobs
|
3
3
|
class Engine < ::Rails::Engine
|
4
4
|
|
5
5
|
initializer 'thecore_background_jobs.add_to_migrations' do |app|
|
6
|
-
unless app.root.to_s
|
6
|
+
unless app.root.to_s.match root.to_s
|
7
7
|
# APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
|
8
8
|
config.paths['db/migrate'].expanded.each do |expanded_path|
|
9
9
|
app.config.paths['db/migrate'] << expanded_path
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_background_jobs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: thecore_backend_commons
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sidekiq
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '6.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '6.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sidekiq-scheduler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sidekiq-failures
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,12 +76,8 @@ files:
|
|
76
76
|
- MIT-LICENSE
|
77
77
|
- README.md
|
78
78
|
- Rakefile
|
79
|
-
- app/assets/config/thecore_background_jobs_manifest.js
|
80
79
|
- app/workers/demo_worker.rb
|
81
|
-
- config/initializers/thecore_background_jobs_after_initialize.rb
|
82
|
-
- config/initializers/thecore_background_jobs_rails_admin_config.rb
|
83
80
|
- config/routes.rb
|
84
|
-
- lib/abilities_thecore_background_jobs_concern.rb
|
85
81
|
- lib/admin_constraint.rb
|
86
82
|
- lib/tasks/thecore_background_jobs_tasks.rake
|
87
83
|
- lib/thecore_background_jobs.rb
|
@@ -106,8 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
102
|
- !ruby/object:Gem::Version
|
107
103
|
version: '0'
|
108
104
|
requirements: []
|
109
|
-
|
110
|
-
rubygems_version: 2.6.14
|
105
|
+
rubygems_version: 3.0.3
|
111
106
|
signing_key:
|
112
107
|
specification_version: 4
|
113
108
|
summary: Thecorized thecore_background_jobs
|
File without changes
|
File without changes
|
@@ -1,29 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'active_support/concern'
|
3
|
-
|
4
|
-
module ThecoreBackgroundJobAbilitiesConcern
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
included do
|
7
|
-
def thecore_background_jobs_abilities user
|
8
|
-
# Not so good, but let's try
|
9
|
-
RailsAdmin.config do |config|
|
10
|
-
config.navigation_static_links = {
|
11
|
-
"Sidekiq Dashboard" => "#{ENV['RAILS_RELATIVE_URL_ROOT']}/app/sidekiq"
|
12
|
-
}
|
13
|
-
end
|
14
|
-
if user
|
15
|
-
# if the user is logged in, it can do certain tasks regardless his role
|
16
|
-
if user.admin?
|
17
|
-
# if the user is an admin, it can do a lot of things, usually
|
18
|
-
end
|
19
|
-
|
20
|
-
if user.has_role? :role
|
21
|
-
# a specific role, brings specific powers
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# include the extension
|
29
|
-
TheCoreAbilities.send(:include, ThecoreBackgroundJobAbilitiesConcern)
|