thecore_background_jobs 1.1.11 → 1.1.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8be10ab01c0f358480e35cff1ac6d10f89aa8a08
4
- data.tar.gz: e07d8f9deb36410e21a43722c73b01f6bfaf4e12
3
+ metadata.gz: 205f7219863c17c818bf6e51bdf5f9c77556ec43
4
+ data.tar.gz: 97acb0b2f9f0c686fa26bf82ef7fb4217adac24b
5
5
  SHA512:
6
- metadata.gz: 8fc280be4ac6d7fc4de11acb21a60df9c7eef849957911720233c9361c32308aae7703a60a7d277005874fc8ff8aca2681996988177e2f63ec811b6e2914623d
7
- data.tar.gz: 2863c6f9bb101d46bcd099febfdb162307b94bc930dea2dcfc5bcd7eddd4a397a7933fd7545d34a86778830b04773fc88d3da7b4192d2a5c9f705b32d82a5bae
6
+ metadata.gz: ccc7b0474500dfe2c176d35dcce3a4d3dd22c82b09e82f10eb5a086e403e50f1c78fb334f35ae0dc543eb6bf738f679e693d48396c14fc9518c55a48ed0168d0
7
+ data.tar.gz: 4b54c091d3fe9147f966b5aca065b4f5ad05de2f3421edf3be15dd7231c8ec23da6534a256d9679117ffe7ed5d6e898005208d147afaa2efddae31ca3760a0aa
data/README.md CHANGED
@@ -1,28 +1,66 @@
1
- # ThecoreBackgroundJobs
2
- Short description and motivation.
1
+ Dependencies
2
+ ------------
3
3
 
4
- ## Usage
5
- How to use my plugin.
4
+ This gem depends on tiny\_tds, which depends on some debian packages to
5
+ be installed:
6
6
 
7
- ## Installation
8
- Add this line to your application's Gemfile:
7
+ sudo apt install freetds-dev redis-server
9
8
 
10
- ```ruby
11
- gem 'thecore_background_jobs'
12
- ```
9
+ Sidekiq setup
10
+ -------------
13
11
 
14
- And then execute:
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
- Or install it yourself as:
20
- ```bash
21
- $ gem install thecore_background_jobs
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
- ## Contributing
25
- Contribution directions go here.
25
+ [Service]
26
+ WorkingDirectory=$APPPATH
27
+ Environment=SECRET_KEY_BASE=$(grep "SECRET_KEY_BASE" /etc/apache2/bancolini-confs/$APPNAME.conf|awk -F " " '{print $3}')
28
+ Environment=$(echo $APPNAME | awk '{print toupper($0)}')_DATABASE_PASSWORD=$APPNAME
29
+ ExecStart=$BUNDLEBIN exec "sidekiq -e production"
30
+ User=${SUDO_USER:-$(whoami)}
31
+ Type=simple
32
+ RestartSec=1
33
+ Restart=on-failure
26
34
 
27
- ## License
28
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
35
+ # output goes to /var/log/syslog
36
+ StandardOutput=syslog
37
+ StandardError=syslog
38
+ SyslogIdentifier=sidekiq-$APPNAME
39
+
40
+ [Install]
41
+ WantedBy=multi-user.target
42
+ EOM
43
+
44
+ Then enable it:
45
+
46
+ sudo systemctl enable sidekiq-$APPNAME
47
+
48
+ and start:
49
+
50
+ sudo service sidekiq-$APPNAME start
51
+
52
+ Now you can access the web ui, i.e.
53
+
54
+ https://yourtld/sidekiq
55
+
56
+ And you can manually test it in rails console:
57
+
58
+ RAILS_ENV=production rails runner ImportFromFtpWorker.perform_async
59
+
60
+ If you'd like to have the scheduled job run repeatedly, then add
61
+ **config/sidekiq.yml** with content like:
62
+
63
+ :schedule:
64
+ hello_world:
65
+ cron: '0 * * * * *' # Runs once per minute
66
+ class: HelloWorld
@@ -0,0 +1,4 @@
1
+ # Not so good, but let's try
2
+ RailsAdmin.config do |config|
3
+ (config.navigation_static_links ||= {}).merge! "Background Monitor" => "#{ENV['RAILS_RELATIVE_URL_ROOT']}/app/sidekiq"
4
+ end
@@ -5,12 +5,6 @@ module ThecoreBackgroundJobAbilitiesConcern
5
5
  extend ActiveSupport::Concern
6
6
  included do
7
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
8
  if user
15
9
  # if the user is logged in, it can do certain tasks regardless his role
16
10
  if user.admin?
@@ -1,3 +1,3 @@
1
1
  module ThecoreBackgroundJobs
2
- VERSION = '1.1.11'
2
+ VERSION = '1.1.12'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_background_jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.11
4
+ version: 1.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-08 00:00:00.000000000 Z
11
+ date: 2018-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore
@@ -80,6 +80,7 @@ files:
80
80
  - app/workers/demo_worker.rb
81
81
  - config/initializers/thecore_background_jobs_after_initialize.rb
82
82
  - config/initializers/thecore_background_jobs_rails_admin_config.rb
83
+ - config/initializers/thecore_background_jobs_static_links.rb
83
84
  - config/routes.rb
84
85
  - lib/abilities_thecore_background_jobs_concern.rb
85
86
  - lib/admin_constraint.rb