Git Product home page Git Product logo

Comments (4)

metaskills avatar metaskills commented on June 19, 2024

How can I build an api-only app instead of a full rails app?

You sure can! I would recommend you go two different routes.

  1. Go thru the bootstrap process in full. Then make changes to your app to be API only. What are those changes? Typically a few lines to the application.rb, Gemfile, and the root controller.
  2. You can make a change as you said to the bin/_rails-new file by adding --api. Then do a bin/build and commit that to your own fork/branch. I did just that and made a pull request with the change so technically you can use this branch too. Hope that outlines the process or the manual files you have to change if #1 is what you choose.

but got errors in aws about the gems not being found after deployment. So I'm not sure what is the best way to proceed

I think above will help but if needed you must share the errors. Cant help unless I know what they are. Cheers!

from lamby-cookiecutter.

cimtico avatar cimtico commented on June 19, 2024

Thanks for your reply.
I just ran through a new install following the steps in the readme (trying to just get something working and try to do precisely what you mentioned). However, with the "clean" install I get these errors:

2020-10-22T17:38:57.599-06:00 Init error when loading handler app.handler
  2020-10-22T17:38:57.599-06:00Copy{ "errorMessage": "Could not find public_suffix-4.0.6 in any of the sources", "errorType": "InitBundler::GemNotFound", "stackTrace": [ "/var/runtime/gems/bundler-2.1.4/lib/bundler/spec_set.rb:86:in block in materialize'", "/var/runtime/gems/bundler-2.1.4/lib/bundler/spec_set.rb:80:in map!'", "/var/runtime/gems/bundler-2.1.4/lib/bundler/spec_set.rb:80:in materialize'", "/var/runtime/gems/bundler-2.1.4/lib/bundler/definition.rb:170:in specs'", "/var/runtime/gems/bundler-2.1.4/lib/bundler/definition.rb:237:in specs_for'", "/var/runtime/gems/bundler-2.1.4/lib/bundler/definition.rb:226:in requested_specs'", "/var/runtime/gems/bundler-2.1.4/lib/bundler/runtime.rb:101:in block in definition_method'", "/var/runtime/gems/bundler-2.1.4/lib/bundler/runtime.rb:20:in setup'", "/var/runtime/gems/bundler-2.1.4/lib/bundler.rb:149:in setup'", "/var/runtime/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in block in <top (required)>'", "/var/runtime/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:136:in with_level'", "/var/runtime/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:88:in silence'", "/var/runtime/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in <top (required)>'", "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in require'", "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in require'", "/var/task/config/boot.rb:3:in <top (required)>'", "/var/task/app.rb:2:in require_relative'", "/var/task/app.rb:2:in <top (required)>'", "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in require'", "/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in require'" ] }

It seems to me it that for some reason it is trying to load the "dev" dependencies instead of the prod-only ones.
Have you encountered anything like this before? I feel it might just be a bad config somewhere.

from lamby-cookiecutter.

cimtico avatar cimtico commented on June 19, 2024

Interesting. It seems I get those errors when I use a container I built with the "newer" sam that is installed through "brew". Using your docker-compose and docker setup seems to get past those errors. However, I get an error about Missing `secret_key_base` for 'production' environment,... eventhough the master.key file is there, and the key is registered in SSM.

from lamby-cookiecutter.

metaskills avatar metaskills commented on June 19, 2024

Well, when you deploy to production the config/master.key should not be in the deployed package (https://github.com/customink/lamby-cookiecutter/blob/master/%7B%7Bcookiecutter.project_name%7D%7D/bin/build-rails#L46) it should be written to the .env.production file in the package (see line 19-24) further up from that same link. You could download the package from S3, change the suffix to .gz and check to make sure. Likewise to confirm that bin/deploy is doing as expected you can run ./bin/run bash and that the aws ssm get-parameter ... on Line 19 works as expected. Another method is to check the build artifact directory in .aws-sam director.

from lamby-cookiecutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.