fixing strapi extension versions

This commit is contained in:
2020-04-27 03:13:02 +01:00
parent 35ae8cb642
commit 4ee5de123a
4 changed files with 126 additions and 14 deletions

9
package-lock.json generated
View File

@@ -10716,11 +10716,12 @@
} }
}, },
"strapi-provider-upload-aws-s3": { "strapi-provider-upload-aws-s3": {
"version": "3.0.0-alpha.26.2", "version": "3.0.0-beta.20",
"resolved": "https://registry.npmjs.org/strapi-provider-upload-aws-s3/-/strapi-provider-upload-aws-s3-3.0.0-alpha.26.2.tgz", "resolved": "https://registry.npmjs.org/strapi-provider-upload-aws-s3/-/strapi-provider-upload-aws-s3-3.0.0-beta.20.tgz",
"integrity": "sha512-3UvrXC9q+AYLMQ1pZ4P6mxH+2J4dwYejS2xoKuebPUrWo6jH0lHyvIqqBsUzK0CotQUJhQ2g49MGY67+gq+3lw==", "integrity": "sha512-q0V6rcgN7EHkUJrcxUKgYmFZSXe+Y7hxphgWQUfnfCPuNhguDLHww5uVfzP+Z8g90ohj9N48GLPqnJoFExLloA==",
"requires": { "requires": {
"aws-sdk": "^2.199.0" "aws-sdk": "^2.457.0",
"lodash": "^4.17.11"
} }
}, },
"strapi-provider-upload-local": { "strapi-provider-upload-local": {

View File

@@ -19,11 +19,11 @@
"strapi-connector-bookshelf": "3.0.0-beta.20", "strapi-connector-bookshelf": "3.0.0-beta.20",
"strapi-plugin-content-manager": "3.0.0-beta.20", "strapi-plugin-content-manager": "3.0.0-beta.20",
"strapi-plugin-content-type-builder": "3.0.0-beta.20", "strapi-plugin-content-type-builder": "3.0.0-beta.20",
"strapi-plugin-documentation": "^3.0.0-beta.20", "strapi-plugin-documentation": "3.0.0-beta.20",
"strapi-plugin-email": "3.0.0-beta.20", "strapi-plugin-email": "3.0.0-beta.20",
"strapi-plugin-upload": "3.0.0-beta.20", "strapi-plugin-upload": "3.0.0-beta.20",
"strapi-plugin-users-permissions": "3.0.0-beta.20", "strapi-plugin-users-permissions": "3.0.0-beta.20",
"strapi-provider-upload-aws-s3": "^3.0.0-alpha.26.2", "strapi-provider-upload-aws-s3": "3.0.0-beta.20",
"strapi-utils": "3.0.0-beta.20" "strapi-utils": "3.0.0-beta.20"
}, },
"author": { "author": {

View File

@@ -57,11 +57,117 @@ Due to the reasons I explained above I am going to mark this as closed but pleas
You can install the strapi documentation plugin by running: `npm run strapi install documentation`. You can install the strapi documentation plugin by running: `npm run strapi install documentation`.
You can then access it through the Strapi Admin panel.
curl -k http://strapi-prod.eu-west-1.elasticbeanstalk.com/tests -H "Authorization: Bearer " You should change the production URL server url in the documentation settings.
http http://strapi-prod.eu-west-1.elasticbeanstalk.com/auth/local identifier=apiuser password=password Edit the file `./extensions/documentation/documentation/1.0.0/full_documentation.json` and change `YOUR_PRODUCTION_SERVER` to the ELB URL of your environment.
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiaWF0IjoxNTg3ODY3NzQ4LCJleHAiOjE1OTA0NTk3NDh9.McAi1b-F3IT2Mw90652AprEMtknJrW66Aw5FGMBOTj0 ## API Examples using HTTPIE
http http://strapi-prod.eu-west-1.elasticbeanstalk.com/tests Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiaWF0IjoxNTg3ODY3NzQ4LCJleHAiOjE1OTA0NTk3NDh9.McAi1b-F3IT2Mw90652AprEMtknJrW66Aw5FGMBOTj0" ### Authenticate with the API
`http http://strapi-prod.eu-west-1.elasticbeanstalk.com/auth/local identifier=apiuser password=password`
### Get a Single Content Type
`http http://strapi-prod.eu-west-1.elasticbeanstalk.com/tests Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiaWF0IjoxNTg3ODY3NzQ4LCJleHAiOjE1OTA0NTk3NDh9.McAi1b-F3IT2Mw90652AprEMtknJrW66Aw5FGMBOTj0"`
### Use query parameters to filter for Multiple Content Type
You can use query parameters to filter requests made to the API.
<https://strapi.io/documentation/3.0.0-beta.x/content-api/parameters.html#parameters>
The syntax is `?field_operator=value`, e.g `?title_contains=test`, after the endpoint URL for the content type.
`http "http://strapi-prod.eu-west-1.elasticbeanstalk.com/tests?title_contains=test" Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaXNBZG1pbiI6dHJ1ZSwiaWF0IjoxNTg3ODY3NzMwLCJleHAiOjE1OTA0NTk3MzB9.XXdoZUk_GuOION2KlpeWZ7qwXAoEq9vTlIeD2XTnJxY"`
## S3 Upload Addon
You should add the `strapi-provider-upload-aws-s3` extension using NPM. Make sure you add the same version of Strapi you are using.
`npm i strapi-provider-upload-aws-s3@3.0.0-beta.20`
### AWS Resources
You should have an S3 bucket with public access, and an AWS account that has a policy to access the bucket.
### Configuration
You should create a settings file at `./extensions/upload/config/settings.json`.
This file defines an S3 object as in: <https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property>.
You can use Strapi dynamic config files to set environment variables:
- provider
- providerOptions
- accessKeyId
- secretAccessKey
- region
- params
- Bucket
```json
{
"provider": "aws-s3",
"providerOptions": {
"accessKeyId": "${ process.env.STRAPI_S3_ACCESS_KEY || 'AKIA23D4RF6OZWGDKV7W' }",
"secretAccessKey": "${ process.env.STRAPI_S3_SECRET_KEY || '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' }",
"region": "${ process.env.STRAPI_S3_REGION || 'eu-west-1' }",
"params": {
"Bucket": "${ process.env.STRAPI_S3_BUCKET || 'elb-example-bucket' }"
}
}
}
```
Alternatively if you want to use different options for different environments, you can use a settings.js file instead.
<https://strapi.io/documentation/3.0.0-beta.x/plugins/upload.html#using-a-provider>
```javascript
if (process.env.NODE_ENV === "production") {
module.exports = {
provider: "aws-s3",
providerOptions: {
accessKeyId: process.env.STRAPI_S3_ACCESS_KEY,
secretAccessKey: process.env.STRAPI_S3_SECRET_KEY,
region: process.env.STRAPI_S3_REGION,
params: {
Bucket: process.env.STRAPI_S3_BUCKET,
},
},
};
} else {
module.exports = {};
}
```
## Fix Version Numbers
When using Strapi you should make sure the version numbers for **all** dependencies in `./package.json` are fixed for Strapi modules. You cannot mix and match and upgrade arbitrarily.
An example is:
```json
{
"dependencies": {
"knex": "<0.20.0",
"pg": "^8.0.3",
"sqlite3": "latest",
"strapi": "3.0.0-beta.20",
"strapi-admin": "3.0.0-beta.20",
"strapi-connector-bookshelf": "3.0.0-beta.20",
"strapi-plugin-content-manager": "3.0.0-beta.20",
"strapi-plugin-content-type-builder": "3.0.0-beta.20",
"strapi-plugin-documentation": "3.0.0-beta.20",
"strapi-plugin-email": "3.0.0-beta.20",
"strapi-plugin-upload": "3.0.0-beta.20",
"strapi-plugin-users-permissions": "3.0.0-beta.20",
"strapi-provider-upload-aws-s3": "3.0.0-beta.20",
"strapi-utils": "3.0.0-beta.20"
}
}
```

13
todo.md
View File

@@ -1,17 +1,22 @@
# To Do # To Do
Configure S3 addon and Configure Finish S3 config for env vars
Deploy to AWS and ensure vars are working
Strapi documentation - build and host Use cloudformation to deploy bucket instead of tieing it to the RDS instance.
Use <https://strapi.io/documentation/3.0.0-beta.x/deployment/amazon-aws.html#_2-create-the-bucket> for bucket options for the template.
~~Strapi documentation - build and host~~
Deploy strapi as load balanced rather than single instance Deploy strapi as load balanced rather than single instance
Deploy strapi with a custom domain with HTTPS as a single instance + load balanced.
RDS cloudformation template RDS cloudformation template
Use the GUI to go through options and create cloudformation template
Create an RDS db before deployment Create an RDS db before deployment
Configure Strapi to use this RDS db Configure Strapi to use this RDS db
Use cloudformation to deploy bucket instead of tieing it to the RDS instance.
Combine ELB Documentations (strapi, ELB etc) Combine ELB Documentations (strapi, ELB etc)
Use codebuild to update strapi Use codebuild to update strapi