Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/miou-zora/area
Ifttt replica using ReactJS / ReactNative for front and NestJS for back (with deployement on Oracle Cloud Plateform)
https://github.com/miou-zora/area
docker-compose mobile nestjs oracle-cloud-platform react react-native server web
Last synced: about 9 hours ago
JSON representation
Ifttt replica using ReactJS / ReactNative for front and NestJS for back (with deployement on Oracle Cloud Plateform)
- Host: GitHub
- URL: https://github.com/miou-zora/area
- Owner: Miou-zora
- Created: 2024-05-04T20:55:03.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-06-19T01:58:29.000Z (8 months ago)
- Last Synced: 2024-12-04T09:06:40.692Z (about 2 months ago)
- Topics: docker-compose, mobile, nestjs, oracle-cloud-platform, react, react-native, server, web
- Language: TypeScript
- Homepage:
- Size: 2.16 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# Project Start
## How to use
### StartYou need to have [Docker](https://www.docker.com/) installed on your computer.
You also need to have a `.env` file in the root folder of the project with the following lines:
```env
POSTGRES_USER=The user you want to use to connect to the database like 'postgres'
POSTGRES_PASSWORD=The password you want to use to connect to the database like '123'
POSTGRES_DB=Name of the database you want to use like 'nest'
SERVER_IP=Ip of the server like 'http://localhost'
SERVER_PORT=Port of the server like '8080'
WEB_IP=Ip of the web app like 'http://localhost'
WEB_PORT=Port of the web app like '8081'
GOOGLE_CLIENT_ID=Your GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET=Your GOOGLE_CLIENT_SECRET
GITHUB_CLIENT_ID=Your GITHUB_CLIENT_ID
GITHUB_CLIENT_SECRET=Your GITHUB_CLIENT_SECRET
DISCORD_CLIENT_ID=Your DISCORD_CLIENT_ID
DISCORD_CLIENT_SECRET=Your DISCORD_CLIENT_SECRET
DISCORD_REDIRECT_URI=Your redirect url from the Redirects in the applications of Discord like 'services/discord/callback'
DISCORD_BOT_TOKEN=Your DISCORD_BOT_TOKEN
PGADMIN_DEFAULT_EMAIL=Email of the pgadmin user like '[email protected]'
PGADMIN_DEFAULT_PASSWORD=Password of the pgadmin user like '123'
SPOTIFY_CLIENT_ID=Your SPOTIFY_CLIENT_ID
SPOTIFY_CLIENT_SECRET=Your SPOTIFY_CLIENT_SECRET
```You can start the project with the following command:
```bash
docker-compose -f docker-compose[.dev|.prod].yml up [-d] [--build]
# -f to specify the file to use, you can use docker-compose.dev.yml to use the dev version, it will enable the hot reload. (it will use Dockerfile.dev instead of Dockerfile)
# -d to run it in background
# --build to rebuild the images rather that running build each time
```
(you can remove -d to see the logs)It will start each part of the projects in this order:
- The database
- The backend
- The setup of the database using a backend image
- The mobile app
- The web app### Stop
You can stop the project with the following command:
```bash
docker-compose -f docker-compose[.dev|.prod].yml down [--volumes] [--remove-orphans] [--rmi local]
# --volumes to remove the volumes
# --remove-orphans to remove the containers that are not in the docker-compose.yml file
# --rmi local to remove all the images, you can also use 'all' to remove all the images
```### Update images
You can update the images of the project with the following command:
(don't forget to stop the project before [Stop](#stop))```bash
docker-compose -f docker-compose[.dev|.prod].yml build
```(It's quite useless as long as we use compose up command with `--build` flag, but it can be useful if you want to build the images without starting the project like for the deployement)
### Clean images
You can clean the images of the project with the following command:
```bash
docker image prune
```It will remove all the images that are not used by a container like `` images generated by the build command.
### Mobile (dev)
#### Setup
##### Build app
We can't access mobile through docker compose, so you need to run the following commands:
```bash
cd mobile
npm install
# Install apk on your device (emulator or physical device)
# YOUR_DEVICE_ID is the id of your device, you can get it with `adb devices` command and YOUR_TERMINAL is the terminal you want to use to see the logs, you can use `cmd` for windows or `bash` for linux.
npm run android -- --deviceId=YOUR_DEVICE_ID --terminal=YOUR_TERMINAL
```
After that, it will open a new terminal. You can close it using ctrl+c and it will download the app on your device using first terminal.
Now you can basically run the app using the following command:##### Environment variables
You need to have a `.env` file in the mobile folder of the project with the following lines:
```env
REACT_APP_SERVER_IP=Ip of the server like 'http://localhost' or 'http://10.0.2.2' for android emulator
REACT_APP_SERVER_PORT=Port of the server like '8080'
REACT_APP_WEB_IP=Ip of the server like 'http://localhost' or 'http://10.0.2.2' for android emulator
REACT_APP_WEB_PORT=Port of the server like '8081'
REACT_APP_GOOGLE_CLIENT_ID=id of google (same as the one in root)
```#### Start
```bash
npm start
```(If app doesn't reload automaticaly, you can reload it manually on your device (`r` + `r` on android emulator))
### PgAdmin
You can access the pgadmin interface at the following url: http://localhost:8083
You must connect with the email and password you set in the `.env` file.
After that you can add a new server with the following informations:
- Name: `It can be anything`
- Host name/address: `db`
- Port: `5432`
- Username: `It should be defined in the .env file as POSTGRES_USER`
- Password: `It should be defined in the .env file as POSTGRES_PASSWORD`## Deployement
### Setup
You need to have [Ansible](https://www.ansible.com/) installed on your computer.
You also need to have a Compute instance on [Oracle Cloud Infrastructure](cloud.oracle.com) with VM.Standard3.Flex (Intel) shape with Oracle Linux 8.9 as operating system (We currently use 2 OCPU with 10GB of memory and it works very well). You also need to have a public IP address on this instance. (You can use the free tier to have a public IP address). You also need to register your ssh public key on the instance.You need to create a `inventory` file like `inventory.example` file with corresponding informations:
```ini
[area]
YOUR_PUBLIC_IP_ADDRESS ansible_user=YOUR_USERNAME
```After that, you just need to run the following command:
```bash
./deploy.sh
```It will clone the project on the remote server, copy local `.env` and install docker and docker-compose.
After that you need to connect to the remote server, move to Area folder and run the following command:
```bash
docker-compose -f docker-compose.prod.yml up -d --build
```It will start each part of the projects.
/!\ Don't forget that it will copy local `.env` file, so you need to have the `.env` file with the correct informations on your computer /!\