Skip to content

Commit

Permalink
updating readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
RmnRss committed Sep 14, 2020
1 parent b911ccf commit a61265c
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 64 deletions.
99 changes: 36 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ The platform uses [Next.js](https://nextjs.org/) as a front-end framework, for m

For content management the platform is powered by [Strapi](https://strapi.io), not the best headless CMS for blogs/publication edition and creation, but probably the best overall when your content isn't limited blogs or text. And as a very popular open-source project it's improving at the speed of light every single day.

### PostreSQL (Data Storage)

The data is stored on a [PostreSQL](https://www.postgresql.org/) database. All the database management is handled by Strapi and its own ORM mapping tools, for more information read [Strapi Database Configuration](https://strapi.io/documentation/v3.x/concepts/configurations.html#database).

### Astroplant API & Back-End

It uses data & control endpoints from [astroplant's API](https://github.com/AstroPlant/astroplant-api) to control kits and display their data.
The front-end uses data & control endpoints from [AstroPlants Core API](https://github.com/AstroPlant/astroplant-api) to control kits and display their data.

## Tools and Libraries

Expand All @@ -54,6 +58,8 @@ It uses data & control endpoints from [astroplant's API](https://github.com/Astr

> 📑 We decided to keep the whole platform in a single repository as many of the change to the front-end also affects the back-end. It makes it easier to follow versioning and progression, and to rollback if necessary.
Here is the curent repository structure :

```bash

│ .storybook # storybook configuration files
Expand All @@ -79,31 +85,50 @@ It uses data & control endpoints from [astroplant's API](https://github.com/Astr

# Development Setup

## Using Docker
## Using Docker Compose

Make sure you have the [git command line tool](https://git-scm.com/) and [Docker](https://www.docker.com/) installed first, then run the following commands :

```bash
# Clone the repo
git clone https://github.com/Meet-Miles/astroplant-platform
git clone https://github.com/AstroPlant/community-platform

cd astroplant-platform
cd community-platform

# Start up both strapi and next
docker-compose up -d
```

Once it's finished you should be asked to create a strapi admin account on your [localhost:1337](localhost:1337), then you should be able to access the front end on your [localhost:3000](localhost:3000).
Once it's finished you should be asked to create a strapi admin account on [localhost:1337](localhost:1337). Please create at least an article, a user and add the correct permissions by following the steps [here](https://astroplant.gitbook.io/community-platform/). Then you should be able to access the front end on your [localhost:3000](localhost:3000).

## Without Docker

### Back-End

Please read the instructions indide the [api folder](api/README.md).

### Front-End

#### Create env files

Create an `env.local` file at the root of the project with the following content :

```bash

NEXT_PUBLIC_STRAPI_PUBLIC_URL="http://localhost:1337"
NEXT_PUBLIC_STRAPI_CLUSTER_URL="http://localhost:1337"

```

#### Install the package

Run the following commands :

```bash
# Clone the repo
git clone https://github.com/Meet-Miles/astroplant-platform
git clone https://github.com/AstroPlant/community-platform

cd astroplant-platform/api
cd community-platform/api

# install strapi dependencies
npm install
Expand All @@ -128,65 +153,13 @@ npm run dev

# Deployment

The deployment is made through [AstroPlant's kubernetes cluster](https://github.com/AstroPlant/astroplant-k8s) hosted at [SURFSara](https://www.surf.nl/).

## Update the images on Docker-Hub

### Next

To push a new docker image to the docker hub registry, run:

```bash
# Log into Docker hub
export DOCKER_ID_USER="yourusername"
docker login https://index.docker.io/v1/

# Clone the repo
git clone https://github.com/AstroPlant/community-platform.git
cd community-platform

# Build a docker image with the astroplant-community-platform tag
docker build -t astroplant-community-platform -f Dockerfile.production .
docker tag astroplant-community-platform $DOCKER_ID_USER/astroplant-community-platform:0.0.1

$DOCKER_ID_USER/astroplant-community-platform:0.0.1

# Publish image to docker hub
docker push $DOCKER_ID_USER/astroplant-community-platform:0.0.1
```

### Strapi

To push a new docker image to the docker hub registry, run:

```bash
# Log into Docker hub if not done
export DOCKER_ID_USER="yourusername"
docker login https://index.docker.io/v1/

# Clone the repo if not already done
git clone https://github.com/AstroPlant/community-platform.git

# Navigate to the api folder
cd community-platform/api

# Build a docker image with the astroplant-community-platform tag
docker build -t astroplant-community-api -f Dockerfile.production .
$DOCKER_ID_USER/astroplant-community-api:0.0.1

# Publish image to docker hub
docker push $DOCKER_ID_USER/astroplant-community-api:0.0.1
```

## Update the Kubernetes Cluster

See [AstroPlant's kubernetes cluster](https://github.com/AstroPlant/astroplant-k8s).
The deployment is made through [AstroPlant's kubernetes cluster](https://github.com/AstroPlant/astroplant-k8s) hosted at [SURFSara](https://www.surf.nl/). Please refer to the readme's inside the deployment folder: [Community API Folder](https://github.com/AstroPlant/astroplant-k8s/deployment/community-api) & [Community Platform Folder](https://github.com/AstroPlant/astroplant-k8s/deployment/community-platform).

# Roadmap

[x] Build a static website for news, FAQs & document sharing
[] Build a tool to create graphs using kits data.
[] Build a kit dashboard to access, edit & manage a kit. Currently done through [Astroplant Front-End](https://github.com/AstroPlant/astroplant-frontend-web)
- [x] Build a static website for news, FAQs & document sharing.
- [ ] Build a tool to create graphs using kits data.
- [ ] Build a kit dashboard to access, edit & manage a kit. Currently done through [Astroplant Front-End](https://github.com/AstroPlant/astroplant-frontend-web)

# Contributors

Expand Down
89 changes: 88 additions & 1 deletion api/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,90 @@
# Strapi application

A quick description of your strapi application
## Booting Strapi for development without Docker

### Set up environment variables

1. First generate a secure token.

```bash
openssl rand 64 | base64 # (linux/macOS users)
# or
node -e "console.log(require('crypto').randomBytes(64).toString('base64'))" # (all users)
```

2. Create an `env.local` file at the root of this folder with the following content :

```bash

ADMIN_JWT_SECRET=token_generated_above

```

### Setup a psql database

1. Install [PostreSQL](https://www.postgresql.org/).

Please follow the steps presented on the [PostreSQL website](https://www.postgresql.org/) to install postgres.

2. Create a database & a user

```bash
# Activating PSQL
psql postgres

# Create the strapi db
CREATE DATABASE strapi;

# Create a user
CREATE ROLE strapi WITH LOGIN PASSWORD 'strapi' CREATEDB;

# Grant all priviledge to the strapi user
GRANT ALL PRIVILEGES ON DATABASE strapi TO strapi;
```

### Install Strapi

From then you should be able to install and launch our strapi app with the following commands :

```bash
# Clone the repo
git clone https://github.com/AstroPlant/community-platform

cd community-platform/api

# install strapi dependencies
npm install

# Start up strapi
npm run develop
```

When Strapi is installed you should be asked to create a Strapi admin account on your [localhost:1337](localhost:1337).

### Create some content

Before our Strapi app becomes fully operational, wwe need to add some content and configure some part of it.

1. Create a test user

Under the **collection type** menu click **Users**, then create a user with the following information :

```
username: 'Testeroo',
email: '[email protected]',
password: 'Testeroo72',
```

Feel free to fill the rest of the information.

2. Create at least an article

Under the **collection type** menu click **Articles**, then create an article.

> :warning: **Do not forget to add an author to the article and set the article status to published** !
3. Add the correct permissions.

Click on the **Roles & Permissions** tabs, then add the permission following [this file](by following the steps [here](https://astroplant.gitbook.io/community-platform/)).

You should be able to set up the front end by following the steps [here](https://github.com/AstroPlant/community-platform).

0 comments on commit a61265c

Please sign in to comment.