-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7cf3b8b
commit 915bec6
Showing
2 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,72 @@ | ||
# Waistline API | ||
|
||
External data collection service from [Waistline](https://github.com/davidhealey/waistline/) | ||
External data collection service from [Waistline](https://github.com/davidhealey/waistline/).<br/> | ||
This API is designed to receive data from the app thanks to the "Data sharing" feature. | ||
|
||
## Stack | ||
- **Framework**: [Symfony](https://symfony.com/) | ||
It's built with Symfony, Postgres, and MongoDB. | ||
|
||
## Build custom Docker image | ||
I created this service to centralize all my statistics from Waistline and be able to consult my data from an API endpoint.<br/> | ||
This endpoint allows me to visualize my stats in a Grafana dashboard. | ||
|
||
<img src="docs/img/grafana-dashboard.png" title="Grafana Dashboard" alt="Screenshot from my Grafana Dashboard" /> | ||
|
||
## Links | ||
- [Documentation]() — Learn how to use Waistline API (Will come soon...) | ||
- [Docker Hub](https://hub.docker.com/r/waistlineapi/waistline-api) — Find all docker images | ||
|
||
## Installation | ||
|
||
### Docker Compose [Recommended] | ||
|
||
#### Step 1 - Download the required files | ||
Create a directory of your choice (e.g. `./waistline-api`) to hold the `docker-compose.yml` and `.env.local` files. | ||
|
||
```bash title="Move to the directory you created" | ||
mkdir waistline-api | ||
cd ./waistline-api | ||
``` | ||
docker build -t waistline-api:latest . | ||
Download `docker-compose.yml` and `.env` by running the following commands: | ||
|
||
```bash title="Get docker-compose.yml file" | ||
wget https://raw.githubusercontent.com/hippothomas/waistline-api/master/docker-compose.yml | ||
``` | ||
|
||
```bash title="Get .env file" | ||
wget -O .env.local https://raw.githubusercontent.com/hippothomas/waistline-api/master/.env | ||
``` | ||
|
||
#### Step 2 - Populate the .env file with custom values | ||
You should change these values for security reason: | ||
```dotenv | ||
APP_ENV= # Set it to "prod" | ||
APP_SECRET= # You should generate a new app secret | ||
APP_BASE_URL= # The url of the app (without the ending /) | ||
DATABASE_URL= # Your database connection string | ||
MONGODB_URL= # Your mongodb connection string | ||
``` | ||
You should also change the values in consequence in the `docker-compose.yml`. | ||
|
||
#### Step 3 - Start the containers | ||
From the directory you created in Step 1, run: | ||
|
||
```bash title="Start the containers using docker compose command" | ||
docker compose up -d | ||
``` | ||
|
||
#### Step 4 - Execute migrations | ||
Once the containers are up and running, you may have to execute these commands to instantiate the database and reset the cache: | ||
|
||
```shell | ||
docker exec -it waistline-api /bin/sh | ||
php bin/console doctrine:migrations:migrate --quiet | ||
php bin/console cache:clear --quiet | ||
exit | ||
``` | ||
|
||
## Contributing | ||
Contributions, suggestions, bug reports and fixes are welcome! | ||
|
||
For new features, filters, or endpoints, please open an issue and discuss before sending a PR. | ||
|
||
## License | ||
See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.