/bertly

🔗 A serverless link shortener.

Primary LanguagePythonMIT LicenseMIT

Bertly code style

This is Bertly, a serverless link shortener. We use it to create shareable URLs, like this: dosome.click/wq544. Bertly is built using Serverless Framework, Flask, and short_url. It runs on AWS Lambda. We don't know where the name came from, but it sounds a bit familiar...

Getting Started

Check out the API Documentation to start using Bertly! 🔗

Contributing

Install Node, Python, and Pipenv. You'll also need a local Redis and PostgreSQL database.

# Create virtual environment:
$ pipenv --two

# Install dependencies:
$ npm i && pipenv install

# Copy environment variables & edit w/ your machine's details:
$ cp .env.example .env && vi .env

# Load virtualenv with project dependencies:
$ pipenv shell

# Run database migrations to set up your PostgreSQL database:
$ FLASK_APP=bertly.py flask db upgrade head

# And finally, start your local dev server!
$ npm start

We automatically lint all pull requests with Stickler CI.

Deployments

We deploy Bertly using Serverless Framework in AWS, under separate development and production organizations.

Before you start, make sure you've followed the "contributing" directions above & manually tested your code. Then, install Docker and the AWS CLI, and configure it with our "dev" and "production" IAM roles (found in Lastpass):

$ aws configure --profile serverless-dev
AWS Access Key ID [None]: **************
AWS Secret Access Key [None]: **************
Default region name [None]: us-east-1
Default output format [None]: text

$ aws configure --profile serverless-production
AWS Access Key ID [None]: **************
AWS Secret Access Key [None]: **************
Default region name [None]: us-east-1
Default output format [None]: text

Then, run either npm run deploy:dev, npm run deploy:qa, or npm run deploy:prod to deploy! (For more power, you can also install the Serverless CLI globally on your machine and run commands with serverless or sls).

Migrations can be run by invoking the corresponding "migrate" Lambda function. For example:

# to run migrations on dev stage:
$ aws lambda invoke --function-name bertly-dev-migrate --profile serverless-dev /dev/null

# to run migrations on qa stage:
$ aws lambda invoke --function-name bertly-qa-migrate --profile serverless-dev /dev/null

# to run migrations on production stage:
$ aws lambda invoke --function-name bertly-prod-migrate --profile serverless-production /dev/null

Security Vulnerabilities

We take security very seriously. Any vulnerabilities in Bertly should be reported to security@dosomething.org, and will be promptly addressed. Thank you for taking the time to responsibly disclose any issues you find.

License

© DoSomething.org. Bertly is free software, and may be redistributed under the terms specified in the LICENSE file. The name and logo for DoSomething.org are trademarks of Do Something, Inc and may not be used without permission.