Skip to content

Commit

Permalink
Merge pull request #3 from ideadapt/dev-setup-4DAUs
Browse files Browse the repository at this point in the history
Dev Setup 4 DAUs
  • Loading branch information
moritzvieli committed Aug 17, 2018
2 parents dd7aef8 + b3ce434 commit 8128539
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 19 deletions.
22 changes: 15 additions & 7 deletions README.md
Expand Up @@ -3,22 +3,30 @@ A tool to automate your DMX and videoshow.

## For developers
### Development
Access the web api with the following url: http://localhost:8080/ROOT/api/status/, after deploying it in your local Apache Tomcat.

During development, the following commands can be used for the Angular 4 web application:
```shell
cd src/main/webapp
ng serve --base-href /
```
1. `mvn install`
2. Start API server: `docker-compose down && docker-compose up`
3. Start web frontend server: `cd src/main/webapp && npx ng serve --base-href /`

The app is then accessible under http://localhost:4200.
Verify web api works: http://localhost:8080/api/system/state \
Open web application: http://localhost:4200

### Build
The Java web archive (WAR) can be built using this command:
```shell
mvn install
```

### Build
#### Troubleshooting tomcat issues during development
Login to docker container and inspect logs:
`$ docker-compose down && docker-compose up` \
`$ docker exec -it rocketshow_tomcat_1 /bin/bash` \
`# cat logs/localhost*`

Open tomcat manager in browser: http://localhost:8080/manager/ \
Username tomcat, password 1234

### Deployment
#### Seed directory
The seed directory structure /install/rocketshow can be packed on a mac with this commands (assuming you're currently in the install directory):
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,11 @@
version: '2.0'

services:
tomcat:
image: tomcat:8.0.53-jre8
ports:
- "8080:8080"
volumes:
- ./tomcat-users.xml:/usr/local/tomcat/conf/tomcat-users.xml
- ./target/ROOT.war:/usr/local/tomcat/webapps/ROOT.war
- ./target/ROOT:/usr/local/tomcat/webapps/ROOT
9 changes: 5 additions & 4 deletions pom.xml
Expand Up @@ -60,14 +60,15 @@
<phase>generate-sources</phase>
<configuration>
<workingDirectory>${project.basedir}/src/main/webapp</workingDirectory>
<executable>ng</executable>
<executable>npx</executable>
<arguments>
<argument>ng</argument>
<argument>build</argument>
<argument>--base-href=/app/</argument>
<argument>--environment=prod</argument>

<!-- No caching to make sure, the newest version will always be loaded
(e.g. after an update). Caching anyways only has a small impact, because
<!-- No caching to make sure, the newest version will always be loaded
(e.g. after an update). Caching anyways only has a small impact, because
the devices are most probably run in an internal network. -->
<argument>--output-hashing=all</argument>
</arguments>
Expand All @@ -81,7 +82,7 @@
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/ascargon/rocketshow/Manager.java
Expand Up @@ -92,7 +92,7 @@ public void reconnectMidiDevices() throws MidiUnavailableException {
/**
* Connect to the MIDI out device. Also call this method, if you change the
* settings or want to reconnect the device.
*
*
* @throws MidiUnavailableException
*/
public void connectMidiSender() throws MidiUnavailableException {
Expand Down Expand Up @@ -189,8 +189,8 @@ public void load() throws IOException {
logger.info("Initialize...");

// Setup iptables, because it's not working properly in pi-gen distro generation
new ShellManager(new String[] {"sudo", "iptables", "-t", "nat", "-A", "POSTROUTING", "-o", "eth0", "-j", "MASQUERADE"});
//new ShellManager(new String[] {"sudo", "iptables", "-t", "nat", "-A", "POSTROUTING", "-o", "eth0", "-j", "MASQUERADE"});

// Initialize the player
player = new Player(this);

Expand Down
7 changes: 2 additions & 5 deletions src/main/webapp/src/environments/environment.ts
Expand Up @@ -6,11 +6,8 @@
export const environment = {
production: false,
name: "dev",

// Add the local backend to test
// Uncomment this line for a local tomcat deployment
localBackend: "localhost:8080/ROOT",

//localBackend: "rocketshow.local",
localBackend: "localhost:8080",
debug: true
};
4 changes: 4 additions & 0 deletions tomcat-users.xml
@@ -0,0 +1,4 @@
<tomcat-users>
<role rolename="admin-gui"/>
<user username="tomcat" password="1234" roles="manager-gui"/>
</tomcat-users>

0 comments on commit 8128539

Please sign in to comment.