Created
November 30, 2023 22:06
-
-
Save tlehman/2693c0f632515e17bf32333a889b6da6 to your computer and use it in GitHub Desktop.
blog catalog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node 'your-blog-name' { | |
# Ensure the required packages are installed | |
package { ['nginx', 'ruby', 'rails']: | |
ensure => installed, | |
} | |
# Configure Nginx to listen on port 80 and proxy to port 3000 | |
file { '/etc/nginx/sites-available/default': | |
ensure => file, | |
content => template('modulename/nginx.conf.erb'), | |
require => Package['nginx'], | |
notify => Service['nginx'], | |
} | |
# Ensure Nginx service is running and enabled | |
service { 'nginx': | |
ensure => running, | |
enable => true, | |
} | |
# Define a systemd service for the Rails app | |
file { '/etc/systemd/system/railsapp.service': | |
ensure => file, | |
content => template('modulename/railsapp.service.erb'), | |
notify => Service['railsapp'], | |
} | |
# Ensure the Rails app service is running and enabled | |
service { 'railsapp': | |
ensure => running, | |
enable => true, | |
require => File['/etc/systemd/system/railsapp.service'], | |
} | |
# Fetch and add SSH public keys from GitHub | |
exec { 'fetch_ssh_keys': | |
command => "curl https://github.com/tlehman.keys >> /home/your_user/.ssh/authorized_keys", | |
path => ['/bin', '/usr/bin'], | |
unless => "grep -Fq 'tlehman' /home/your_user/.ssh/authorized_keys", | |
require => Package['curl'], | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment