Comments (11)
Regarding scheduled backups, these are handled through cronjobs, which should automatically be set up if you deployed via capistrano. This is done transparently through the whenever
gem in tandem with its capistrano plugin:
Line 12 in 7de3298
If you're not using cap production deploy
, then you'd have to manually set up the cronjobs. You can see what cronjobs you have on your system with crontab -e
(and try with sudo as well, may give different results).
This is what you should see:
# Begin Whenever generated tasks for: standard-notes-server_production at: 2020-02-27 16:35:40 +0000
0 5 * * * /bin/bash -l -c 'cd /syncing-server/releases/_release_timestamp_ && bundle exec bin/rails runner -e production '\''Tasks.perform_daily_backup_jobs'\'' >> log/whenever.log 2>&1'
Also you are correct that each client-side save made to the server will trigger a job, as you are using the revision history extension that keeps track of all saves (with internal pruning to minimize the overall number of revisions).
from syncing-server.
@mobitar thanks for you reply.
If I use cap production deploy
, do I have to have a cap.yml
file? If yes, could you please give me a sample file for syncing-server? I found a cap.example.yml
but I can't make it work.
If I use the crontab -e
command and I got log like this:
Please specify a valid ruby command or the path of a script to run.
Run 'bin/rails runner -h' for help.
uninitialized constant Rails::Command::RunnerCommand::Tasks
Did I miss some steps?
Thanks.
from syncing-server.
Yes the cap.example.yml should do it. What doesn't work in particular? Also crontab -e
is a Linux command and not a Ruby command, so you would enter it in the main console and not in the the Ruby interpreter (I'm not sure if that's your issue, but based on the output that's my guess).
from syncing-server.
Thanks.
I don't know about the cap. So I just copy cap.example.yml
to cap.yml
and I'd like to deploy on the server locally. If I run cap production deploy
, I got error:
(Backtrace restricted to imported tasks)
cap aborted!
LoadError: cannot load such file -- capistrano/shoryuken
/home/ubuntu/syncing-server/Capfile:11:in `<top (required)>'
(See full trace by running task with --trace)
Then I run bundle exec cap production deploy
, I got error:
rvm 1.29.10 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
system
#<Thread:0x00005579d653bd30 /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
9: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
8: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:31:in `run'
7: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
6: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:11:in `block (3 levels) in <top (required)>'
5: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:66:in `capture'
4: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
3: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `tap'
2: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
1: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/netssh.rb:170:in `execute_command'
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/command.rb:97:in `exit_status=': ruby exit status: 2 (SSHKit::Command::Failed)
ruby stdout: Nothing written
ruby stderr: Ruby ruby-2.6.5 is not installed.
1: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as [email protected]: ruby exit status: 2 (SSHKit::Runner::ExecuteError)
ruby stdout: Nothing written
ruby stderr: Ruby ruby-2.6.5 is not installed.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: ruby exit status: 2
ruby stdout: Nothing written
ruby stderr: Ruby ruby-2.6.5 is not installed.
Caused by:
SSHKit::Command::Failed: ruby exit status: 2
ruby stdout: Nothing written
ruby stderr: Ruby ruby-2.6.5 is not installed.
Tasks: TOP => rvm:check
(See full trace by running task with --trace)
Here is my cap.yml
:
default: &default
key_path: /home/ubuntu/key.pem
repo_url: https://github.com/standardnotes/syncing-server.git
user: ubuntu
staging:
<<: *default
server: staging.yourdomain.com
branch: staging
deploy_to: ~/standard-notes-staging-server
production:
<<: *default
server: 127.0.0.1
deploy_to: ~/standard-notes-prod-server
For the manually method (crontab), before I create a crontab command, I run the command in the terminal:
bundle exec bin/rails runner -e production 'Tasks.perform_daily_backup_jobs' >> log/whenever.log 2>&1
I got error:
Please specify a valid ruby command or the path of a script to run.
Run 'bin/rails runner -h' for help.
uninitialized constant Rails::Command::RunnerCommand::Tasks
from syncing-server.
You'll need Ruby 2.6.5 on your server. Or you can comment out this line and try again: https://github.com/standardnotes/syncing-server/blob/master/config/deploy.rb#L38
from syncing-server.
Thanks.
After I comment the line, I run bundle exec cap production deploy --trace
, I got this error:
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke rvm:hook (first_time)
** Invoke passenger:rvm:hook (first_time)
** Invoke passenger:test_which_passenger (first_time)
** Execute passenger:test_which_passenger
** Execute passenger:rvm:hook
** Execute rvm:hook
** Invoke rvm:check (first_time)
** Execute rvm:check
rvm 1.29.10 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
system
#<Thread:0x000055b2aeabf4a8 /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
9: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
8: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:31:in `run'
7: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
6: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:11:in `block (3 levels) in <top (required)>'
5: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:66:in `capture'
4: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
3: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `tap'
2: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
1: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/netssh.rb:170:in `execute_command'
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/command.rb:97:in `exit_status=': ruby exit status: 127 (SSHKit::Command::Failed)
ruby stdout: Nothing written
ruby stderr: /home/ubuntu/.rvm/scripts/set: line 19: exec: ruby: not found
1: from /home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as [email protected]: ruby exit status: 127 (SSHKit::Runner::ExecuteError)
ruby stdout: Nothing written
ruby stderr: /home/ubuntu/.rvm/scripts/set: line 19: exec: ruby: not found
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: ruby exit status: 127
ruby stdout: Nothing written
ruby stderr: /home/ubuntu/.rvm/scripts/set: line 19: exec: ruby: not found
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
Caused by:
SSHKit::Command::Failed: ruby exit status: 127
ruby stdout: Nothing written
ruby stderr: /home/ubuntu/.rvm/scripts/set: line 19: exec: ruby: not found
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/command.rb:97:in `exit_status='
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/netssh.rb:170:in `execute_command'
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `tap'
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:66:in `capture'
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:11:in `block (3 levels) in <top (required)>'
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:31:in `run'
/home/ubuntu/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => rvm:check
from syncing-server.
ruby stderr: /home/ubuntu/.rvm/scripts/set: line 19: exec: ruby: not found
from syncing-server.
Hi, thanks.
It turned out I didn't have rvm. After installing rvm, I run the deploy command and I got an error:
00:06 deploy:check:linked_files
ERROR linked file ~/standard-notes-prod-server/shared/.env does not exist on 127.0.0.1
Isn't the .env file created or push automatically? I already have .env file in current path.
By the way, before I run bundle exec cap production deploy
, what dependencies do I need to install on the server? Let's say I run a new AWS instance, what do I need to install and config before I can run bundle exec cap production deploy
successfully?
from syncing-server.
You'll need dependencies close to what we have here: https://docs.standardnotes.org/self-hosting/ec2-nginx
And right, on your remote server, you'll need to create a .env file in ~/standard-notes-prod-server/shared/.env where you put your production values. These values should not be the same as what you have in your local file.
from syncing-server.
Thanks @mobitar
I've read the link you wrote but it doesn't cover the CloudLink Extension setup.
Back to this issue, after create .env
file on the server side, then I run the deploy command bundle exec cap production deploy
, I got this error:
00:38 passenger:restart
~/.rvm/bin/rvm default do passenger-config restart-app ~/standard-notes-prod-server --ignore-app-not-running
*** ERROR: Phusion Passenger doesn't seem to be running. If you are sure that it
is running, then the causes of this problem could be one of:
1. You customized the instance registry directory using Apache's
PassengerInstanceRegistryDir option, Nginx's
passenger_instance_registry_dir option, or Phusion Passenger Standalone's
--instance-registry-dir command line argument. If so, please set the
environment variable PASSENGER_INSTANCE_REGISTRY_DIR to that directory
and run this command again.
2. The instance directory has been removed by an operating system background
service. Please set a different instance registry directory using Apache's
PassengerInstanceRegistryDir option, Nginx's passenger_instance_registry_dir
option, or Phusion Passenger Standalone's --instance-registry-dir command
line argument.
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: passenger-config exit status: 1
I think I must miss some setups on the server side before I run the deploy command. Do you have any idea please?
from syncing-server.
This issue is a tricky one. It happens sometimes and I haven't found a good solution. The only thing that has worked for me before is restarting the instance. You can also ssh into the server and see the difference between running rvmsudo passenger-status
and just bare passenger-status
.
from syncing-server.
Related Issues (20)
- "Unknown Error" when connecting to raspberry pi syncing-server HOT 25
- More permissive reauthorization timeout HOT 12
- Docker container can't connect to MySQL HOT 1
- [Question] How can I see or check if Redis is working? HOT 6
- MySQL Access Denied for User Error HOT 3
- My iOS app keeps asking me for a password HOT 4
- Install Standard Notes on cPanel/WHM (CentOS 7) HOT 1
- SQL for armf error even after trying tobi321:rpi-mariadb HOT 3
- Syncing server does not build, mimemagic version error HOT 7
- Unable to run on Ubuntu server 18 using docker (enotfound "db") HOT 8
- ArgumentError upon registration request HOT 5
- HTML response for forbidden API call HOT 2
- PayloadTooLargeError: request entity too large When restoring a backup HOT 2
- Add documentation for Env files HOT 5
- Reverse Proxy does not work HOT 3
- Automate backing up Standard Notes database HOT 4
- Sync calls receiving SF|Extension items without 004 encryption applied HOT 2
- gem / mimemagic errors trying to install on Yunohost HOT 5
- Not found on localhost:3000, Registration not working HOT 2
- Too many messages logs, source is unknown HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from syncing-server.