Skip to content

Commit 0d098fc

Browse files
committed
Removing NVM from docker image, app should start on boot now.
Updated readme
1 parent d8f0bd1 commit 0d098fc

2 files changed

Lines changed: 33 additions & 36 deletions

File tree

Dockerfile

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,58 +4,54 @@ MAINTAINER pringlez <maintainer@pringlez>
44

55
ENV DEBIAN_FRONTEND=noninteractive
66

7-
CMD ["bash"]
8-
97
# Install System Updates & Packages
108
RUN groupadd -r gsa && useradd -r -d /home/gsa -g gsa gsa
119
RUN apt-get update \
1210
&& apt-get install -y curl \
13-
&& apt-get install -y wget \
14-
&& apt-get install -y unzip \
1511
&& apt-get install -y lib32gcc1 \
12+
&& apt-get install -y python-software-properties \
1613
&& apt-get -y autoclean
1714

15+
# Args & Env Vars
16+
ARG ACMANAGER_PORT=42555
17+
ENV ACMANAGER_PORT=${ACMANAGER_PORT}
18+
ARG ACSERVER_PORT_1=9600
19+
ENV ACSERVER_PORT_1=${ACSERVER_PORT_1}
20+
ARG ACSERVER_PORT_2=8081
21+
ENV ACSERVER_PORT_2=${ACSERVER_PORT_2}
22+
ARG STEAM_USERNAME=anonymous
23+
ENV STEAM_USERNAME=${STEAM_USERNAME}
24+
ARG STEAM_PASSWORD=
25+
ENV STEAM_PASSWORD=${STEAM_PASSWORD}
26+
1827
# Install SteamCMD & AC Server Files
19-
RUN mkdir -p /home/gsa/steamcmd
28+
RUN mkdir -p /home/gsa/steamcmd /home/gsa/server /home/gsa/acmanager
2029
RUN curl http://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz | tar -C /home/gsa/steamcmd -xzf-
21-
RUN mkdir /home/gsa/server /home/gsa/acmanager
22-
RUN chown -R gsa:gsa /home/gsa
23-
RUN /home/gsa/steamcmd/steamcmd.sh +@sSteamCmdForcePlatformType windows +login username password +force_install_dir /home/gsa/server +app_update 302550 +quit
30+
RUN /home/gsa/steamcmd/steamcmd.sh +@sSteamCmdForcePlatformType windows +login ${STEAM_USERNAME} ${STEAM_PASSWORD} +force_install_dir /home/gsa/server +app_update 302550 +quit
2431
RUN rm -f /home/gsa/Steam/logs/*
2532

26-
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
33+
#RUN rm /bin/sh && ln -s /bin/bash /bin/sh
2734

2835
# Install NVM, NodeJS, NPM & PM2
29-
ENV NVM_DIR /usr/local/nvm
30-
ENV NODE_VERSION 8.11.1
31-
32-
RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
33-
34-
RUN source $NVM_DIR/nvm.sh \
35-
&& nvm install $NODE_VERSION \
36-
&& nvm alias default $NODE_VERSION \
37-
&& nvm use default
38-
39-
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
40-
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
41-
36+
RUN apt-get install python-software-properties
37+
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
38+
RUN apt-get install nodejs
4239
RUN npm install pm2 -g
43-
RUN pm2 startup upstart
4440

4541
# Install ACManager Files & Dependencies
46-
USER gsa
4742
WORKDIR /home/gsa/acmanager
48-
RUN wget https://github.com/Pringlez/ACServerManager/archive/master.zip
49-
RUN unzip master.zip; mv ACServerManager-master/* .; rm -R ACServerManager-master; rm master.zip
43+
COPY . /home/gsa/acmanager
5044
RUN npm install
5145
RUN ./generate-frontend-content.sh
46+
RUN chmod -R 775 /home/gsa
47+
RUN chown -R gsa:gsa /home/gsa
5248

5349
# Volumes & Ports
5450
VOLUME /home/gsa/acmanager
5551
EXPOSE ${ACMANAGER_PORT}
5652
EXPOSE ${ACSERVER_PORT_1}
5753
EXPOSE ${ACSERVER_PORT_2}
5854

55+
# Once container starts run the ACServerManager
5956
USER gsa
60-
RUN pm2 start /home/gsa/acmanager/server.js
61-
RUN pm2 save
57+
CMD ["pm2-runtime", "server.js"]

README_Linux.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ This is the installation guide for a Linux machine, to review the Windows instal
88

99
## Updates
1010
01/05/2018
11-
* Dockerized! - Adding Docker build file to allow acserver & acmanager run in container. Still in testing!
11+
* Dockerized! - Adding Docker build file to allow ACServer & ACServerManager run in container. Still in testing!
1212

1313
25/12/2017
1414
* Add support for uploading tracks (both single and multi-layout) and cars
1515
* Add support for removing existing tracks and cars
16-
* Bumping version of ACManager to 1.0.0!
16+
* Bumping version of ACServerManager to 1.0.0!
1717

1818
21/12/2017
1919
* Update for 1.16 AC patch
@@ -40,7 +40,7 @@ This is the installation guide for a Linux machine, to review the Windows instal
4040
First you'll need to install Node.js on your machine. It's best to use an application
4141
like [NVM](https://github.com/creationix/nvm) to manage the installation of Node.js on Linux based machines.
4242
After installing Node.js, install [PM2](https://github.com/Unitech/pm2) when using this
43-
version of AC Server Manager, it's basically Node.js application management tool with tons of features
43+
version of Manager, it's basically Node.js application management tool with tons of features
4444
for production use. PM2 will make sure your web application stays online and, auto restarts if it crashes.
4545
A docker build file is also available, however it's still in testing.
4646

@@ -104,20 +104,21 @@ pm2 list
104104
There many useful commands to manage applications using PM2, reference their GitHub page.
105105

106106
## Docker
107-
Included is a docker build file to allow you to easily run the entire AC Game Server & AC Manager inside a container. To docker build currently grabs the latest version of steamcmd & installs all the necessary files, dependencies & executables on top of a ubuntu:xenial (16.04) image.
107+
Included is a docker build file to allow you to easily run the entire ACServer & ACServerManager inside a container. The build currently grabs the latest version of steamcmd & installs all the necessary files, dependencies & executables on top of a ubuntu:xenial (16.04) image. You need to specify the ports you'll be using for the ACServer & ACServerManager. You also need to specify a username & password for steamcmd to download the ACServer files, I recommend making a new separate account for download server files for security reasons.
108+
Note: Having special characters in the provided password may produce errors in the image build process.
108109
Create a docker image:
109110
```
110-
sudo docker build --build-arg ACMANAGER_PORT=42555 --build-arg ACSERVER_PORT_1=9600 --build-arg ACSERVER_PORT_2=8081 -t pringlez/acserver-manager .
111+
sudo docker build --build-arg ACMANAGER_PORT=42555 --build-arg ACSERVER_PORT_1=9600 --build-arg ACSERVER_PORT_2=8081 --build-arg STEAM_USERNAME=<your-username> --build-arg STEAM_PASSWORD=<your-password> -t pringlez/acserver-manager .
111112
```
112113
Create a container from the image:
113114
```
114-
sudo docker create --name acserver-manager --net=host -v </path/to/acmanager>:/home/gsa/acmanager -t pringlez/acserver-manager
115+
sudo docker create --name acserver-manager --net=host -t pringlez/acserver-manager
115116
```
116-
117+
Then just visit your server's address + ACServerManager port in your browser!
117118
## Using ACServerManager
118119
* Browse to the application using your servers IP and the chosen port (or any DNS configured)
119120
* Click the 'Start' button under Assetto Corsa Server section
120-
* If using sTracker wait until the AC server has started and then click 'Start' in the sTracker Server section
121+
* If using sTracker wait until the ACServer has started and then click 'Start' in the sTracker Server section
121122

122123
The server should now be running. You'll be able to see any server output in the command window and it will be logged to a file in the 'ACServerManager/log' folder.
123124

0 commit comments

Comments
 (0)