Docker Swarm deployments with Semaphore

Why use a Continuous Integration and Deployment service?

  • Gitlab-CI took 6–7 minutes to complete my tasks
  • Semaphore did the same work in 2.5 minutes

How to Set Up CI/CD with Semaphore

Connect Semaphore to your code for automatic jobs

How to set up a secure connection between your manager server and Semaphore

ssh-keygen -t rsa

How to handle environment variables

How to set up and run integration tests automatically with MongoDB

# npm run test
cross-env NODE_ENV=test && mocha test/ --recursive
"mongodb": process.env.DATABASE_URL || "mongodb://localhost:27017/feathers-vue"

How to write our Docker Swarm deployment scripts

FROM node:8-alpine
RUN apk add --update git && rm -rf /tmp/* /var/cache/apk/*
WORKDIR /var/www/
COPY package.json /var/www/
ENV NODE_ENV=production
COPY package.json /var/www/package.json
RUN npm install
COPY public/ /var/www/public
COPY config/ /var/www/config
COPY server/ /var/www/server
EXPOSE 80CMD ["npm", "run", "production"]
# npm run production
cross-env NODE_ENV=production node server/
docker pull $CACHE_IMAGE:$BRANCH_NAME || true
docker build -f $DOCKER_FILE --cache-from $CACHE_IMAGE:$BRANCH_NAME --tag $CACHE_IMAGE:$BRANCH_NAME .
docker push $CACHE_IMAGE:$BRANCH_NAME
ssh-keyscan -H $DEPLOY_SERVER_URL >> ~/.ssh/known_hostsscp -r environment.env .env $COMPOSE_FILE root@$DEPLOY_SERVER_URL:~/ssh root@$DEPLOY_SERVER_URL "env $(cat .env | grep ^[A-Z] | xargs) docker stack deploy -c $COMPOSE_FILE --with-registry-auth f"
docker stack deploy -c $COMPOSE_FILE -with-registry-auth f

How to set up notifications when a build passes or fails with Slack or email

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

3 underrated skills of great programmers

Valorant’s Anti-Cheat Software Proven to Be Invasive, Developer Tries to Mend Relationship With…

How to Download Applications from IBM Cloud

GitHub: Pull 🡆 Commit 🡆 Push

Evolution of Software Engineering

READ/DOWNLOAD*! Arduino Programming in 24 Hours, Sams Teach Yourself FULL BOOK PDF & FULL AUDIOBOOK

Why to learn Django on 2022 ? Django Overview

A Beginner’s guide to Elixir OTP System

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Coding Friend, LLC

Coding Friend, LLC

More from Medium

Making Real-Time Apps.

Step by Step Configuring Elasticsearch Snapshot Feature

Elastic Logo

Deploying to your Own GIT Server

How To Setup Nginx Reverse Proxy Server On Ubuntu 20.04