emailthis / ansible-rails Goto Github PK
View Code? Open in Web Editor NEWRuby on Rails deployment using Ansible - with Lets Encrypt, Sidekiq, PostgreSQL, nginx & puma
Home Page: https://www.emailthis.me
Ruby on Rails deployment using Ansible - with Lets Encrypt, Sidekiq, PostgreSQL, nginx & puma
Home Page: https://www.emailthis.me
certbot is issuing a standalone cert, but not linked to nginx?
did you ever get this working?
Hi! Great project!
Thank you for sharing this. I'm eager to test.
I have a question: in step 2 says
"Step 2. Configuration
Open app-vars.yml and change the following variables..."
But I can't find the app-vars.yml
file in the project.
Does it have another name?
Hi! In puma.service.j2, there is the following line:
ExecStop={{ rbenv_bundle }} exec puma -S {{ app_current_path }}/config/puma.rb
However, that will actually cause the puma config file to be overwritten by a Puma YML state file, and won't stop Puma.
You may have meant to start Puma with the -S parameter to create a state file, then use that state file to stop Puma later using pumactl? Here's what I'm currently using:
ExecStart={{ rbenv_bundle }} exec puma -C {{ app_shared_path }}/config/puma.rb --control-url unix://{{ puma_control_socket }} --control-token {{ puma_control_token }} -S {{ puma_state_file }}
ExecStop={{ rbenv_bundle }} exec pumactl -S {{ puma_state_file }} stop
Note that for this you'd need to define a Puma control socket and token and a statefile location (I make a new Ansistrano shared dir for it), plus I'm using a generated shared config/puma.rb. So you can't just drop this in. But this approach can work if you feel like using it, or you could do something simpler with killing the PID.
I'm curious how config/database.yml gets linked into production?
shared_files_to_copy
copies it into the shared folder, but the production app doesn't find it?
am I missing something?
Thanks!
Hey Bharani, first of all, thank you for doing and sharing this. I've been looking for some time to look into Ansible for deploying Rails apps and this will surely be useful ๐
In the past I used a very rough server.txt
file with all things to run on a new server (who didn't? ๐), and one of the things I've always set is some small swap file & swappiness in order to allow the system to not crash when under heavy load for a short amount of time.
Do you think it'd be useful to add as an extra configuration?
You may also want to chime in in the recent Rails discussion about deployments if you didn't see it yet.
Hey there,
Thanks a tonne for opening this up to everyone.
I'm wondering if you've ever considered using these playbooks to manage multiple configurations/apps? With some tweaking to the directory structure we could use group_vars
and inventories together to manage multiple configurations.
This is the out-of-box directory structure today:
.
โโโ app-vars.yml
โโโ group_vars
โย ย โโโ all
โย ย โย ย โโโ vault.yml
โโโ inventories
โย ย โโโ development.ini
This is what the out-of-box directory structure could be changed to:
.
โโโ README.md
โโโ app.ini
โโโ group_vars
โย ย โโโ app
โย ย โย ย โโโ vars
โย ย โย ย โย ย โโโ main.yml
โย ย โย ย โโโ vaults
โย ย โย ย โย ย โโโ main.yml
And this is what it would look like if we added multiple configurations side-by-side:
.
โโโ README.md
โโโ app.ini
โโโ another_app1.ini
โโโ another_app2.ini
โโโ group_vars
โย ย โโโ app
โย ย โย ย โโโ vars
โย ย โย ย โย ย โโโ main.yml
โย ย โย ย โโโ vaults
โย ย โย ย โย ย โโโ main.yml
โย ย โโโ another_app_1
โย ย โโโ vars
โย ย โย ย โย ย โโโ main.yml
โย ย โย ย โโโ vaults
โย ย โย ย โย ย โโโ main.yml
โย ย โโโ another_app_2
โย ย โโโ vars
โย ย โย ย โย ย โโโ main.yml
โย ย โย ย โโโ vaults
โย ย โย ย โย ย โโโ main.yml
With the above tweaks we would preserve the out-of-box experience experience you get today when you do vagrant up
. We would also preserve the first-time experience of customising the variables to get immediate feedback as you're learning. But, now we can have multiple configurations side-by-side with each one isolated to its own variables and inventory files.
The big advantage of this is now I can clone the repo, dup the configuration, and configure my own app. As the playbooks are updated I can do a git pull
and diff against master to work out what's changed. This is what I'm most excited about. To share the maintenance of the playbooks.
I've already made the above changes on my machine and it's working nicely. Would you consider accepting a patch if I opened up a PR?
Cheers,
Tate
When deploying, everything works well until it reaches TASK [ansistrano.deploy : ANSISTRANO | GIT | Update remote repository using SSH key]
, where it freezes for as long as it can without exiting, even with an error.
I have regenerated keys without passphrases and added them to my private repo under deploy keys
.
I have also added the private keys to ssh-agent and added this to my ansible.cfg
[ssh_connection] ssh_args = -o ForwardAgent=yes
It still won't work. please direct me?
I am suspecting the issue to be that the remote host cannot pull my private repository because it doesn't have the private keys, but at this point I do not why the solutions above do not work. (haven't tried manually copying the keys)
PS: I have two keys, a .pem
key for accessing the server, and an id_rsa
private key with it's public key added to Github.
Hi there,
thanks for the nice project. I tried to provision and deploy an app with these playbooks. I ran into an error in the deploy.yml
playbook, the variables used are not set in it.
I could easily fix it by adding
vars_files:
- app-vars.yml
analogously to the provision playbook.
I don't know if I made an error in the first place and this just fixed that, but if the vars are actually missing, I guess it would be a good idea to add the two lines to deploy.yml
?
Best regards and Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.