AutoPacker is an automated software packaging and deployment solution. AutoPacker is a simple, but productive and transparent platform that is cloud-service and hosting independent and offers a way to manage projects, servers, deployment and storage, and being a platform for people to share projects and ideas. AutoPacker was created by three bachelor students at NTNU as a part of their bachelor thesis project.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
AutoPacker consists of several modules, each is a separate sub-project:
- File delivery API - manages projects, modules, dockerfiles and docker-compose blocks.
- General API - REST API for organizations, supported languages and their versions
- Server manager - manages user-owned servers, file upload to servers, etc.
- User service - User management. Talks to a Keycloak service for authentication.
Except the Web application, all other sub-projects have a REST API interface. I.e., Web application is a REST client while all other modules are REST servers.
To run the system you need to run all these modules. See the "Installing" section for instructions.
To develop the projects, you need the following services deployed somewhere:
- KeyCloak authentication server. Here is a tutorial on how to set up your own Keycloak authentication server. You can also use docker to setup a keycloak server. See here for documentation on configuring keycloak with external database.
- SMTP server for email delivery (For example, Google's SMTP server: host=smtp.gmai.com, port:587, username=your-gmail-email-address, password=your-gmail-password, auth=true, use-tls=true).
In addition, you need the following tools on your computer:
- Java 11
- A Java project editor, such as IntelliJ
- Javascript, HTML, CSS Editor, such as WebStorm
- Yarn package manager
- Docker
The first section describes general requirements - for all the modules. The following sections describe setup steps for each module of the project. Web application depends on all other modules.
All the server-side (backend) modules have two requirements which must be met:
- A KeyCloak authentication server. This is needed to authorize users. You can set up your own KeyCloak server. If you want to use a predefined KeyCloak server for testing, take contact with AutoPacker developers.
- Each module (file delivery, general API, server manager, and user service) use a MySQL for data storage. You must provide a database for each module. It is up to you to choose either to have a single shared DB for all the projects, or to have a separate DB for each project. The important thing is that you must provide a MySQL database - just an empty database, the modules will set up necessary tables. You can choose whether to run a MySQL container in a Docker container, have a Local MySQL installation, or use a remote MySQL database. The modules need only to have a URL to a MySQL server, database name, user and password.
To run the User Service:
- Set up a MySQL database.
- Create
application.yml
file in thesrc/main/resouces
directory (take a copy of thetemplate.application.yml
file, fill in the values according to your implementation). - Run the project with either
mvn spring-boot:run
in the terminal, or launch theUserServiceApplication
class from your IDE.
File Delivery API has one extra requirement: a MongoDB database. Steps for running File Delivery API:
- Set up a MongoDB database.
- Set up a MySQL database.
- Create
application.properties
file in thesrc/main/resouces
directory (take a copy of thetemplate.application.properties
file, fill in the values according to your implementation). In case if you want to run different setups for development and production environments, you can create several property files, for example,application-dev.properties
. Then you need to add a switch for the maven command when running it:-Dspring-boot.run.profiles=dev
. - Create
application.yml
file in thesrc/main/resouces
directory (take a copy of thetemplate.application.yml
file, fill in the values according to your implementation). - Run the project with either
mvn spring-boot:run
in the terminal, or launch theFileDeliveryApiApplication
class from your IDE. If you use specificapplication.properties
files, for example,application-dev.properties
, you can specify which.properties
configuration to use, for example:mvn spring-boot:run -Dspring-boot.run.profiles=dev
will useapplication-dev.properties
.
To run the User Service:
- Set up a MySQL database.
- Create
application.yml
file in thesrc/main/resouces
directory (take a copy of thetemplate.application.yml
file, fill in the values according to your implementation). - Run the project with either
mvn spring-boot:run
in the terminal, or launch theServerManagerApplication
class from your IDE.
The web module is a React application. You need to install the dependencies (Javascript libraries) for the project first: run yarn install
in the project directory.
To run a debug-version (during development), run yarn start
in the project directory.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits. You will also see any lint errors in the console.
Run yarn build
to get a minified production-ready version of the site, it will be stored in the build
directory.
We have created a docker image called autopacker/local-config-server that will distribute application.yml properties to the backend services without needing specify the values yourself. The only requirement to use this option is that the mysql database username is root and the password is left empty. The Mongo database also has the username root, but the password here is: password.
If you are using docker you can easily setup the whole working environment with four steps. If you copy paste all the code lines below you should have a fully working development environment running on your machine!
We have created a local development keycloak server that can be run with:
docker container run -d --name keycloak -p 8080:8080 autopacker/local-keycloak
This will setup a local keycloak server on your host computer with the admin credentials (username: admin, password: admin). It also holds an example user (username: user, password: user)
Just creating a mysql container with a desired database set as environment property:
docker container run -d --name mysql-backend -p 3306:3306 -e MYSQL_DATABASE=autopacker -e MYSQL_USER=root -e MYSQL_PASSWORD= -e MYSQL_ALLOW_EMPTY_PASSWORD=1 autopacker/local-mysql-backend
docker run --name mongodb -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=password -dp 27017:27017 mongo
Using this pre-created local config server you don't have to specify any properties unless you use custom values deviating from the database credentials mentioned further up. The config server is run with:
docker container run -d --name config-server -p 8888:8888 autopacker/local-config-server
When you have the four containers (MySQL, Mongo, Keycloak, Config Server) up and running you should be ready to start developing. Just run the backend services and they should be able to connect to the other services without any problems
TODO - Explain how to run the automated tests for this system
TODO Add additional notes about how to deploy this on a live system.
- Aron Mar Nicholasson
- Liban Bashir Nor
- Bendik Uglem Nogva
- Girts Strazdins
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details