-
Create
.envfrom related.examplefiles and set all needed variables:cp .env.example .env -
Ask team members about
master.key -
Install docker & docker-compose if you haven't got them yet and then run:
docker-compose build -
Run the project:
docker-compose up docker-compose up -d # without logs -
Setup development & test db's:
docker-compose exec web rake db:setup
Send POST request to api/v1/auth with body { email: 'some@email.com', password: 'some_pass' }
Returns JSON like: { "token": "YOUR_TOKEN" }
Then for each request add header Authorization: Bearer YOUR_TOKEN
get 'api/v1/countries'
post 'api/v1/countries' # create | params: %i[ja_name en_name country_code]
patch 'api/v1/countries/:id' # update | params: %i[ja_name en_name country_code]
delete 'api/v1/countries/:id' # destroy
post 'api/v1/holidays' # create | params: %i[ja_name en_name country_code expression calendar_type holiday_type]
patch 'api/v1/holidays/:id' # update | params: %i[ja_name en_name country_code expression calendar_type holiday_type]
delete 'api/v1/holidays/:id' # destroy get 'api/v1/holidays' # for all countries in Date.current.all_year
get 'api/v1/holidays/:country_code' # for one country in Date.current.all_year
get 'api/v1/holidays/:country_code/:year' # for one country in :year
# also you can use 'from' and 'to' params for determite the period and it can be used with :country_code
# default: from = Date.current.beginning_of_year
# to = Date.current.end_of_year
get 'api/v1/holidays?from=Y-m-d&to=Y-m-d'- Simple:
Y?/m/d:2018/01/01 01/01 2018/01/01 2018.1.1 1.1
- Nth Day:
Y?/N,day_of_week:10/1,5 # first friday of October 2018/1,5 # first friday of October 2018 1.-1,2 # last tuesday of January 2018.11.-2,7 # penultimate sunday of November 2018
- Period:
Y?/m/day_from-day_to:10/1-15 # from the 1st to the 15th of October 1.23-25 # from the 23th to the 25th of January 2018.2.1-3 # from the 1st to the 3rd of February in 2018
- Larger period (yes, brackets is required):
Y?/(month_from/day_from)-(month_to/day_to)(1/15)-(2/5) # from the 15th of January to the 5th of February 2018/(05/30)-(06/5) # from the 30th of May to the 5th of June in 2018 (12/31)-(1/6) # from the 31th of December to the 6th of January (New Year (^-^))
- Full moon:
Y?/m/full.*moon:2018/01/full_moon # full moon in January 2018 1.fullmoon # full moon in January 05.full_moon # full moon in May 1976/9.full-moon # full moon in September 1976 1976/9.full-so-full-that-it-took-the-squirrel-away-moon # full moon in September 1976 too
Prerequisites:
- AWS CLI Installed
- AWS Access Keys for IAM account (either in env vars or in ~/.aws/credentials). This account has to be included in
Run APP_ENV=your_env deploy/deploy.sh
It will build, push, migrate (if needed) and update a cluster service.
Also you can run separate scripts:
sh deploy/build.sh
sh deploy/push.sh
sh APP_ENV=your_env deploy/migrate.sh
sh APP_ENV=your_env deploy/update_service.sh
kubectl -n holidays-api-prod get pods
kubectl -n holidays-api-prod exec -it holidays-api-prod-<POD_ID> -c backend -- rails cCountry.all.each do |country|
Fetchers::FetchFromGoogleService.call({ langs: [:en, :ja], options: { country: country }, start_date: '2026-01-01'.to_date})
end
Generators::Google::GenerateHolidays.call