-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare for running in release container
- Loading branch information
1 parent
264a2e0
commit 271972a
Showing
16 changed files
with
157 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
############################################################################ | ||
# This Dockerfile can be used to prepare a Docker image that runs swm-core # | ||
# with cloud gate in a release mode a production machine. # | ||
############################################################################ | ||
|
||
FROM ubuntu:22.04 | ||
|
||
ARG PYTHON_VERSION=3.10 | ||
ARG PYTHON_VERSION_FULL=3.10.14 | ||
ARG SWM_VERSION=$SWM_VERSION | ||
ARG SWM_GATE_PACKAGE | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get clean | ||
RUN apt-get update | ||
RUN apt-get update --fix-missing | ||
RUN apt-get install openssl -y | ||
RUN apt-get install openssh-client -y # for host certificates | ||
RUN apt-get install python3 -y # for setup | ||
RUN apt-get install rlwrap -y # for swmctl during setup | ||
RUN apt-get install vim less mc -y # for debug | ||
RUN apt-get install -y supervisor | ||
|
||
# Install python version we currently require: | ||
RUN apt-get install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev | ||
RUN apt-get install -y libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev | ||
RUN cd /tmp && \ | ||
wget https://www.python.org/ftp/python/$PYTHON_VERSION_FULL/Python-$PYTHON_VERSION_FULL.tgz && \ | ||
tar -xf Python-$PYTHON_VERSION_FULL.tgz && \ | ||
cd Python-$PYTHON_VERSION_FULL && \ | ||
./configure --enable-optimizations && \ | ||
make -j $(nproc) && \ | ||
make altinstall && \ | ||
ln -s /usr/local/bin/python$PYTHON_VERSION /usr/local/bin/python && \ | ||
ln -s /usr/local/bin/pip$PYTHON_VERSION /usr/local/bin/pip | ||
|
||
RUN mkdir -p /opt/swm/spool | ||
|
||
COPY $SWM_GATE_PACKAGE /opt/swm/ | ||
RUN pip install /opt/swm/$(basename "$SWM_GATE_PACKAGE") | ||
|
||
COPY _build/packages/swm-$SWM_VERSION.tar.gz /opt/swm/swm.tar.gz | ||
RUN tar zfx /opt/swm/swm.tar.gz -C /opt/swm/ && ln -s /opt/swm/$SWM_VERSION /opt/swm/current | ||
|
||
# To run multiple processes in one container: | ||
COPY priv/container/release/supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
|
||
# swm-core to swm-core connection port: | ||
EXPOSE 10001 | ||
|
||
# HTTP client to swm-core port: | ||
EXPOSE 8443 | ||
|
||
VOLUME /opt/swm | ||
|
||
CMD ["/usr/bin/supervisord"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[supervisord] | ||
nodaemon=true | ||
|
||
[program:swm-core] | ||
command=/bin/sh /opt/swm/current/scripts/run-swm-in-container.sh" | ||
autostart=true | ||
autorestart=true | ||
redirect_stderr=true | ||
stdout_logfile=/var/log/swm-core.log | ||
|
||
[program:swm-gate] | ||
command=python -m swmcloudgate.app:start | ||
autostart=true | ||
autorestart=true | ||
redirect_stderr=true | ||
stdout_logfile=/var/log/swm-cloud-gate.log |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#/bin/bash | ||
|
||
#set -x | ||
|
||
ME=$( readlink -f "$0" ) | ||
ROOT_DIR=$( dirname "$( dirname "$ME" )" ) | ||
DOCKERFILE=${ROOT_DIR}/priv/container/release/Dockerfile | ||
|
||
SWM_VERSION=$($ROOT_DIR/scripts/version) | ||
if [ $SWM_VERSION == "" ]; then | ||
echo "ERROR: cannot fetch version from git, check script scripts/version" | ||
exit 1 | ||
fi | ||
|
||
echo "Build container image: version=${SWM_VERSION}, dockerfile=${DOCKERFILE}" | ||
|
||
DOCKER=docker | ||
IMAGE_NAME=skyport | ||
TAG=latest | ||
|
||
GATE_PACKAGE_NAME=swmcloudgate-0.1.0-py3-none-any.whl | ||
GATE_PACKAGE_PATH_OLD=$ROOT_DIR/../swm-cloud-gate/dist/$GATE_PACKAGE_NAME | ||
GATE_PACKAGE_PATH_NEW=_build/packages/$GATE_PACKAGE_NAME | ||
cp -f $GATE_PACKAGE_PATH_OLD $GATE_PACKAGE_DESTINATION_NEW | ||
|
||
${DOCKER} build --tag ${IMAGE_NAME}:${SWM_VERSION} \ | ||
--build-arg SWM_VERSION=${SWM_VERSION} \ | ||
--build-arg SWM_GATE_PACKAGE=$GATE_PACKAGE_PATH_NEW \ | ||
--file ${DOCKERFILE} . | ||
${DOCKER} tag ${IMAGE_NAME}:${SWM_VERSION} ${IMAGE_NAME}:${TAG} | ||
|
||
echo "------------------------------------" | ||
echo "Created image:" | ||
${DOCKER} images ${IMAGE_NAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
# | ||
# The script should run in container with mounted spool directory | ||
# If spool directory is empty then the script runs setup first | ||
# | ||
|
||
SPOOL=/opt/swm/spool | ||
|
||
if [ -z "$(ls -A "$SPOOL")" ]; then | ||
echo "The directory '$SPOOL' is empty => initiate setup and exit" | ||
/opt/swm/current/scripts/setup-skyport.linux | ||
exit 0 | ||
fi | ||
|
||
source /opt/swm/current/scripts/swm.env | ||
/opt/swm/current/bin/swm foreground |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters