kblincoe / QualOpt_SE701

2 stars 15 forks source link

Create a batch file to launch QualOpt #50

Open JGud007 opened 6 years ago

JGud007 commented 6 years ago

Create a batch file which can be used to launch QualOpt, this would involve running both mvnw and yarn start. This would be a small task however would add convenience for all developers.

JGud007 commented 6 years ago

@softeng-701

TheGuardianWolf commented 6 years ago

As a sidenote to this issue, I've made dev editions of those docker scripts. This doesn't really fit in with how the repo is developed currently so I'll leave it here instead so people can start using it if needed.

Using this method, you don't need to install JDK, Node.js or pollute your user directory with the maven packages.

Install docker and run docker-compose up with these files in your project folder, it should set up the required environment and link with the project folder. Whatever changes are made in the folder will be seen in the VM and rebuilt. You can still access the site at localhost:8080 (not sure if this has hot reload) or localhost:9000 (webpack hot reload server).

Issue #51 is relevant here if there's an error with Maven.

Dockerfile

FROM openjdk:8-jdk-alpine

ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
    JHIPSTER_SLEEP=0 \
    JAVA_OPTS=""

# Set the working directory
WORKDIR /qualopt

# # Copy the current directory contents into the container
ADD . /qualopt

# Make port 8080 available to the world outside this container
EXPOSE 8080
EXPOSE 9000
EXPOSE 3001

RUN apk add --update nodejs bash

RUN npm install -g yarn

RUN ./mvnw -Pdev package

# Run app when the container launches
CMD ["/bin/bash", "-c", "./mvnw & yarn install && yarn start"]

docker-compose.yml

version: '2'
services:
    qualopt-app:
        build: .
        command: /bin/bash -c './mvnw & yarn install && yarn start'
        stdin_open: true
        tty: true
        environment:
            - SPRING_PROFILES_ACTIVE=prod,swagger
            - SPRING_DATASOURCE_URL=jdbc:mysql://qualopt-mysql:3306/qualopt?useUnicode=true&characterEncoding=utf8&useSSL=false
        ports:
            - 8080:8080
            - 9000:9000
            - 3001:3001
        volumes:
            - './:/qualopt'
        links:
            - qualopt-mysql
    qualopt-mysql:
        image: mysql:5.7.18
        environment:
            - MYSQL_USER=root
            - MYSQL_ALLOW_EMPTY_PASSWORD=yes
            - MYSQL_DATABASE=qualopt
        ports:
            - 3306:3306
        command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8 --explicit_defaults_for_timestamp
JGud007 commented 6 years ago

Additionally could also make a batch file for testing.

softeng-701 commented 6 years ago

@JGud007 Medium works? Specify the size in all future requests.

JGud007 commented 6 years ago

@softeng-701 medium is good, I did write small in the original item but if it includes testing then medium seems good.

softeng-701 commented 6 years ago

@JGud007 APPROVED!

JGud007 commented 6 years ago

claiming this one