ROD is like a rocket that brings you from ground (scratch) to the space (Kubernetes).
Before start, please check out if you have Docker (version 20.10.12 or later), minikube, and Python (3.6.8 or later) installed on your computer.
git clone git@github.com:wxw-matt/rails_on_docker.git ~/rod
cd ~/rod
# Install dependencies for rod
pip install -r requirements.txt
./rod project new -v 7 -s first_rod
cd first_rod
./rod g scaffold post title:string content:text
./rod deploy k8s
./rod deploy service
After the previous command performs successfully, you would see the following output:
service/first-rod created
Service is listening at address http://localhost:port
The port varies with each deployment.
http://localhost:port/posts
Any operating systems that can run Docker (version 20.10.12 or later).
git clone git@github.com:wxw-matt/rails_on_docker.git ~/rod
cd ~/rod
# Install dependencies for rod
pip install -r requirements.txt
The following command will Create a new project named t1
based on Rails 7
and using MySQL
as the database.
./rod project new t1 -v 7 -m
project new
is for creating projects.
-v
or --version
is for specifying the version of Rails.
Either a complete version, like 7.0.1
, or a major version 7
works.
If a major version is given, the latest major version will be used to create the project.
-m
or --mysql
is to select MySQL.
-p
or --pg
is to select Postgresql.
-s
or --sqlite3
is to select sqlite3.
The docker image for the new image will be created as well.
Generate a scaffold:
./rod g scaffold post title:string content:text
Or
./rod generate scaffold post title:string content:text
Generate a controller
./rod g controller article index new create
Generate a model
./rod g model comment title:string content:text
All tasks that can be executed by rails
command are supported.
For example: you can execute the tasks db:migrate
and db:seed
by the following command:
./rod tasks db:migrate db:seed
tools/build_multiplatform.sh full_tag Dockerfile
For example:
tools/build_multiplatform.sh wxwmatt/rails:7.0.2.2-alpine3.15 rails7/Dockerfile.rails7.0.2.2