Skip to content

Latest commit

 

History

History
170 lines (103 loc) · 8.01 KB

README.md

File metadata and controls

170 lines (103 loc) · 8.01 KB

PaimonGanyu

PaimonGanyu is the English name for 「여행 비서 페이몬!」, which is a Kakaotalk chatbot that provides convenience features for Genshin Impact users.

This repository is the java code base for the chatbot's skill-server & back-end serverless workflows.

Requirements

Two stacks

This repository contains two CloudFormation stacks that AWS SAM deploys to your AWS cloud.

1. paimonganyu

The behind AWS workflows that support the chatbot's features, and dependencies.

Application module

:paimonganyu-app:paimonganyu

Dependent modules

:paimonganyu-infra, :paimonganyu-domain, :paimonganyu-hoyoapi, :awsutils

2. paimonganyu-skill

The code of skill server that handles user requests and renders skill responses, and dependencies.

Application module

:paimonganyu-app:paimonganyu-skill

Dependent modules

:paimonganyu-infra, :paimonganyu-domain, :paimonganyu-hoyoapi, :ikakao

Engineering Wiki

Notion: PaimonGanyu 엔지니어링

paimonganyu

There are ways to realize various use cases for Genshin Impact players by leveraging the AWS Serveless Application Model(AWS SAM). Please refer to the issue All workflows to get more information about the back-end workflows that fulfill the use cases below.

Use cases

  • Daily Check-In
    • New User Event Daily Check-In
    • Cron-based Automatic Daily Check-In
  • Code Redemption
    • New User Event Code Redemption
    • New Redeem Code Distribution
  • Hoyopass Fanout
    • New User Hoyopass SNS(AWS SNS) Publishing
  • Hoyopass CRUD Operations to DynamoDB Tables

※ In order to deploy the serverless workflows, you should have your own AWS account.

paimonganyu-skill

The chatbot 「여행 비서 페이몬!」(PaimonGanyu) communicates with the Hoyoverse APIs via the skill server, which is a Spring Boot application. This may require you to prepare three properties before running the application. paimonganyu-skill will be deployed to your AWS cloud as an application of Amazon Elastic Beanstalk under a CloudFormation stack.

applications.properties (required)

:application> src> main> resources> applications.properties

amazon.ssm.hoyopass.publickeyname = HoyopassRsaPublicKey
amazon.ssm.hoyopass.privatekeyname = HoyopassRsaPrivateKey
listUserDailyCheck.maxCount = 4
  • amazon.ssm.hoyopass.publickeyname(String)

    Set your AWS SSM Parameter name that is holding a RSA public key that encrypts user's hoyopass credentials.

  • amazon.ssm.hoyopass.privatekeyname (String)

    Set your AWS SSM Parameter name that is holding the RSA private key that can decrypt the encryption done by the previous public key.

  • listUserDailyCheck.maxCount (Non-negative integer)

    Configure how many items to be displayed when DailyCheckController is requested to show a user history of UserDailyCheck.

amazon.properties (optional)

:application> src> test> resources> amazon.properties

amazon.aws.accesskey=ASDFASDFASDFASDFASDF
amazon.aws.secretkey=asdfasfdfASDFASDFasdfasdfASDFASFd+-*/asdf
amazon.region=ap-northeast-2

amazon.dynamodb.endpoint=https://dynamodb.ap-northeast-2.amazonaws.com
#amazon.dynamodb.endpoint=http://localhost:3306

amazon.ssm.hoyopass.publickeyname = HoyopassRsaPublicKey
amazon.ssm.hoyopass.privatekeyname = HoyopassRsaPrivateKey

These are only required by the local integration tests.

The production environment is AWS, hence IAM roles and IAM policies are responsible to configure security options.

accounts.properties (optional)

:application> src> test> resources> accounts.properties

Some tests need your real Genshin Impact accounts to validate their functionalities.

If any account authentication is not provided, those tests will fail. That being said I know account preparation of your own is not easy. This properties file is not required. You can give up running test cases.

Makefile shortcuts

Before you run makefile shortcuts, note that they may require two AWS credentials profiles: pgprod and pgtest. If needed, please modify the Gradle scripts in paimonganyu-app module to set your cli profiles.

def profile() { // change this function
    [prod: 'pgprod', test: 'pgtest'].get(project.findProperty('env'))
}

Deploy the serveless workflows

make paimonganyu

make paimonganyu-test

Deploy the skill server

make paimonganyu-skill

make paimonganyu-skill-test

Run a local system test

make localtest

IaC

Contribution

Your gentle contributions are always welcome. Please feel free to ask questions, to open issues, and to commit your works.

LICENSES

GPLv3

MIT