Skip to content

ASAH-Bangkit-2023/CC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

☁️ASAH: Cloud Computing

πŸ“‘About Our Project

ASAH (Aplikasi Sortir Sampah) is an application aimed at encouraging the community to manage waste in an appropriate manner and provides rewards when users successfully manage their waste correctly. In our application, users are required to sort their waste first, and then they can dispose of or donate their waste to recycling agencies in their vicinity.

πŸ–₯️Related Project Repositories

Here are some of the related repositories which are part of the same project:

Repository Link
πŸ“± Mobile Development MD Repository
πŸ€– Machine Learning ML Repository

πŸ‘·β€β™‚οΈCGP Architecture

πŸ’ΌAPI Documentation

To access the API documentation, you can visit the following link API Documentation

πŸ“‹Deployment Steps

1. Cloud SQL πŸ’Ύ

  • After filling in the instance ID and password, scroll down to create the instance

  • Change the network to public in order to make it accessible to clients

  • Once done, save the changes

2. Cloud Storage πŸ›’

  • Click on "Create Bucket."

  • After clicking "Create," fill in the "Bucket Name" field according to your needs

  • In the "Choose how to control access to objects" section, uncheck the "Enforce public access prevention on this bucket" option

  • After that, click on "Continue" and then click on "Create"
  • Once the bucket is created, click on "Permissions" as it is still set to "Not Public"

  • Next, scroll down to "+ Add access control entry" or "+ Grant access" button

  • Add the following entries in the "New principals" section: "allUsers" and "allAuthenticatedUsers." Set the role as "Storage Viewer"

  • Click on "Save" and you're done

3. Create Maps API Key πŸ”‘

  • Search β€œGoogle Maps ” pada bagian search di GCP

  • Click on the "APIs" section and scroll down until you find the "Additional APIs" section
  • Choose the desired API from the available options

  • Once you have made your selection, click on it, and then click on "Enable"
  • Then, navigate to the "Credentials" section and choose the Google Maps Platform API for which you want to create a key

  • Once done, click on the "+CREATE CREDENTIALS" button

  • After clicking "+CREATE CREDENTIALS"

  • Select "API key" and start creating the API key

  • After that, the API key will appear

  • The API key has been handed over to the MD team for their use

4. Prepare FastAPI (Using this exist repository) πŸ”₯

  • Clone the repository from the existing repo:
 git clone https://github.com/your-repo.git

5. Prepare Dockerfile πŸ“„

  • Setting up a Dockerfile for deployment
FROM python:3.11-slim

ENV PYTHONUNBUFFERED True

ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./

ENV PORT 1234
ENV MYSQL_URL "mysql+pymysql://root:PASSWORD@SERVER-IP:PORT/NAME DATABASE"
ENV JWT_SECRET_KEY "SECRET KEY"  
ENV JWT_REFRESH_SECRET_KEY "REFRESH SECRET KEY" 

RUN pip install --no-cache-dir -r requirements.txt

CMD exec uvicorn main:app --host 0.0.0.0 --port ${PORT}

6. Cloud Run πŸƒβ€β™‚οΈβ˜οΈ

  • Click on "Create Service"

  • Select "Continuously deploy new revisions from a source repository" to create CI/CD (Continuous Integration/Continuous Deployment)

  • Connect to GitHub and select the desired repository
  • Next, choose "Build Configuration" with Dockerfile
  • Then, leave everything else as default, and in the authentication section, select "Allow unauthenticated invocations" to make it accessible to the public

  • Once you have selected "Allow unauthenticated invocations," click on "Create"
  • After that, the website will be successfully deployed.

7. Testing the Application πŸ“±πŸ“Ÿ

  • To test the deployed application, you can use tools like curl or API testing tools like Postman. Here is an example of how to test the API using curl:
curl -X GET https://your-app-url.com/api/endpoint
  • Replace your-app-url.com with the actual URL of your deployed application and /api/endpoint with the desired endpoint to test.

  • You can also use Postman to send requests to the API and verify the responses.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors