SmartMachine
Git push should deploy.
SmartMachine is a full-stack deployment framework for rails optimized for admin programmer happiness and peaceful administration. It encourages natural simplicity by favoring convention over configuration.
Before you begin, you should install ruby on your system.
Deploy your Rails apps to your own server with - git push production main
How does it help?
After you run the below commands, you get.
- Setup of basic best practices of setting up and securing a VPS server.
- Setup and installation of Docker.
- Setup and installation of docker based Mysql, Solr, Nginx, App Prereceiver.
- Deployment of your Rails apps to your own server with - git push production main
Prerequisites
If using SmartMachine on a server, perform the below steps before proceeding.
Ensure that you have debian LTS installed on the server. Running the below command should say some latest version of debian LTS.
$ cat /etc/issue
Then complete, getting started with linode.
https://www.linode.com/docs/getting-started/
And then secure your server.
https://www.linode.com/docs/security/securing-your-server/
Installation
Install SmartMachine at the command prompt:
$ gem install smartmachine
Then create a new machine and move into it:
$ smartmachine new yourmachinename
$ cd yourmachinename
here "yourmachinename" is the machine name you can choose
Add your credentials using:
$ smartmachine credentials:edit
Add your config details with your favourite editor (here emacs is shown):
$ emacs ./config
Install docker, and add UFW rules for Docker if specified at the end of installation.
$ smartmachine docker install
Install the engine and buildpacker:
$ smartmachine engine install
$ smartmachine buildpacker install rails
Usage
Setup your Network
$ smartmachine machine network up
$ smartmachine machine network down
Choose Your Grids
Choose only the grids you need. You can start or stop a grid at anytime using up or down commands respectively.
1. Nginx Grid
Lets you run a nginx web server fully equipped with https encryption using letsencrypt.
$ smartmachine grid nginx up
$ smartmachine grid nginx down
2. Prereceiver Grid
Lets you push rails apps to your server without any additional configuration or downtime using git push production main.
$ smartmachine grid prereceiver install
$ smartmachine grid prereceiver up
$ smartmachine grid prereceiver down
$ smartmachine grid prereceiver uninstall
3. Mysql Grid
Lets you run a mysql server instance with as many databases as you need.
$ smartmachine grid mysql up
$ smartmachine grid mysql down
4. Minio Grid
Lets you run minio server instance with file storage persistance.
$ smartmachine grid minio up
$ smartmachine grid minio down
5. Elasticsearch Grid
Lets you run elasticsearch server instance with data persistance.
$ smartmachine grid elasticsearch up
$ smartmachine grid elasticsearch down
4. Redis Grid
Lets you run redis server instance for cache storage and job queueing.
$ smartmachine grid redis up
$ smartmachine grid redis down
Setup Your Apps
Create your apps and manage them.
1. New App on the server
Lets you create a new bare app on the server.
$ smartmachine app create <APPNAME> <APPDOMAIN> <USERNAME>
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/plainsource/smartmachine. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the AGPL License.
Code of Conduct
Everyone interacting in the SmartMachine project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.