Skip to content

CodeCoupler Setup

CodeCoupler Setup is a full stack setup to deploy CodeCoupler API and UI on a Linux Server.

Project in Progress

Even if this project has already been used successfully, it must be used with a certain amount of caution. For now only CentOS 7 was tested intensively and little bit Ubuntu.

Documentation not ready

The documentation is incomplete for now.

Get Started

Init the boilerplate with:

1
npm init @codecoupler/cc-setup

Then:

  1. Rename the Subfolders in database to the names of your databases
  2. Modify Variables in setup.sh
  3. Run npm pack
  4. Publish the tar file together with a file latest.txt on a server

How to invoke setup

The best way to invoke the setup is a bash script which can be saved in the root home directory:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
set -e

# In which path is the setup located:
DIST_URL_SETUP=https://example.com/dist/setup

# Where to get the information about the latest setup filename:
LATEST_URL_SETUP=$DIST_URL_SETUP/latest.txt

# Adding Curl Options (like Authentication etc)
CURLOPT_URL_SETUP=

# You can set an option to execute only an update of the api, the gui
# or the database. The value can be "api", "gui", "database" or "app".
# Choosing "app" will update the api, the gui and the database. If you
# leave this empty, the entire setup will be invoked. A a best practice
# you could retrieve this value as parameter.
ONLY=$1

# Go
SETUP_VERSION=`curl -fsS $CURLOPT_URL_SETUP $LATEST_URL_SETUP`
echo "Using Setup Version $SETUP_VERSION"
MYTMP=`mktemp -d`
curl -fsS $CURLOPT_URL_SETUP $DIST_URL_SETUP/$SETUP_VERSION  | tar -xzf - --directory $MYTMP
$MYTMP/package/setup.sh `if [ ! "$ONLY" == "" ]; then printf -- "-o $ONLY"; fi`
rm -rf $MYTMP

After setup you can change the values of /your_setup_path/api/.env if needed. They will not be overwritten.

Self hosted cc-setup

The package @codecoupler/cc-setup itself is normally not needed as it is accesible here:

[https://dist.codecoupler.org/cc-setup/latest.tgz]

With npm init @codecoupler/cc-setup you can create an bootstrapper which will use this public accesible ressource.

But is you need or if you must self host all the ressources, you can:

  • fetch this package
  • run npm pack
  • put the tar file on your own server
  • and change the lines in the bootstrapper file setup-start.sh as follows:

Search this section:

1
2
3
4
5
6
7
8
9
######################################
#Update cc-setup
echo ''
echo $'\e[36mUpdate cc-setup\e[0m'
######################################
CC_SETUP_VERSION=`curl -fsS https://dist.codecoupler.org/cc-setup/latest.txt`
echo "Update to Version $CC_SETUP_VERSION"
MYTMP=`mktemp -d`
curl -fsS https://dist.codecoupler.org/cc-setup/latest.tgz | tar -xzf - --directory $MYTMP

Replace with this:

1
2
3
4
5
6
7
8
######################################
#Update cc-setup
echo ''
echo $'\e[36mUpdate cc-setup\e[0m'
######################################
echo "Download Self Hosted Version of cc-setup"
MYTMP=`mktemp -d`
curl -fsS https://YOURSERVER/YOUR/PATH/codecoupler-cc-setup-X-X-X.tgz | tar -xzf - --directory $MYTMP
Back to top