Skip to content

philion/ywiki

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ywiki

Pronounced "lambda-wiki", but spelled with a 'y' because it was easier that typing out "lambda", and much easier than figuring out the Unicode every time.

This is a simple Markdown wiki, in Java, Jersey, AWS Lambda, and aws-serverless-java. It is designed to demonstrate fully automated build and deploy to AWS Lambda, as well as simple monitoring and metrics (devops).

Starting with https://github.com/awslabs/aws-serverless-java-container/tree/master/samples/jersey/pet-store as a seed project.

Setup

Make sure the following are installed:

homebrew

If you have homebrew installed, use the following

brew update
brew cask install java
brew install maven
brew install awscli

Building & Running

Standard Maven build:

mvn clean packge

To run an instance locally:

mvn exec:java

This will wrap the Jersey instance in a Grizzly server and run at:

Deploying

A simple deploy script exists to deploy the constructed JAR. Edit the deploy script to confirm:

  • deployBucket - name of S3 bucket to use for holding deployable JARs

Then run:

./deploy.sh

This will:

  1. create an S3 bucket for deployments
  2. package and upload the versioned package
  3. deploy the version
  4. get the deployed URL
  5. test the correct version was deplyed

Next Steps

  • Add simple MD file, make sure it gets served.
  • Add simple SPA editor, host resources locally.
  • Add Cognito integrated.
  • Setup Swagger and API frontend
  • Get POST/UPDATE working.
  • Add cloud-based doc store.
  • Clean up and release.
  • Add fully automated deploy scripts
  • Add project versioning
  • Add log-query script
  • Add status script / CW dash

Notes on sam.yaml

  • Auto-generate: (fill std template)
    • Handler: from annotation on method
    • Runtime: from mvn
    • CodeUri: from mvn
    • API Value: from @Path

Open Questions

  • How will revision history be stored?
  • How will AUTH be handled?
  • How will authorization work? Ownership?
  • What MD front-end? Pick editor with display only?

Use Cases

Display public page

Display protected page

Edit page

Authenticate (Login)

Search

Technology Choices

Persistance

Markdown Editing

https://github.com/bramp/js-sequence-diagrams

  • Which supports interaction diagrams?

Others:

Note: It would be great to use the same lib for both edit and display.

See also: http://www.developersfeed.com/awesome-javascript-wysiwyg-markdown-editors/

Markdown Rendering


Original Pet Store Docs

A basic pet store written with the Jersey framework. The LambdaHandler object is the main entry point for Lambda.

The application can be deployed in an AWS account using the Serverless Application Model. The sam.yaml file in the root folder contains the application definition

Installation

To build and install the sample application you will need Maven and the AWS CLI installed on your computer.

In a shell, navigate to the sample's folder and use maven to build a deployable jar.

$ mvn package

This command should generate a serverless-jersey-example-1.0-SNAPSHOT.jar in the target folder. Now that we have generated the jar file, we can use the AWS CLI to package the template for deployment.

You will need an S3 bucket to store the artifacts for deployment. Once you have created the S3 bucket, run the following command from the sample's folder:

$ aws cloudformation package --template-file sam.yaml --output-template-file output-sam.yaml --s3-bucket <YOUR S3 BUCKET NAME>
Uploading to xxxxxxxxxxxxxxxxxxxxxxxxxx  6464692 / 6464692.0  (100.00%)
Successfully packaged artifacts and wrote output template to file output-sam.yaml.
Execute the following command to deploy the packaged template
aws cloudformation deploy --template-file /your/path/output-sam.yaml --stack-name <YOUR STACK NAME>

As the command output suggests, you can now use the cli to deploy the application. Choose a stack name and run the aws cloudformation deploy command from the output of the package command.

$ aws cloudformation deploy --template-file output-sam.yaml --stack-name ServerlessJerseySample --capabilities CAPABILITY_IAM

Once the application is deployed, you can describe the stack to show the API endpoint that was created. The endpoint should be the JerseyPetStoreApi key of the Outputs property:

$ aws cloudformation describe-stacks --stack-name ServerlessJerseySample
{
    "Stacks": [
        {
            "StackId": "arn:aws:cloudformation:us-west-2:xxxxxxxx:stack/JerseySample/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx", 
            "Description": "Example Pet Store API written in jersey with the aws-serverless-java-container library", 
            "Tags": [], 
            "Outputs": [
                {
                    "Description": "URL for application", 
                    "OutputKey": "JerseyPetStoreApi", 
                    "OutputValue": "https://xxxxxxx.execute-api.us-west-2.amazonaws.com/Prod/pets"
                }
            ], 
            "CreationTime": "2016-12-13T22:59:31.552Z", 
            "Capabilities": [
                "CAPABILITY_IAM"
            ], 
            "StackName": "JerseySample", 
            "NotificationARNs": [], 
            "StackStatus": "UPDATE_COMPLETE"
        }
    ]
}

Copy the OutputValue into a browser to test a first request.

About

A streamlined wiki using AWS lambda.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published