Skip to content

Commit 5eb8d1a

Browse files
committed
Merge branch 'develop'
2 parents 8600739 + 9db3302 commit 5eb8d1a

9 files changed

Lines changed: 192 additions & 44 deletions

File tree

README.md

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,20 @@
77
[![Coverage Status](https://coveralls.io/repos/github/CodeChillAlluna/code-chill/badge.svg?branch=master)](https://coveralls.io/github/CodeChillAlluna/code-chill?branch=master)
88

99
Master project : Online development environment
10+
# Summary
11+
* If you want to install our latest release click [here](#release-installation-guide)
12+
* If you want to set up our project from scratch using our vagrant click [here](#vagrant-installation-guide)
13+
* If you want to set up our project without vagrant click [here](#vagrantless-installation-guide)
14+
# Release installation guide
15+
* You need <a href="http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html">Java 8+</a> and <a href="https://nodejs.org/en/">NodeJS 9+</a>.
16+
* You can install Code&Chill <a href="https://github.com/CodeChillAlluna/code-chill/releases">here</a>.
17+
* Go to your spring repository : `cd ./spring`
18+
* Run the command : `java -jar spring-0.1.0.jar`
19+
* And then : `npm install serve`
20+
* To run the server : `serve -s client`
21+
* You can go to <a href="http://localhost:5000/">http://localhost:5000/</a> on your browser to access to your terminal.
1022

11-
# Installation guide
23+
# Vagrant installation guide
1224
## Environment installation
1325
### Requirements
1426
* **Vagrant** is needed, you can download it here :
@@ -32,20 +44,38 @@ Choose either of the solutions:
3244
- Reload the VM: `vagrant reload`
3345
- Delete the VM: `vagrant destroy`
3446
- Verify packages are up to date: `vagrant provision`
47+
# Vagrantless installation guide
48+
## Environment installation
49+
### Requirements
50+
You will find all our project dependancies in `install/install.sh``
51+
### Download
52+
Choose either of the solutions:
53+
- Cloning the repository : `git clone https://github.com/CodeChillAlluna/code-chill.git`
54+
- Downloading the repository : `https://github.com/CodeChillAlluna/code-chill/archive/master.zip`
55+
56+
# Usage
57+
## Spring
58+
### Build Spring
59+
To build Spring, you will have to use the following command lines :
3560

36-
## Usage
37-
## Build Spring
38-
```BASH
39-
cd src/spring
40-
sh mvnw clean package
41-
cd target
42-
java -jar spring-0.0.1-SNAPSHOT.jar
43-
```
61+
1. `cd src/spring` : will place you in the source dictionnary.
62+
2. `sh mvnw clean package` : will compile java files to create a runnable jar package.
63+
3. `cd target` : will place you in the build dictionnary of the project.
64+
4. `java -jar spring-0.0.1-SNAPSHOT.jar` : will launch the Spring project, depending on what you are using the version might not always be "0.0.1".
65+
### Run Spring
66+
To run Spring in development mode, you will have to use the following command lines :
67+
1. `cd src/spring` : will place you in the source dictionnary.
68+
2. `sh mvnw spring-boot:run`: will compile the source code and launch the spring server
4469

45-
## Build React
46-
```BASH
47-
cd src/client
48-
sudo yarn install # install dependencies
49-
yarn build
50-
serve -s build
51-
```
70+
## React
71+
### Build React
72+
To build React, you will have to use the following command lines :
73+
1. `cd src/client` : will place you in the source dictionnary.
74+
2. `sudo yarn install` : will install if they are missing and update the dependencies of the project.
75+
3. `yarn build` : will build the project.
76+
4. `serve -s build` : will launch the project properly.
77+
### Run React
78+
To run react in development mode, you will have to use the following command lines :
79+
1. `cd src/client` : will place you in the source dictionnary.
80+
2. `sudo yarn install` : will install if they are missing and update the dependencies of the project.
81+
3. `yarn start`: will check your code validity and launch the node server.

install/install.sh

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ print_help () {
2020

2121
export DEBIAN_FRONTEND=noninteractive
2222

23-
if ! grep -qF "sudo mount --bind "$HOME_DIR"/vagrant_node_modules "$client"/node_modules" /home/vagrant/.bashrc
23+
if ! grep -qF "sudo mount --bind $HOME_DIR/vagrant_node_modules $client/node_modules" /home/vagrant/.bashrc
2424
then
25-
echo "sudo mount --bind "$HOME_DIR"/vagrant_node_modules "$client"/node_modules" >> /home/vagrant/.bashrc
25+
echo "sudo mount --bind $HOME_DIR/vagrant_node_modules $client/node_modules" >> /home/vagrant/.bashrc
2626
fi
2727

2828
if ! grep -qF "cd "$vagrant /home/vagrant/.bashrc
@@ -90,19 +90,67 @@ ALTER USER $DB_USER CREATEDB;
9090
EOF
9191

9292
# Installation de Docker
93-
sudo apt-get install -y docker.io
93+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
94+
sudo apt-key fingerprint 0EBFCD88
95+
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
96+
sudo apt-get update
97+
sudo apt-get install docker-ce -y
98+
sudo su -
99+
echo -e "[Unit]
100+
Description=Docker Application Container Engine
101+
Documentation=https://docs.docker.com
102+
After=network-online.target docker.socket firewalld.service
103+
Wants=network-online.target
104+
Requires=docker.socket\n
105+
[Service]
106+
Type=notify
107+
# the default is not to use systemd for cgroups because the delegate issues still
108+
# exists and systemd currently does not support the cgroup feature set required
109+
# for containers run by docker
110+
ExecStart=/usr/bin/dockerd -H=tcp://0.0.0.0:2375
111+
ExecReload=/bin/kill -s HUP \$MAINPID
112+
LimitNOFILE=1048576
113+
# Having non-zero Limit*s causes performance problems due to accounting overhead
114+
# in the kernel. We recommend using cgroups to do container-local accounting.
115+
LimitNPROC=infinity
116+
LimitCORE=infinity
117+
# Uncomment TasksMax if your systemd version supports it.
118+
# Only systemd 226 and above support this version.
119+
TasksMax=infinity
120+
TimeoutStartSec=0
121+
# set delegate yes so that systemd does not reset the cgroups of docker containers
122+
Delegate=yes
123+
# kill only the docker process, not all processes in the cgroup
124+
KillMode=process
125+
# restart the docker process if it exits prematurely
126+
Restart=on-failure
127+
StartLimitBurst=3
128+
StartLimitInterval=60s\n
129+
[Install]
130+
WantedBy=multi-user.target" > /lib/systemd/system/docker.service
131+
systemctl daemon-reload
132+
systemctl restart docker
133+
export DOCKER_HOST=tcp://localhost:2375
134+
if ! grep -qF "DOCKER_HOST=tcp://localhost:2375" /etc/environment
135+
then
136+
echo "DOCKER_HOST=tcp://localhost:2375" >> /etc/environment
137+
fi
138+
source /etc/environment
139+
systemctl restart docker
140+
docker pull ubuntu
141+
docker run --name code-chill -dti ubuntu /bin/bash
94142

95143
# Install js packages
96144
cd $client
97-
sudo yarn global add create-react-app
98-
sudo yarn global add serve
145+
yarn global add create-react-app
146+
yarn global add serve
99147

100148
# Fix error with shared folder and npm modules
101149
# https://medium.com/@dtinth/isolating-node-modules-in-vagrant-9e646067b36
102150
mkdir $HOME_DIR/vagrant_node_modules
103-
sudo chown -R vagrant:vagrant $HOME_DIR/vagrant_node_modules
104151
mkdir $client/node_modules
105152
sudo mount --bind $HOME_DIR/vagrant_node_modules $client/node_modules
153+
sudo chown -R vagrant:vagrant $HOME_DIR/vagrant_node_modules
106154

107155
# Install client dependencies
108156
sudo yarn install

src/client/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
"dependencies": {
66
"@types/react-redux": "^5.0.14",
77
"react": "^16.2.0",
8+
"react-bash": "^1.6.0",
89
"react-dom": "^16.2.0",
910
"react-redux": "^5.0.6",
10-
"react-scripts-ts": "2.12.0"
11+
"react-scripts-ts": "2.12.0",
12+
"text-encoding": "^0.6.4"
1113
},
1214
"scripts": {
1315
"start": "react-scripts-ts start",

src/client/src/App.tsx

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
import * as React from "react";
2-
import "./App.css";
2+
import Term, { Terminal } from "./components/Term";
33

4-
const logo = require("./logo.svg");
5-
6-
class App extends React.Component {
7-
render() {
8-
return (
9-
<div className="App">
10-
<header className="App-header">
11-
<img src={logo} className="App-logo" alt="logo" />
12-
<h1 className="App-title">Welcome to React</h1>
13-
</header>
14-
<p className="App-intro">
15-
To get started, edit <code>src/App.tsx</code> and save to reload.
16-
</p>
17-
</div>
18-
);
19-
}
4+
export default class App extends React.Component<any, any> {
5+
render() {
6+
return (
7+
<div>
8+
<Term
9+
prefix="code@chill"
10+
theme={Terminal.Themes.DARK}
11+
/>
12+
</div>
13+
);
14+
}
2015
}
21-
22-
export default App;

src/client/src/DockerTerm.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import TextEncoding from "text-encoding";
2+
3+
export default class DockerTerm {
4+
private socket: WebSocket;
5+
6+
constructor(url: string) {
7+
this.socket = new WebSocket(url);
8+
this.socket.addEventListener("message", this.receiveData);
9+
}
10+
11+
sendData (data: string): void {
12+
if (this.socket.readyState === 1) {
13+
this.socket.send(data);
14+
}
15+
}
16+
17+
receiveData (event: MessageEvent) {
18+
let str: string = "";
19+
let decoder = new TextEncoding.TextDecoder();
20+
if (typeof event.data === "object" && event.data instanceof ArrayBuffer) {
21+
str = decoder.decode(event.data);
22+
} else {
23+
str = "Error receiving data.";
24+
}
25+
return str;
26+
}
27+
}

src/client/src/components/Term.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import * as React from "react";
2+
import Terminal from "react-bash";
3+
4+
export interface TermProps {
5+
extensions?: object;
6+
history?: Array<Terminal.history>;
7+
prefix?: string;
8+
structure?: object;
9+
style?: object;
10+
theme?: string;
11+
}
12+
13+
export default class Term extends React.Component<TermProps, any> {
14+
15+
terminal = Terminal;
16+
17+
constructor(props?: any, context?: any) {
18+
super(props, context);
19+
}
20+
21+
render() {
22+
return (
23+
<div
24+
style={{
25+
height: "250px"
26+
}}
27+
>
28+
<Terminal
29+
extensions={this.props.extensions}
30+
history={this.props.history}
31+
prefix={this.props.prefix}
32+
structure={this.props.structure}
33+
style={this.props.style}
34+
theme={this.props.theme}
35+
/>
36+
</div>
37+
);
38+
}
39+
}
40+
export { Terminal };

src/client/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"forceConsistentCasingInFileNames": true,
1313
"noImplicitReturns": true,
1414
"noImplicitThis": true,
15-
"noImplicitAny": true,
15+
"noImplicitAny": false,
1616
"strictNullChecks": true,
1717
"suppressImplicitAnyIndexErrors": true,
1818
"noUnusedLocals": true

src/client/tslint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"static-before-instance",
3030
"variables-before-functions"
3131
],
32-
"no-any": true,
32+
"no-any": false,
3333
"no-arg": true,
3434
"no-bitwise": true,
3535
"no-console": [

src/client/yarn.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4612,6 +4612,10 @@ react-addons-test-utils@^15.6.2:
46124612
version "15.6.2"
46134613
resolved "https://registry.yarnpkg.com/react-addons-test-utils/-/react-addons-test-utils-15.6.2.tgz#c12b6efdc2247c10da7b8770d185080a7b047156"
46144614

4615+
react-bash@^1.6.0:
4616+
version "1.6.0"
4617+
resolved "https://registry.yarnpkg.com/react-bash/-/react-bash-1.6.0.tgz#0b6d2d616c04343afe122c4ec56a424b16dd85b6"
4618+
46154619
react-dev-utils@4.2.1:
46164620
version "4.2.1"
46174621
resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-4.2.1.tgz#9f2763e7bafa1a1b9c52254d2a479deec280f111"
@@ -5524,6 +5528,10 @@ test-exclude@^4.1.1:
55245528
read-pkg-up "^1.0.1"
55255529
require-main-filename "^1.0.1"
55265530

5531+
text-encoding@^0.6.4:
5532+
version "0.6.4"
5533+
resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.6.4.tgz#e399a982257a276dae428bb92845cb71bdc26d19"
5534+
55275535
text-table@0.2.0:
55285536
version "0.2.0"
55295537
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"

0 commit comments

Comments
 (0)