From 7e4e751b5087dbb94360734af01d5534ab2adb49 Mon Sep 17 00:00:00 2001 From: Jonathan Kerr Date: Wed, 14 Apr 2021 18:55:05 +0100 Subject: [PATCH 1/4] WIP - Writing guide to installation and deployment I've completed a first pass on how to get the project installed locally. I think there are plenty of changes to be made though! --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index daa4770..8014cbb 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,28 @@ This is a little service to enable users to follow everyone in a list. Because of Twitter's API rate limits, a user's request to follow an entire list is queued up behind everyone else using the service. Consequently it might be several days before you see all the new people you're following. If you use this software and enjoy it, consider buying the creator a coffee: [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/V7V24IODP) + +## What you'll need + +- you'll need credentials for a Twitter app. Your users will be asked to authorise you, and you'll need quite significant permissions. You can get those by [following the instructions on the developer pages of Twitter.](https://developer.twitter.com/en/docs/getting-started). Those credentials go in [runtime/.chalice/config.json](./runtime/.chalice/example_config.json) - you will need to rename the `example_config.json` file to `config.json` +- you'll need [an AWS account, with some billing set up](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/). Depending on how may users you have, this app could cost you a fortune - or it could cost you absolutely nothing. Lambda is complicated. I'm going to work on ways to call some of these asynchronously, rather than spamming queues, which is what it does at the moment. +- you'll need credentials for AWS stored locally. Check out the section of [this guide entitled 'Programmatic Access'](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html) + +## How to deploy + +You'll need to use the terminal. All of these instruction assume you're in the root directory (cdk-list-follower), which means if you type `ls` you should see this: +``` +infrastructure LICENSE README.md requirements.txt runtime +``` +The first thing we're going to do is create a virtual environment to run our python code in: +`python3 -m venv venv` + +your computer will think about it for a while. + +once it's finished thinking, activate the virtual environment by typing `. venv/bin/activate` and install all the project's requirements by typing `pip install -r requirements.txt`. This will isntall everything in `runtime/requirements.txt` and `infrastructure/requirements.txt` + +First things first - let's run the tests and make sure everything's set up correctly. Change directory to the runtime directory by typing `cd runtime` into your terminal. Then run the tests by typing `python -m pytest` + +If these fail, then something has already gone wrong. Please raise an issue on this project with as much detail as possible, including what the computer spat back at you. + +From the root folder - cdk-list-follower - type `cdk deploy` into your terminal From 72ad677f42e8ec826d39a7f703168eeaaa413709 Mon Sep 17 00:00:00 2001 From: Jonathan Kerr Date: Tue, 27 Apr 2021 19:46:15 +0100 Subject: [PATCH 2/4] Update README with new cdk deploy command --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8014cbb..26bb6c4 100644 --- a/README.md +++ b/README.md @@ -27,4 +27,4 @@ First things first - let's run the tests and make sure everything's set up corre If these fail, then something has already gone wrong. Please raise an issue on this project with as much detail as possible, including what the computer spat back at you. -From the root folder - cdk-list-follower - type `cdk deploy` into your terminal +From the infrastructure folder - cdk-list-follower/infrastructure - type `cdk deploy` into your terminal From 85ce38cad752e2f216d930c7f2a73d3b13ebb993 Mon Sep 17 00:00:00 2001 From: Jonathan Kerr Date: Wed, 28 Apr 2021 08:20:34 +0100 Subject: [PATCH 3/4] Update to include bootstrap and npm Thanks to an issue raised by Samir, I've updated this draft to include more detail. It adds two steps I had forgotten - installing the CDK via npm and calling cdk bootstrap. --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 26bb6c4..d1f4c37 100644 --- a/README.md +++ b/README.md @@ -16,15 +16,19 @@ You'll need to use the terminal. All of these instruction assume you're in the r ``` infrastructure LICENSE README.md requirements.txt runtime ``` -The first thing we're going to do is create a virtual environment to run our python code in: +Before we start, we need to install the 'cloud delivery kit', or CDK. We do this by typing `npm install -g aws-cdk` and hitting return. If you now try `cdk --version`, you should get something a bit like `1.83.0 (build 827c5f4)`. + +Alright, we're ready to go. The first thing we're going to do is create a virtual environment to run our python code in: `python3 -m venv venv` your computer will think about it for a while. -once it's finished thinking, activate the virtual environment by typing `. venv/bin/activate` and install all the project's requirements by typing `pip install -r requirements.txt`. This will isntall everything in `runtime/requirements.txt` and `infrastructure/requirements.txt` +once it's finished thinking, activate the virtual environment by typing `. venv/bin/activate` and install all the project's requirements by typing `pip install -r requirements.txt`. This will install everything in `runtime/requirements.txt` and `infrastructure/requirements.txt` First things first - let's run the tests and make sure everything's set up correctly. Change directory to the runtime directory by typing `cd runtime` into your terminal. Then run the tests by typing `python -m pytest` If these fail, then something has already gone wrong. Please raise an issue on this project with as much detail as possible, including what the computer spat back at you. -From the infrastructure folder - cdk-list-follower/infrastructure - type `cdk deploy` into your terminal +Change directory to the infrastructure folder (cdk-list-follower/infrastructure). If this is your first time running this app, type `cdk bootstrap` and hit return to set up the infrastructure. + +Once that's been done once, deploying is just a matter of typing `cdk deploy` into your terminal From 4ed7b7308bc26c84c10318d9fbad69203a687ab2 Mon Sep 17 00:00:00 2001 From: Jonathan Kerr Date: Wed, 28 Apr 2021 17:56:22 +0100 Subject: [PATCH 4/4] Update to explain config A user asked for some help explaining the config. I've done my best to add some detail. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index d1f4c37..a5ab6d5 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,13 @@ If you use this software and enjoy it, consider buying the creator a coffee: [![ - you'll need [an AWS account, with some billing set up](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/). Depending on how may users you have, this app could cost you a fortune - or it could cost you absolutely nothing. Lambda is complicated. I'm going to work on ways to call some of these asynchronously, rather than spamming queues, which is what it does at the moment. - you'll need credentials for AWS stored locally. Check out the section of [this guide entitled 'Programmatic Access'](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html) +## Setup + +- rename `example_config.json` to `config.json`. +- add the access key and the secret key from your twitter app to the `CONSUMER_KEY` and `CONSUMER_SECRET` fields respectively. +- you will also need a `CALLBACK_URL`. Because of the way this software has been built, this can be constructed as follows: {domain}/api/redirect. So, if you want to use this on your domain `elephants-count.com`, your redirect url will be `elephants-count.com/api/redirect`. If you're just deploying this as a little backend service, you will be better off going into the AWS console, grabbing the name of the auto-generated domain, and constructing it from there. +- **make sure** that you've also added the `CALLBACK_URL` to your twitter app. If you don't, you'll get an error, because twitter won't know where to redirect your users to. + ## How to deploy You'll need to use the terminal. All of these instruction assume you're in the root directory (cdk-list-follower), which means if you type `ls` you should see this: