anycable in a separate server - ruby-on-rails

I have my rails in a server A and I created a separate server where Go-lang is installed
My Goal is to use Anycable-Go with Rails but being in separated server.
I can't really find any clear explanation in google how to do that, but from the doc I tried the following in my "Go" server :
go get -u -f github.com/anycable/anycable-go/cmd/anycable-go
then
anycable-go --rpc_host=0.0.0.0:50051 --headers=cookie,x-api-token \
--redis_url=redis://{my_redis_username}:{my_redis_password}#{my_redis_machine_url} --redis_channel=anycable \
--host=0.0.0.0 --port=8084
The output looks like this :
Am really not that sure am on the right track so far... but if so, how am supposed to make my rails app connect/using this "anycable-go" server ?

You need to add anycable-rails gem to your app and run AnyCable RPC server (bundle exec anycable) along with the Rails server. See https://docs.anycable.io/#/using_with_rails

Related

Redmine plugin creation - Could not find generator 'redmine_plugin'

I run Redmine 3.4 with Rails (5.2.0) and Docker 18.03.1-ce on Ubuntu 16.04 Xenial (which is new for me), following this GitHub repository: https://github.com/sameersbn/docker-redmine
I create my Rails app in the same folder where the docker-compose.yml has been created, and cd to it.
Then I have the exact same problem than described in this Redmine post (http://www.redmine.org/boards/3/topics/48309?r=48507#message-48507): when I try the command rails generate redmine_plugin Plug_test, this two error messages appear:
Running via Spring preloader in process 32109
Could not find generator 'redmine_plugin'
So I try the commands that Keith suggested, and running the generate command again, the Spring error message disappear, but the generate command still doesn't work (Could not find generator 'redmine_plugin').
Any idea what to do? I don't know if I'm going in the right direction.
Thanks a lot for your help.
well simple problem, you're running command from outside of your redmine app directory, you need to go into your redmine app directory, after that you can run rails generate redmine_plugin Plugin_test from there
As Ravi mentioned above, you need to go into your redmine app directory instead of your rails app directory.
Or, maybe you can exec plugin generate command via docker run command.
# e.g. In case plugin name is “myplugin"
docker run --name=redmine -it --rm \
--volume=/srv/docker/redmine/redmine:/home/redmine/data \
sameersbn/redmine:3.4.4-2 \
app:rails generate redmine_plugin myplugin
If this works fine, plugin directory named “myplugin” will be generated under /srv/docker/redmine/redmine/plugins/ directory.
Personally, I think, you had batter not use docker to create and development Redmine’s plugin, especially if you are not familiar with Redmine and Docker so much.
I hope this would be any help.

open rails app from github in c9 IDE

How can I open my rails application using google cloud9 cloud service. https://ide.c9.io IDE? What steps do I need to take? I have already copied and pasted application folder in IDE but when I run "bundle exec rails server -b $IP -p $PORT" it doesn't show anything.
I have been using c9 for quite a long time.
This is how to start(assuming you already checked out the code :))..
1. open new terminal
2. run /bin/bash --login
3. rvm use 2.2.2#myapp ---if using rvm
4. sudo /etc/init.d/postgresql start -- start postgres server if using
if you still dont have rails ,install using Ruby version manager AKA rvm..its very easy.
Now run..rails s -b $IP -p $PORT.
So when you server has started successfully,hit the application on the browser using...https://<your-workspace-name>-<your username for git>.c9users.io/..
for me its like...geophotos-mike1011.c9users.io
you may also click top right button Preview ...to preview your app inside your window.
Moreover,you can customise your app setting to be public/private and many more things to do..if you are a premium user :)
Hope it helps.
When starting a new workspace, you have an option to clone from a github repository, there is a box that states Clone from Git or Mecurial URL. Simply fill in the appropriate url from your git repo, choose ruby on rails for the template, and you should be good to go.
Firstly, one of the things you need to note is to add your shh github fingerprint to c9, which will enable you to push to GitHub from c9 afterwards. c9 should put you through the necessary step.
Secondly, follow RailsCasts Tutorial on how to contribute to open source http://railscasts.com/episodes/300-contributing-to-open-source.
I think that's about all you need to make your problem solved.

Cloud9 Rails API challenge: allowed network but still cannot render console

I am following along with this Treehouse Build a Rails API course. I am using Cloud9 IDE which I think is related to the problem. The step I am stuck on is creating a new list via the API in the console.
At first I was receiving an error message saying "cannot render console" from the network. After googling this, I whitelisted the network in the development.rb file. The error message is different and so I believe I properly whitelisted it (or at least did something). But it does not have the desired effect and the error message seems to contradict itself.
Started POST "/api/lists" for 123.456.78.999 at 2015-09-14 14:53:33 +0000 Cannot render console from 123.456.78.999! Allowed networks: 123.456.78.999, 127.0.0.0/127.123.123.123, ::1
I've changed the numbers because I am not savvy about security. The point (and to me, the mystery) is that it says I can't render the console from a network that is apparently allowed (i.e., 123.456.78.999 === 123.456.78.999).
I would appreciate any advice on what could be the problem. I had no trouble following along with the tutorial until this step; the commands I entered led to the same result as in the videos.
This is the most recent command I've entered:
curl -i -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"title":"The Title will go here"}' https://myapp-me.c9.io/api/lists
Entering that URL instead of "localhost" has worked for me thus far but it could also be related to the problem.
Thank you for any clues and happy to post additional code if needed.
please add in config/enviroments/development.rb
config.web_console.whitelisted_ips = '0.0.0.0/0.0.0.0'
To whitelists 2 IPs > Consider this example:
config.web_console.whitelisted_ips = %w( 127.0.0.1 10.0.0.9 )
To whitelist an entire IP subnet > Consider this example:
config.web_console.whitelisted_ips = %w( 127.0.0.1 10.0.0.0/24 )
always add 127.0.0.1, or else the local machine won't have access.
If anyone is still viewing this question in 2022 like I am, then you can edit config/environments/development.rb to account for the entire private network like so:
Rails.application.configure do
.
.
.
config.web_console.permissions = '123.456.78.0/16'
end
More information here.
Part of the problem is that you need to be within the "sudo su" shell in order to run Ruby on Rails applications. So, make sure that you run sudo su and you become root. The second problem is that you MUST run your application on port 8080 so when you run the server make sure the -p 8080 flag is set:
bundle update (optional)
bundle install (optional)
sudo su
rails s -p 8080
New terminal --> Preview --> Preview running application

Connect to heroku apps mongodb (compose) on terminal

I have inherited a Ruby on rails app, which runs on Heroku and has a compose mongoDB. To be clear I have never used ruby, mongo or Heroku and its been a massive learning curve.
I essentially want to get a copy running locally, but more importantly I want to pull down and export the data that is in the db at the moment.
I have installed the latest version of Heroku Toolbelt and I have installed the latest version on mongodb, which also included all 4 packages. Im running this locally on Ubuntu 14 lts.
The documentation I do have says to run this command to log into the db
mongodb://heroku:password-string#tempest.mongohq.com:10098/appid
But if I run just the above it says no such file or directory, if I add 'mongo' onto the beginning then it seems to work but throws the following error
E QUERY Error: More than one ':' detected. If this is an ipv6 address, it needs to be surrounded by '[' and ']'; heroku:password-string#tempest.mongohq.com:10098
I did try running it wrapped in [] too.
This is just getting in so I can then export the data locally and then try to look at it.
The command-line mongo tool doesn't understand URLs, so try this instead:
mongo -u heroku -p password-string tempest.mongohq.com:10098/appid
Also I'm pretty sure you can leave off the -p password-string and it will prompt you for it, so you can avoid revealing it in ps output etc.

Making Fedena a Windows Service Failed

I successfully installed Fedena on Windows using this tutorial:
http://en.wikibooks.org/wiki/Fedena/Installation
The problem is that each time I start windows, I need to run the command ruby script/server so that I can access the project locally. I tried making Fedena a Windows Service that starts automatically by following the steps mentioned in the tutorial, but it seems that it didn't work.
Making a Windows Service
If you want to run Fedena as a Windows Service (which automatically starts), do the following commands:
Open the Ruby Command prompt and go to your Fedena Installation director //do they mean by this C:/Fedena?
Install a Gem:
gem install win32-service
Install a Gem:
gem install mongrel_service
Run the command:
mongrel_rails service::install -N Fedena -c C:\FEDENA -p 3001 -e production
(Replace C:\FEDENA with whatever your Fedena installation Directory is.) You may also wish to change the port from 3001 to 80 so when entering the address from other computers, it is not required that you enter a port.
Go to windows search at the start menu, type:
services.msc
Look for service named 'Fedena' and set it to automatic
Restart your computer and see if the fedena start automatically. Always make sure that your server is running.
Any ideas what could be the problem?
Right after Fedena is configured, the start of the application is via console which should stay open for all the times if we want the application to be up and running. But quite often will get closed (human error, server down etc) and the application will go down.
The same applies if the server is rebooted/bounced and all over again.
So here is the solution if you don't want to go over this hassle:
Download http://nssm.cc/download/?page=download
Unpack it (lets say C:\NSSM)
Create a batch file ( lets say C:\Fedena\StartFedena.bat)
Edit the batch file ( right click on the bat file and click Edit)
Past the following code (change the paths accordingly)
********************************** (without the stars and this comment)
cd \
cd Fedena
mongrel_rails start -e production
Note: If you want to start it as development mode remove -e production from the last line
Open CMD
Type cd\
Type cd NSSM
depending on the system type: "cd win32" ot "cd win64"
9.Type in the cmd : "nssm install"
A modal window will pop-up
Click Browse
Navigate to the location where the batch file is and select it;
Leave options empty
Service name "Fedena"
Install Service
Go to "Services" (usually under Control Panel\System and Security\Administrative Tools)
Start Services
You should find service named "Fedena"
Start Service
Navigate to http://example.com:3000 and Fedena should be up
The service should be already set as automatic so if the server is restarted Fedena will come up automatically.
If you need to bounce the application just restart the Fedena Service.
That is,
Thank you

Resources