Activity
Alex, you were onto something with the cluster_uuid. I found out that you can find more information by running curl http://localhost:9200/_cluster/health
instead.
That pointed out "master_not_discovered_exception" so it's a configuration issue that the ES server is not seeing itself as a master in the cluster.
Looks like production mode expects multiple servers now, but we can get around that by adding discovery.type: single-node
and that should fix it. I'll go update the Hatchbox configs for that.
ElasticSearch is really picky about RAM I've noticed. If it doesn't have enough it can fail to start and it needs 4GB RAM to itself minimum. A 4GB of RAM server won't suffice for it, so you've got to go with 8GB if you also want to run Rails on the same server, and even then you have to keep an eye on it.
This is where a managed ElasticSearch is definitely worth the money. You have to worry about none of these details and can just use it. 👍
Hey Alex,
Good catch on the cluster_uuid. That does seem strange and maybe a recent version of ElasticSearch has broken my config changes. I'll do some research and see what I find.
Getting a response from ElasticSearch fooled me into thinking that everything was running just fine but maybe it gives a Service Unavailable error if it is running but doesn't have a cluster active / connected or something. I'm not super familiar with ES and it seems to have changed a bit recently.
Hey Alex,
Not sure it's related to this specific thing, but Jumpstart Pro uses PurgeCSS in production and staging to strip out any unused CSS to make the files as fast as possible. If you didn't have the class referenced in the locations it looks, it can strip out the class on accident when compiling.
You can tweak the whitelist for that in postcss.config.js in the repo and add your own classes to the whitelists so they don't get ignored. It also supports regex so you can use that to whitelist a set of classes too.
Posted in Shrine Dynamic s3
That'd be a good question for Janko on the Shrine GitHub. I think that should be doable, but he would know how to do that best.
I believe you would just create the S3 storage instance each time you upload, rather than once in the initializer.
s3 = Shrine::Storage::S3.new(
bucket: "my-app", # required
region: "eu-west-1", # required
access_key_id: "abc",
secret_access_key: "xyz",
)
The above you would configure with the tenant's credentials and then you can probably call the upload method directly on this. He'll know best though!
If you're using Searchkick, try adding this:
Searchkick.client.transport.logger = Logger.new(STDOUT) # or Rails.logger
Found that after a quick search on the issues.
Sounds like the same thing as before. Have you gotten any logging enabled to see what URL it's requesting yet?
Posted in Active Storage and Subdomains
Ah, that'll get you! Good idea about adding that. It's pretty common, either that or one of the alternatives like libvips that's supposed to be faster.
Check that your code is configured to use the ENV var. Enable logging for faraday, etc to see what request its making.
If you set it up with Hatchbox, then it will do all that for you.
I SSHed into your server and confirmed Hatchbox setup everything correctly.
curl http://10.138.104.120:9200
{
"name" : "living-recipe-elasticsearch",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "_na_",
"version" : {
"number" : "7.5.1",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "3ae9ac9a93c95bd0cdc054951cf95d88e1e18d96",
"build_date" : "2019-12-16T22:57:37.835892Z",
"build_snapshot" : false,
"lucene_version" : "8.3.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
Sounds like your code is misconfigured. Make sure that it's loading from the ENV var.
You said you logged into the ElasticSearch server and tested it, but if Rails is running on another server, you have to make sure ElasticSearch is attached available externally. You'll have to make sure it's binding to an IP and allowed through your firewall.
Posted in Hatchbox deployment questions
Nice, so just fix your active storage config and try again. 👍
Posted in Hatchbox deployment questions
Have you checked the NGINX logs to see what the error is booting your app?
Posted in Hatchbox deployment questions
👍
Posted in Hatchbox deployment questions
Make sure the node module is in your package.json as a full dependency, not dev dependencies.
Posted in Hatchbox deployment questions
Posted in Hatchbox deployment questions
Actually it's the contents of credentials key file.
Posted in Hatchbox deployment questions
Did you forget to add your RAILS_MASTER_KEY env var? That's usually what people forget.
Posted in Hatchbox deployment questions
Like I mentioned, you just need to set the ENV var. You don't have to update the database.yml because the env var will override it.
Posted in Hatchbox deployment questions
Just set the DATABASE_URL env var to point to your database. That's it!