This project was developed by (Romain Bidault).
It is a web application with a custom API to generate virtual machines with Microsoft Azure.
Minimum Node.js version: v16
Minimum NPM version: v8 (will be installed with Node.js)
Express: A server-side JavaScript runtime environment.
Next.js: A React framework for building server-side rendered and statically generated web applications.
Express: A fast and minimalistic Node.js web application framework for building APIs and server-side applications.
Azure SDK: A library that enables interaction with various Azure services for cloud computing and management.
In the client folder, change the localhost in the .env file to the machine's IP address:
NEXT_PUBLIC_API_URL="http:https://{your ip}:3030/api"
In the server folder, change the following IDs in the .env file to your Azure IDs:
AZURE_TENANT_ID={your_tenant_id}
AZURE_CLIENT_ID={your_client_id}
AZURE_CLIENT_SECRET={your_client_secret}
AZURE_SUBSCRIPTION_ID={your_subscription_id}
DELETE_TIME={time to delete vm in ms}
To start the application, go to the root of the project and run the following command:
npm run start
npm install tr46@latest
cd /server
npm cache clean --force
rm -rf node_modules
rm -rf package-lock.json
npm install
and
cd /client
npm cache clean --force
rm -rf node_modules
rm -rf package-lock.json
npm install
When you see "Server Front started" and "Server Back started" in blue in the terminal, you can open http:https://localhost:3000 to view the application in your browser.
This application has 3 users with different access rights:
Username | Password | Description | |
---|---|---|---|
1 | [email protected] | romaintest | This user has all access and can create several VMs. |
2 | [email protected] | okthibault | This user is limited, they can only create one type of VM (Debian) and only if there are no others active. |
3 | [email protected] | melaniezetofrais | This user has no credit and therefore cannot create a VM. |
You can use these credentials to login to the application, and you can modify them or create another one in the SQLite database server/database/astrocloud.db
file.
Once logged in, you will be redirected to the dashboard.
You can create a VM by clicking on the "Crée une machine" button.
After creating a VM, the VM will be added to the VM list and will be deleted after 10 minutes.
to connect to the vm use this user: AstroCloudAdmin
and this password: AstroCloud%SDV//
.
The application is composed of the following files and folders:
src/app
: The main folder with all pages of this application.src/components
: All React components used in this application.src/index.js
: The React starting code.
public/icon.png
: The icon of the application.public/images
: Folder with other images used in this application.
index.js
: The main file of the backend (Node.js starting code).azure.js
: Contains the code related to VM creation.tools/token.js
: Contains the code to generate tokens for authentication.src/database/astrocloud.db
: Contains all the users and machines of the application (SQLite database).
- table users :
id | name | credit | password | ||
---|---|---|---|---|---|
1 | 1 | JohnDoe | 100 | [email protected] | johndoethebest |
- table machine :
id | name | uptime | active | created_at | id_user | |
---|---|---|---|---|---|---|
1 | 1 | 192.168.0.1 | 10 (minute) | true | 15/07/2023T18:52:00 | 1 |