mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 02:10:18 +01:00
attempt at making docker compose
This commit is contained in:
22
docker-compose.yaml
Normal file
22
docker-compose.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
services:
|
||||
front:
|
||||
build: ./traque-front
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- NEXT_PUBLIC_SOCKET_HOST = 'quentinrsl.com'
|
||||
- NEXT_PUBLIC_SOCKET_PORT = 3001
|
||||
|
||||
back:
|
||||
build: ./traque-back
|
||||
ports:
|
||||
- "3001:3001"
|
||||
environment:
|
||||
- HOST = 'quentinrsl.com'
|
||||
- PORT = 3001
|
||||
- SSL_KEY = "/etc/letsencrypt/live/quentinrsl.com/privkey.pem"
|
||||
- SSL_CERT = "/etc/letsencrypt/live/quentinrsl.com/cert.pem"
|
||||
- ADMIN_PASSWORD = 'admin'
|
||||
- MAX_PENALTIES = 3
|
||||
- ALLOWED_TIME_OUT_OF_ZONE_IN_MINUTES = 10
|
||||
- ALLOWED_TIME_BETWEEN_POSITION_UPDATE_IN_MINUTES = 10
|
||||
47
readme.md
47
readme.md
@@ -0,0 +1,47 @@
|
||||
# Instructions
|
||||
## Setup development environment
|
||||
### Front end configuration
|
||||
Edit the .env file in traque-front and add specify the following values:
|
||||
```
|
||||
NEXT_PUBLIC_SOCKET_HOST = 'example.com'
|
||||
NEXT_PUBLIC_SOCKET_PORT = 3000
|
||||
```
|
||||
Where NEXT_PUBLIC_SOCKET_HOST is the host of the socket server and NEXT_PUBLIC_SOCKET_PORT is the port of the socket server.
|
||||
### Back end configuration
|
||||
Edit the .env file in traque-back and add specify the following values:
|
||||
```
|
||||
HOST = 'example.com'
|
||||
PORT = 3001
|
||||
SSL_KEY = "/path/to/privkey.pem"
|
||||
SSL_CERT = "/path/to/cert.pem"
|
||||
ADMIN_PASSWORD = 'admin_password_here'
|
||||
MAX_PENALTIES = 3
|
||||
ALLOWED_TIME_OUT_OF_ZONE_IN_MINUTES = 10
|
||||
ALLOWED_TIME_BETWEEN_POSITION_UPDATE_IN_MINUTES = 10
|
||||
```
|
||||
Where ADMIN_PASSWORD is the password for the admin user, HOST is the host of the server, PORT is the port of the server, SSL_KEY is the path to the key file and SSL_CERT is the path to the certificate file.
|
||||
The SSL_KEY and SSL_CERT are used for HTTPS and are required for the server to work. This is because the browser will block the GeoLocation API if the connection is not secure.
|
||||
MAX_PENALTIES is the maximum number of penalties a user can have before loosing the game.
|
||||
ALLOWED_TIME_OUT_OF_ZONE_IN_MINUTES is the time a user can be out of the zone before being penalized.
|
||||
ALLOWED_TIME_BETWEEN_POSITION_UPDATE_IN_MINUTES is the maximum amount of time a user can wait before updating their position, after this period they will recieve a pennalty.
|
||||
|
||||
### Running the project
|
||||
#### Front end
|
||||
To run the front end, navigate to the traque-front directory and run the following commands:
|
||||
```
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
#### Back end
|
||||
To run the back end, navigate to the traque-back directory and run the following commands:
|
||||
```
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
Then navigate to the host and port specified in the .env file to access the application.
|
||||
```
|
||||
https://example.com:3000
|
||||
```
|
||||
|
||||
## Depployment
|
||||
|
||||
|
||||
8
traque-back/.dockerignore
Normal file
8
traque-back/.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
node_modules
|
||||
npm-debug.log
|
||||
README.md
|
||||
.next
|
||||
.git
|
||||
.vscode
|
||||
20
traque-back/Dockerfile
Normal file
20
traque-back/Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
# Use Node 16 alpine as parent image
|
||||
FROM node:16-alpine
|
||||
|
||||
# Change the working directory on the Docker image to /app
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json to the /app directory
|
||||
COPY package.json package-lock.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of project files into this image
|
||||
COPY . .
|
||||
|
||||
# Expose application port
|
||||
EXPOSE 3000
|
||||
|
||||
# Start the application
|
||||
CMD npm start
|
||||
8
traque-front/.dockerignore
Normal file
8
traque-front/.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
node_modules
|
||||
npm-debug.log
|
||||
README.md
|
||||
.next
|
||||
.git
|
||||
.vscode
|
||||
Reference in New Issue
Block a user