diff --git a/.gitignore b/.gitignore index 722d5e7..619faf7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,32 @@ +# Editor Stuff .vscode +.idea + +# Environment +.env + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +.vite +dist +dist-ssr +*.local +deno.lock +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..de739fc --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 MDG Space + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 666d6ac..c358263 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,36 @@ # Domain-Forge -_DomainForge is an innovative tool that is designed to help members of MDG space -generate dynamic subdomains. It is a highly effective subdomain generator that -maps user resources to each subdomain, making it easier for users to manage -their different projects and resources._ +![GitHub License](https://img.shields.io/github/license/mdgspace/domain-forge) +![GitHub issues](https://img.shields.io/github/issues/mdgspace/domain-forge) +![GitHub Repo stars](https://img.shields.io/github/stars/mdgspace/domain-forge) +![GitHub forks](https://img.shields.io/github/forks/mdgspace/domain-forge) +![GitHub watchers](https://img.shields.io/github/watchers/mdgspace/domain-forge) -Find product related research + +_DomainForge serves as a versatile tool for creating dynamic subdomains, while also providing storage and computing capabilities to members of your organization. Moreover, it simplifies the setup process by seamlessly transitioning from a GitHub repository to the build phase. This all-inclusive solution enhances operational efficiency, empowering members with a streamlined and automated workflow from repository setup to deployment._ + +> Find product related research [here](https://obvious-acrylic-f12.notion.site/DomainForge-A-dynamic-sub-domain-creator-e860af60894e4a3bb0482ea3dd746451) + +## Installation + +This section is designated for organizational administrators who leverage this tool to facilitate the creation of dynamic subdomains, while also furnishing storage and computing functionalities to members of the organization. For comprehensive installation guidelines, please refer to this [documentation](./docs/admin/README.md). + +## Usage + +This section is relevant to the users of the tool. For detailed guidance on effectively leveraging this tool to deploy your projects within your organization, please refer to this [documentation](./docs/users/README.md) for comprehensive instructions. + +## License + +[MIT](./LICENSE.md) + +## Contributing + +We welcome pull requests. If you're considering significant changes, please initiate a discussion by opening an issue first. Additionally, please ensure your commits follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) format. + +Thank you to everyone who's already contributed! + +![](https://contrib.rocks/image?repo=mdgspace/domain-forge) + +*If you find this tool useful, consider leaving a :star:.* +Made with :heart: by **MDG Space** diff --git a/docker/.dockerignore b/docker/.dockerignore index e69de29..61de9f3 100644 --- a/docker/.dockerignore +++ b/docker/.dockerignore @@ -0,0 +1,40 @@ +# Environment +.env + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +.vite +dist +dist-ssr +*.local +deno.lock + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +# Version control +.git +.gitignore + +# Docker +.dockerignore +Dockerfile.backend +Dockerfile.frontend +docker-compose.yml +dev.docker-compose.yml diff --git a/docker/.gitignore b/docker/.gitignore deleted file mode 100644 index 4c49bd7..0000000 --- a/docker/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.env diff --git a/docker/dev.docker-compose.yml b/docker/dev.docker-compose.yml index e69de29..98f8eb2 100644 --- a/docker/dev.docker-compose.yml +++ b/docker/dev.docker-compose.yml @@ -0,0 +1,29 @@ +version: "3.9" + +services: + deno: + container_name: df_backend + image: df_backend + restart: always + volumes: + - type: bind + source: ../docker/named_pipe + target: /hostpipe + build: + context: .. + dockerfile: docker/Dockerfile.backend + target: base + ports: + - "${PORT_BACKEND}:7000" + env_file: + - ../src/backend/.env + vue: + container_name: df_frontend + image: df_frontend + restart: always + build: + context: .. + dockerfile: docker/Dockerfile.frontend + target: base + ports: + - "${PORT_FRONTEND}:8000" diff --git a/docs/.gitkeep b/docs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docs/admin/README.md b/docs/admin/README.md new file mode 100644 index 0000000..8bbabc8 --- /dev/null +++ b/docs/admin/README.md @@ -0,0 +1,64 @@ +# Installation + +### 1. Clone the Repository + +Run the following command on your server to clone the repository. +```bash + git clone https://github.com/mdgspace/domain-forge.git +``` + +### 2. Configuring the Environment Variables + +This step involves the configuration of three `.env` files: +- Docker env: + As suggested in the `.env.sample` present at the `docker/` directory, create a file named `.env` and copy the contents as shown, replacing *"XXXX"* by the frontend and backend ports you want your application to run on. + ``` + PORT_BACKEND=XXXX + PORT_FRONTEND=XXXX + ``` +- Backend env: + As suggested in the `.env.sample` present at the `src/backend` directory, create a file named `.env` and copy the contents as shown, replacing *"..."* with the respective values for your registered github oauth application's **GITHUB_OAUTH_CLIENT_ID** and **GITHUB_OAUTH_CLIENT_SECRET**. Fill in the **MONGO_API_KEY** and **MONGO_APP_ID** you obtain upon creating a cluster in *MongoDB Atlas* + ``` + GITHUB_OAUTH_CLIENT_ID=... + GITHUB_OAUTH_CLIENT_SECRET=... + MONGO_API_KEY=... + MONGO_APP_ID=... + ``` +- Frontend env: + As suggested in the `.env.sample` present at the `src/frontend` directory, create a file named `.env` and copy the contents as shown, replacing *"..."* with the respective values for your registered github oauth application's **VITE_APP_GITHUB_OAUTH_CLIENT_ID** and **VITE_APP_GITHUB_OAUTH_CLIENT_SECRET**. For the **VITE_APP_GITHUB_OAUTH_REDIRECT_URL** enter the public url of the application's `/login` route. (Example: `http://df.mdgspace.org/login`). Also, add the port at which your backend is running in place of *"XXXX"*. + ``` + VITE_APP_GITHUB_OAUTH_CLIENT_ID=... + VITE_APP_GITHUB_OAUTH_CLIENT_SECRET=... + VITE_APP_GITHUB_OAUTH_REDIRECT_URL=... + VITE_APP_BACKEND_PORT=XXXX + ``` + +### 3. Build Docker Image + +> If you do not have docker installed on your system, visit [this](https://docs.docker.com/engine/install/). + +Navigate to the `docker` directory and build the images in the background using the following command. +```bash +cd docker/ +docker compose up --build -d +``` + +### 4. Setup Named Pipes + +Navigate to the `docker/named_pipe` directory and execute the `listen.sh` script to allow the application to run commands on the host. +```bash +cd docker/named_pipe +./listen.sh +``` +> Make sure to check the permissions of the `listen.sh` file. You can change them using the `chmod` command. + +### 5. Installing and Configuring NGINX + +Install NGINX on your server from [here](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/). +Refer to [this](https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04) to configure NGINX to serve your application. + +### 6. Adding the DNS Records and Issue SSL Certificates + +Refer to [this](https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/) to add DNS records for *df.yourorgname.com* and also a wildcard DNS record for **.df.yourorgname.com* + +You can use [letsencrypt](https://letsencrypt.org/) to issue SSL certificates for *df.yourorgname.com* and a wildcard SSL certificate for **.df.yourorgname.com*. diff --git a/docs/assets/add-domain.png b/docs/assets/add-domain.png new file mode 100644 index 0000000..2bbc4d4 Binary files /dev/null and b/docs/assets/add-domain.png differ diff --git a/docs/assets/delete-domain.png b/docs/assets/delete-domain.png new file mode 100644 index 0000000..ebe7cbc Binary files /dev/null and b/docs/assets/delete-domain.png differ diff --git a/docs/assets/index-page.png b/docs/assets/index-page.png new file mode 100644 index 0000000..7509bb2 Binary files /dev/null and b/docs/assets/index-page.png differ diff --git a/docs/assets/login-page.png b/docs/assets/login-page.png new file mode 100644 index 0000000..eb2f626 Binary files /dev/null and b/docs/assets/login-page.png differ diff --git a/docs/users/README.md b/docs/users/README.md new file mode 100644 index 0000000..9620ba3 --- /dev/null +++ b/docs/users/README.md @@ -0,0 +1,33 @@ +# Usage + +### Login + +![](../assets/login-page.png) +Authenticate using your *GitHub* or *GitLab* credentials to access the index page. +![](../assets/index-page.png) + +### Adding subdomains + +You can click on the **+ Add** button to add subdomains. Your resource can be of three types: +- **URL**: Enter the URL pointing to your resource. +- **PORT**: If your resource is actively hosted on your server, indicate the specific PORT it is running on +- **GITHUB**: Provide a link to your public github repository here. + * If your repository has any environment variables in the root directory, specify their values in the given text box in the following format: + ``` + key1=value1 + key2=value2 + ``` + * If your repository does not have static content, specify the *techstack* used and the *port* your application would be running on. You also have to specify the *BUILD* and *RUN* commands in the text box mentioned. + > For example, if you have a Django application you will have the following *BUILD* and *RUN* commands: + > ```sh + > python manage.py makemigrations + > python manage.py migrate + > python manage.py runserver 0.0.0.0:8000 + > ``` + +![](../assets/add-domain.png) + +### Deleting subdomains + +Click on the **Delete** button to remove any existing subdomains. +![](../assets/delete-domain.png) \ No newline at end of file diff --git a/src/backend/.gitignore b/src/backend/.gitignore deleted file mode 100644 index 4c49bd7..0000000 --- a/src/backend/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.env diff --git a/src/backend/dependencies.ts b/src/backend/dependencies.ts index 054c605..a66ee4d 100644 --- a/src/backend/dependencies.ts +++ b/src/backend/dependencies.ts @@ -6,4 +6,5 @@ import { import { Session } from "https://deno.land/x/oak_sessions@v4.1.9/mod.ts"; import { create, verify } from "https://deno.land/x/djwt@v2.9.1/mod.ts"; import { exec } from "https://deno.land/x/exec/mod.ts"; + export { Application, Context, create, exec, Router, Session, verify }; diff --git a/src/frontend/.gitignore b/src/frontend/.gitignore deleted file mode 100644 index 4cbd838..0000000 --- a/src/frontend/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -lerna-debug.log* - -node_modules -.vite -dist -dist-ssr -*.local -deno.lock -.env -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw?