Order of starting a new docker on Chinese Server with ROR:
- Create a new ROR(replace name in local, exec command on server)
- git clone https://github.com/berxtjkl/dockerizeRORPrerequisitePlusOrders.git to local.
- create a repo on git, and replace the "auctionGift" with repo's "name" of all command.sh files in local and remember to increment port with 1 in docker-compose.yml and then push it to git.(应该是有十一个地方四个文件需要替换)(port自增只需要修改docker-compose.yml里面就可以了)
- go to server side's dockerizeRORPrerequisitePlusOrders/ folder and exec pull, then back to .. directory.
- execute dockerizeRORPrerequisitePlusOrders/command1.sh
- cd /usr/src/app/
- execute dockerizeRORPrerequisitePlusOrders/command2.sh and exit temp container
- execute dockerizeRORPrerequisitePlusOrders/command3.sh(move below files/folder to specific path)
- .env/ (folder)
- .gitignore
- Dockerfile
- docker-compose.yml
- docker-entrypoint.sh
- !!execute dockerizeRORPrerequisitePlusOrders/command4.sh(remember to set all relative ports increment+1 in docker-compose.yml depends on your server side that how many docker is running)
- make sure there is only one DockerizeROR running, because port is not dynamic
- when run command4.sh sometimes the chinese mirror would fail nokogiri gem, just try original mirrow.
- now you can access ip:30xx to check whether it is okay
- If you are accessing the dev env, then you need to config DNS configuration like this:
- file path:
- /config/environments/development.rb
- need code:
- config.hosts << "hmyse.top"
- file path:
- If you are accessing the dev env, then you need to config DNS configuration like this:
- git push new create app to repo, and you can clone it to everywhere.
- about the order of first time push to git
- git remote add origin https://github.com/berxtjkl/auctionGift.git &&
git add . &&
git commit -m "first time upload." &&
git push -u origin master &&
git push
- git remote add origin https://github.com/berxtjkl/auctionGift.git &&
- when you clone it to your local maybe you need to run below commands:
- docker-compose run web yarn install &&
docker-compose run web yarn install --check-files &&
docker-compose run web bin/rails webpacker:install
- docker-compose run web yarn install &&
- about the order of first time push to git
PS额外信息:
本地的bundle install很慢
- Using an existence ROR
- locate at the root folder, where you are going to copy an app here
- cp -r source_app destination_app (here the name is just an example, youcan cp your source_app here or just use you source_app as destination_app, it is totally up to you.)
- copy app folder here, only 1 folder(now you can understand what will be put here.)
- git clone https://github.com/berxtjkl/dockerizeRORPrerequisitePlusOrders.git
- then get into dockerizeRORPrerequisitePlusOrders folder
- put below files into your application folder by execute this [cp -r .env .gitignore docker-compose.yml docker-entrypoint.sh Dockerfile ../destination_app/]
- .env/ (folder)
- .gitignore
- Dockerfile
- docker-compose.yml
- docker-entrypoint.sh
- sudo chmod 666 destination_app/ (optional)
- Get into your destination_app folder and execute [docker-compose build]
- make sure there is only one DockerizeROR running, because port is not dynamic
- docker-compose run web yarn install
- docker-compose run web bundle install
- have no idea why I have to run bundle install here.....
- docker-compose run web bin/rails webpacker:install
- please make sure whether you are going to click y to overwrite some webpacker files
- docker-compose run web bin/rails webpacker:install:react
- docker-compose up -d
- now you can access ip:3000 to check whether it is okay