Our web application development environment is built on ** Docker container **.
The container that runs rails named web and the container that runs MySQL called db are launched at the same time with docker-compose up
.
--Easy and fast environment construction --Easy to share and unify the environment --Avoid dependence on the local environment --You can immediately build the same environment on the server at the time of release --Lower memory consumption than traditional virtualization technology
For the above reasons, I use Docker.
Ruby2.5.3 Rails5.2.2 MySQL5.7
git clone
to your local PC.docker-compose up
docker-compose exec web rails db:create
docker-compose exec web rails db:migrate
--From the second time, only docker-compose up
--Reference page: Introduction to monkey teacher's git
$ git checkout -b Branch name to create
Or
$git branch The name of the branch to create
$git branch Created branch name
But yes
Make a branch with. The branch name that you can see what you are doing is good
$ git init
$ git add (file name)Or git add.
$ git commit -m "comment"
$git push origin branch name
After pushing, a yellow bar will appear on github. If you want to reflect it in master, press Compare & pull request
Remote branch list display
$ git branch -r
$ git fetch
Update your local branch to the latest
$ git pull origin REMOT_BRANCH_NAME:LOCAL_BRANCH_NAME
docker-compose up
.--The server did not shut down properly the last time you shut down docker
--Reference article: https://qiita.com/JUNO-LEARN/items/d7b49f130b62f0740a1c
--Try deleting tmp / pids / server.pid
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b9abd4473fd9 watch_project_web "rails s -p 3000 -b …" 28 hours ago Up 28 hours 0.0.0.0:3000->3000/tcp watch_project_web_1
d55c5240d70d mysql:5.7 "docker-entrypoint.s…" 28 hours ago Up 28 hours 0.0.0.0:3306->3306/tcp, 33060/tcp watch_project_db_1
Check the running container ID with
$ docker exec -it {Container name} bash
docker-compose exec db mysql -uroot -p
docker-compose exec web rails 〜〜
You can also enter a container called web and use commands directly like rails ~ ~
.
Recommended Posts