Hours
Hours copied to clipboard
Dockerfile of LXC/ansible etc possible?
I'd really love a dockerfile for this setup, for an easy quick set-up ( or at least: an easy quick development environment).
Would it be possible for you to add one? I got stuck in dependency-hell when trying from scratch, and I assume that you'd have an easier time creating one :)
A different solution would be of course to do something with plain LXC, maybe using an ansible playbook to set up the enviroment?
@fatboypunk didn't you try this already?
Haven't done it yet
But you're working on it?
@NanneHuiges we'd happily welcome such a contribution, so far we've been hosting this on heroku so it hasn't been an issue for us.
@jurre :) I'd love to help, but my first attempt wasn't too succesfull: I'm not a big ruby adept and had a lot of fun installing dependencies of dependencies to install packagemanagers for packagemenagers and the likes.
i'll check it out later, the setup-script should be able to do all the heavy loading once all dependencies are up. Is the dependency-list on the readme complete? I'd have to translate that list into a quick list of unattended ubuntu commands. If you could help me with that I can take that and check a simple POC for a container. Once that works I could see about some sort of playbook?
@NanneHuiges yes I think it's up to date, if you run into any specific issues feel free to ask here!
For a nice docker setup I would have to know all the ins-and-outs of the project, so all services could run their own container. I'm just not up-to-date enough for that at the moment. I'll see if I can get a quick thing to get a (Development/test?) system up and running in one container, possibly just lxc.
To have a real nice system you'd want to have several containers, e.g. the postgress separate, etc obviously but I don't see myself doing that quickly tbh.
some specific questions:
- Where does the setup get its database details? (hmm, nevermind, I didn't define a role in psql)
- I'm building a quick list of all dependencies from an empty ubuntu, all the way up to the foreman command. What is the preferred way from there? do you have a quick nginx setup for me that can point to that foreman port? not sure what the quickest way to get something going from that last part is.
Look in the wiki for additional info on nginx setup https://github.com/DefactoSoftware/Hours/wiki/Configuring-nginx-to-work-with-subdomains
ah check. I can also just point to the :7000 port on the container I guess? I'd work towards a solution where you don't need to edit the hosts file, but that might be tricky without bind9 or something. first figure out the issue with javascript executables. I suspect there's a dependency missing
it seems node.js (or any other listed at https://github.com/sstephenson/execjs I guess) is a hidden dependency :)
Next one is more tricky:
Launchy::CommandNotFoundError in AccountsController#create Unable to find a browser command.
any clue?
trace from the error page is
app/models/signup.rb:23:in `block in save'
app/models/signup.rb:22:in `save'
app/controllers/accounts_controller.rb:14:in `create'
Maybe you're running in development mode and it's trying to open the emails with letter opener?
Sounds like it. Again, I'm not a ruby person, so I'm just trying to follow the stuff from the readme. Didn't change anything in ways of modes or stuff. Kinda why I am getting stuck all the time making a playbook for this project.
so I have to get it out of development mode before I start it?
Yep, you can set an env variable RAILS_ENV=production && RACK_ENV=production
sorry to keep bugging you, but I'm not getting it up in production mode. I did add a production line to the databases.yml
and changed my .env
, but how do I populate the production database? that seems to ben an issue. Also, I seem to have to add some SMTP configs to the enviroment? I installed a postfix mailer on the machine, but it uses its own mailer?
No problem. You'll have to load the database schema in order to get all the tables and such, to do so you can run: rake db:schema:load
from the root of the project. For mail we've been using Sendgrid, it is configured via environment variables:
SENDGRID_PASSWORD=your_password
SENDGRID_USERNAME=your_sendgrid_username
SMTP_ADDRESS=smtp.sendgrid.net
SMTP_DOMAIN=the domain you're hosting on
SMTP_PASSWORD=your_sendgrid_pass
SMTP_USERNAME=your_sendgrid_username
If you'd like to use your own postfix server you'd have to configure rails to do so, right now there's no support for it, but you can find more info here: http://edgeguides.rubyonrails.org/action_mailer_basics.html. I'd recommend using something like sendgrid, mandrill or mailgun though.
hmmpfs. Still struggling. I am building a "comprehensive" list of commands to execute to get to a running production environment; I want to use that as a start to building an ansible playbook; sadly my lack of ruby apps/foreman/whatever experience is killing me :)
Current progress: I added those variables to the .env
file and used a quick export to set them as variables.
i've run the db:schema:load
and now the foreman does start in production mode, but sadly the same trick I could use to connect to the development enviroment doens't work anymore: my connection is refused. Now I'm thinking maybe production runs differently? a different port, maybe? Not really sure sadly. It could be just a step I missed.
You don't have a quick "this is how you start in production mode" howto lying around with all commands needed to be run beforehand, do you? I suppose this all is obvious for you :D
Anyway, i'll look at it again tomorrow. A simple playbook shouldn't be this hard ;)
Yeah we run this app on Heroku, so it's just a matter of pushing it to heroku, the app.json file sets up the dependencies there.
There is a 'simple' heroku-to-docker script floating around, but that just pushes your dependencies one level up ;)
(also, it generates a docker build, not a dockerfile, so you need to re-run the builder instead of having something to work from after one run :( )
Btw, I think rails in production runs on port 3000 by default