Giter Site home page Giter Site logo

emailthis / ansible-rails Goto Github PK

View Code? Open in Web Editor NEW
223.0 223.0 16.0 107 KB

Ruby on Rails deployment using Ansible - with Lets Encrypt, Sidekiq, PostgreSQL, nginx & puma

Home Page: https://www.emailthis.me

Shell 100.00%
ansible automation deployment letsencrypt nginx nodejs puma rails ruby sidekiq webpacker

ansible-rails's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-rails's Issues

certbot does not work

certbot is issuing a standalone cert, but not linked to nginx?

did you ever get this working?

vault_pass was not found

Hi,

When I try to run the ansible with vagrant it says .vault_pass file was not found.
I am new to ansible can you please help with this.
image

Thanks

Where to find "app-vars.yml"?

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?

puma.service.j2 template gives wrong command line for stopping Puma

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.

production database.yml not linked?

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!

Add swap configuration

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.

How do you handle multiple configurations/apps?

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

Task freezes at "Update remote repository using SSH key"

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.

Missing Vars in deploy.yml playbook

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!

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.