chore: init commit
in worker.../repo/GITFOLDER.zip is the .git folder.
This commit is contained in:
35
worker-toolkit-stocks-in-the-future/repo/docker/README.md
Normal file
35
worker-toolkit-stocks-in-the-future/repo/docker/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Easy Docker Scripts
|
||||
|
||||
These scripts are provided to make it easy to execute routine tasks in Docker. Unless stated otherwise, these scripts are meant to be executed from the root directory of this repository. For example, entering `docker build` runs the initial build script.
|
||||
|
||||
## Initial Build Script
|
||||
* You MUST execute the initial build script before you can do anything else.
|
||||
* After you use the `git clone` command to download this repository, use the `cd` command to enter the root directory of this repository.
|
||||
* Enter the command `docker/build` to run the initial build script. This automatically provides the config/database.yml file and runs the `docker compose up` command.
|
||||
* When the build process is complete, you will be able to view the app in your web browser at http://localhost:3000/ .
|
||||
* You will NOT be able to execute other commands from the shell tab that's running the local Rails server. Instead, you MUST start a new tab or window, use the `cd` command to enter the root directory of this repository (if necessary), and enter the commands there.
|
||||
|
||||
## Testing the App
|
||||
* Enter the command `docker/test`.
|
||||
* To see accurate test coverage results, enter the command `docker/test-cov`. Because SimpleCov misses test coverage when parallel workers are used, this script disables the parallel workers feature in order to provide accurate test coverage results.
|
||||
|
||||
## Seeding Data
|
||||
Enter the command `docker/seed`.
|
||||
|
||||
## Bash Shell
|
||||
Enter the command `docker/bash` to enter a Bash shell within the Docker container. This allows you to enter commands from directly within the Docker container. Commands like `bundle install`, `rails db:migrate`, and `rails test` will work here.
|
||||
|
||||
## Sandbox
|
||||
Enter the command `docker/sandbox` to enter the Rails sandbox within the Docker container.
|
||||
|
||||
## RuboCop
|
||||
Enter the command `docker/cop` to run RuboCop.
|
||||
|
||||
## Git Check
|
||||
Enter the command `docker/git-check` to test this app AND run RuboCop. It's a convenient way to cover all your bases in just ONE step when you believe that you're ready to use the git add/commit/push commands.
|
||||
|
||||
## Nuking the Docker Environment
|
||||
* Enter the command `docker/nuke` to remove all Docker containers and images on your local machine.
|
||||
* After you've nuked your Docker environment, you'll have to use the initial build script (`docker/build`) again to set up this app.
|
||||
* Nuking the Docker environment is handy if you think you accidentally messed up your development environment. While this is a rare event, it's a good option to have when troubleshooting.
|
||||
* Nuking the Docker environment was handy for making sure that these scripts work as intended.
|
||||
7
worker-toolkit-stocks-in-the-future/repo/docker/bash
Executable file
7
worker-toolkit-stocks-in-the-future/repo/docker/bash
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
echo '---------------'
|
||||
echo 'docker/run bash'
|
||||
echo '---------------'
|
||||
docker/run bash
|
||||
16
worker-toolkit-stocks-in-the-future/repo/docker/build
Executable file
16
worker-toolkit-stocks-in-the-future/repo/docker/build
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
DATE=`date +%Y%m%d-%H%M%S`
|
||||
LOG_DIRNAME="log/$DATE"
|
||||
LOG_FILENAME="$LOG_DIRNAME/build.log"
|
||||
mkdir "$LOG_DIRNAME"
|
||||
echo ''
|
||||
echo 'Welcome to the Stocks in the Future Docker build script!'
|
||||
echo 'The screen output will be logged at'
|
||||
echo "$LOG_FILENAME"
|
||||
echo ''
|
||||
echo 'Press Enter to continue.'
|
||||
read
|
||||
echo ''
|
||||
docker/build-log 2>&1 | tee "$LOG_FILENAME"
|
||||
47
worker-toolkit-stocks-in-the-future/repo/docker/build-log
Executable file
47
worker-toolkit-stocks-in-the-future/repo/docker/build-log
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
echo ''
|
||||
echo 'INSTRUCTIONS: Please read before continuing!'
|
||||
echo ''
|
||||
echo 'This script executes the "docker compose up" command.'
|
||||
echo 'This builds and starts up the application in Docker.'
|
||||
echo ''
|
||||
echo 'When the application has been successfully started,'
|
||||
echo 'you will be able to view it in your web browser at'
|
||||
echo 'http://localhost:3000/'
|
||||
echo ''
|
||||
echo 'To execute additional tasks in the application'
|
||||
echo 'you must start a new shell tab/window in the root directory'
|
||||
echo 'of this repository to enter more commands.'
|
||||
echo ''
|
||||
echo 'Scripts are provided in the "docker" directory.'
|
||||
echo 'Execute them from the root directory of this repository.'
|
||||
echo ''
|
||||
echo 'For example, you can run the test suite by entering'
|
||||
echo '"docker/test".'
|
||||
echo ''
|
||||
echo 'Press Enter to continue.'
|
||||
read
|
||||
|
||||
echo ''
|
||||
echo '-------------------------'
|
||||
echo 'rm -f tmp/pids/server.pid'
|
||||
echo '-------------------------'
|
||||
# You CANNOT start the Rails server if the
|
||||
# tmp/pids/server.pid file already exists
|
||||
rm -f tmp/pids/server.pid
|
||||
|
||||
echo '-------------------------------------------------'
|
||||
echo 'cp config/database.yml.sample config/database.yml'
|
||||
echo '-------------------------------------------------'
|
||||
cp config/database.yml.sample config/database.yml
|
||||
|
||||
wait
|
||||
echo '########################'
|
||||
echo 'BEGIN: docker compose up'
|
||||
echo '########################'
|
||||
docker compose up
|
||||
echo '###########################'
|
||||
echo 'FINISHED: docker compose up'
|
||||
echo '###########################'
|
||||
10
worker-toolkit-stocks-in-the-future/repo/docker/bundle-install
Executable file
10
worker-toolkit-stocks-in-the-future/repo/docker/bundle-install
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
echo '--------------------------------'
|
||||
echo 'BEGIN: docker/run bundle install'
|
||||
echo '--------------------------------'
|
||||
docker/run bundle install
|
||||
echo '-----------------------------------'
|
||||
echo 'FINISHED: docker/run bundle install'
|
||||
echo '-----------------------------------'
|
||||
12
worker-toolkit-stocks-in-the-future/repo/docker/cop
Executable file
12
worker-toolkit-stocks-in-the-future/repo/docker/cop
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
docker/bundle-install
|
||||
|
||||
echo '-------------------------------------'
|
||||
echo 'BEGIN: docker/run bundle exec rubocop'
|
||||
echo '-------------------------------------'
|
||||
docker/run bundle exec rubocop
|
||||
echo '----------------------------------------'
|
||||
echo 'FINISHED: docker/run bundle exec rubocop'
|
||||
echo '----------------------------------------'
|
||||
10
worker-toolkit-stocks-in-the-future/repo/docker/db-migrate
Executable file
10
worker-toolkit-stocks-in-the-future/repo/docker/db-migrate
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
echo '----------------------------------'
|
||||
echo 'BEGIN: docker/run rails db:migrate'
|
||||
echo '----------------------------------'
|
||||
docker/run rails db:migrate
|
||||
echo '-------------------------------------'
|
||||
echo 'FINISHED: docker/run rails db:migrate'
|
||||
echo '-------------------------------------'
|
||||
17
worker-toolkit-stocks-in-the-future/repo/docker/git-check
Executable file
17
worker-toolkit-stocks-in-the-future/repo/docker/git-check
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
# Run this script before entering "git add" and "git commit".
|
||||
|
||||
echo '----------'
|
||||
echo 'git status'
|
||||
echo '----------'
|
||||
git status
|
||||
|
||||
docker/test
|
||||
docker/cop
|
||||
|
||||
echo '----------'
|
||||
echo 'git status'
|
||||
echo '----------'
|
||||
git status
|
||||
28
worker-toolkit-stocks-in-the-future/repo/docker/nuke
Executable file
28
worker-toolkit-stocks-in-the-future/repo/docker/nuke
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script destroys all Docker containers and images.
|
||||
# SOURCE: https://gist.github.com/JeffBelback/5687bb02f3618965ca8f
|
||||
|
||||
echo '------------------------------------------'
|
||||
echo 'Killing and removing all Docker containers'
|
||||
for i in $(docker ps -a -q)
|
||||
do
|
||||
docker kill $i; wait;
|
||||
docker rm -f $i; wait;
|
||||
done;
|
||||
|
||||
echo '--------------------------------------'
|
||||
echo 'Killing and removing all Docker images'
|
||||
for i in $(docker images -a -q)
|
||||
do
|
||||
docker kill $i; wait;
|
||||
docker rmi -f $i; wait;
|
||||
done;
|
||||
|
||||
echo '------------'
|
||||
echo 'docker ps -a'
|
||||
docker ps -a
|
||||
|
||||
echo '----------------'
|
||||
echo 'docker images -a'
|
||||
docker images -a
|
||||
8
worker-toolkit-stocks-in-the-future/repo/docker/run
Executable file
8
worker-toolkit-stocks-in-the-future/repo/docker/run
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
# Use this script to execute commaands in the Docker container.
|
||||
# Example: To run the "ls -l" command in the Docker container, enter the command "docker/run ls -l".
|
||||
wait
|
||||
bin/dc $@
|
||||
wait
|
||||
7
worker-toolkit-stocks-in-the-future/repo/docker/sandbox
Executable file
7
worker-toolkit-stocks-in-the-future/repo/docker/sandbox
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
echo '----------------------------------'
|
||||
echo 'docker/run rails console --sandbox'
|
||||
echo '----------------------------------'
|
||||
docker/run rails console --sandbox
|
||||
20
worker-toolkit-stocks-in-the-future/repo/docker/seed
Executable file
20
worker-toolkit-stocks-in-the-future/repo/docker/seed
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
docker/bundle-install
|
||||
|
||||
echo '----------------------------------------'
|
||||
echo 'BEGIN: docker/run rails db:migrate:reset'
|
||||
echo '----------------------------------------'
|
||||
docker/run rails db:migrate:reset
|
||||
echo '-------------------------------------------'
|
||||
echo 'FINISHED: docker/run rails db:migrate:reset'
|
||||
echo '-------------------------------------------'
|
||||
echo ''
|
||||
echo '-------------------------------'
|
||||
echo 'BEGIN: docker/run rails db:seed'
|
||||
echo '-------------------------------'
|
||||
docker/run rails db:seed
|
||||
echo '----------------------------------'
|
||||
echo 'FINISHED: docker/run rails db:seed'
|
||||
echo '----------------------------------'
|
||||
13
worker-toolkit-stocks-in-the-future/repo/docker/test
Executable file
13
worker-toolkit-stocks-in-the-future/repo/docker/test
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
docker/bundle-install
|
||||
docker/db-migrate
|
||||
|
||||
echo '----------------------------'
|
||||
echo 'BEGIN: docker/run rails test'
|
||||
echo '----------------------------'
|
||||
docker/run rails test
|
||||
echo '-------------------------------'
|
||||
echo 'FINISHED: docker/run rails test'
|
||||
echo '-------------------------------'
|
||||
18
worker-toolkit-stocks-in-the-future/repo/docker/test-cov
Executable file
18
worker-toolkit-stocks-in-the-future/repo/docker/test-cov
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
# SimpleCov does not work well with parallel workers
|
||||
# and shows an inaccurate test coverage figure.
|
||||
# This script disables the parallel workers feature in order to
|
||||
# provide an accurate test coverage figure.
|
||||
|
||||
docker/bundle-install
|
||||
docker/db-migrate
|
||||
|
||||
echo '-----------------------'
|
||||
echo 'BEGIN: testing coverage'
|
||||
echo '-----------------------'
|
||||
docker compose run -e PARALLEL_WORKERS=1 --rm --no-deps stocks rails test
|
||||
echo '--------------------------'
|
||||
echo 'FINISHED: testing coverage'
|
||||
echo '--------------------------'
|
||||
Reference in New Issue
Block a user