서울열린데이터 광장의 서울시 공영주차장 안내 정보를 활용해서 주차 가능한 주차장을 찾을 수 있는 서비스 구현
2020.03.30 10:00 ~ 2020.04.05 23:59 작업 [TAG: 2020.04.06]
- 서비스 URL: https://spps.ghilbut.net/
- API URL: https://spps-api.ghilbut.net/parking_lots/
- API 문서
$ git clone https://github.com/ghilbut/seoul-public-parking-lot-service.git
# WORKSPACE: ${repodir}/django
# run MySQL with docker-compose on background
$ mkdir -p db/mysql/init
$ tee db/mysql/init.sql << EOF
GRANT ALL PRIVILEGES ON test_spps.* TO 'spps'@'%';
EOF
$ docker-compose up -d
# initialize pipenv environment
$ pipenv install --dev
$ tee .env << EOF
OPEN_API_KEY=******** #서울시 OpenAPI 인증키
EOF
# initialize database
$ pipenv run ./src/manage.py makemigrations
$ pipenv run ./src/manage.py migrate
# create superuser name and password
$ pipenv run ./src/manage.py createsuperuser
# run unit test
$ pipenv run ./src/manage.py test ./src
# run local development server
$ pipenv run ./src/manage.py runserver 0:8000
# WORKSPACE: ${repodir}/django
# create or update data
$ pipenv run ./src/manage.py crawling
- REST API:
- Admin Page: http://localhost:8000/admin
- Documents:
- Swagger UI: http://localhost:8000/swagger/
- Swagger Json: http://localhost:8000/swagger.json
- Swagger Yaml: http://localhost:8000/swagger.yaml
- Redoc: http://localhost:8000/redoc/
# WORKSPACE: ${repodir}/vue.js
$ yarn install
$ yarn serve
[Step1] Add User
- User name: spps
- Access type: [x] Programmatic access / [ ] AWS Management Console access
[Step2] Add tags
- Name: spps
- owner: devops
- purpose: terraform user for production stage
[Step3] Save secrets
- Access key ID
- Secret access key
[Step4] Add inline policy
- Policy name: all
- Policy value:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "*", "Resource": "*" } ] }
[Step5] Register credentials
$ vi ~/.aws/credentials
...
[spps]
aws_access_key_id=********
aws_secret_access_key=********
[Step1] 기본 설정으로 Bucket 생성
- Name: seoul-public-parking-lot-service-terraform-state
- Region: Asia Pacific (Seoul) ap-northeast-2
[Step2] 태그 설정
- Name: seoul-public-parking-lot-service-terraform-state
- owner: devops
- purpose: terraform state repository
# WORKSPACE: ${repodir}/terraform
# initialize
$ terraform init
# environment variables
# TF_VAR_aws_region (default: ap-northeast-2)
# TF_VAR_aws_profile (default: spps)
# TF_VAR_srv_name (default: spps)
# TF_VAR_domain_name (default: ghilbut.net)
$ terraform apply
# WORKSPACE: ${repodir}/terraform
$ terraform destroy
# WORKSPACE: ${repodir}/vue.js
$ yarn install
$ yarn build --mode prod
$ aws --profile spps s3 sync --acl public-read ./dist s3://spps.ghilbut.net