Details
-
Type: Monitor
-
Status: Closed
-
Priority: Major
-
Resolution: Dismissed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: FIWARE-TECH-HELP
-
Labels:
Description
Created question in FIWARE Q/A platform on 13-12-2021 at 08:12
Please, ANSWER this question AT https://stackoverflow.com/questions/70331540/not-a-valid-identifiert-when-running-bash-create-command-in-windows
Question:
': not a valid identifiert: ` when running bash create command in windows
Description:
I'm trying to implement this tutorial, but when I try to run "./services create" command in powershell (in windows 10) I get this error :
': not a valid identifiert: `
': not a valid identifiert: `
': not a valid identifiert: `
': not a valid identifiert: `
': not a valid identifiert: `
': not a valid identifiert: `
': not a valid identifiert: `
': not a valid identifiert: `
': not a valid identifiert: `
I've converted the carriage return in notepad++ (Edit -> EOL conversion -> Unix (LF)) before running the code. before this conversion I was getting this error :
./services: line 16: $'\r': command not found
: invalid option 17: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
./services: line 18: $'\r': command not found
./services: line 30: syntax error near unexpected token `$'{\r''
'/services: line 30: `loadData () {
you can also see the bash script here :
#!/bin/bash
#
- Command Line Interface to start all services associated with the Tutorial
# - For this tutorial the commands are merely a convenience script to run docker or docker-compose
# - Each services script can be run using either docker-compose (the external tool with the hyphen -)
- or docker compose (the newer version directly bundled with Docker with a space )
# - if you start up with the following command:
# - ./services start legacy
# - This will force the script to use docker-compose which may be more reliable in
- some cases (or if an older version of Docker is being used)
set -e
dockerCmd="docker compose"
if (( $# == 2 )); then
dockerCmd="docker-compose"
fi
if (( $# < 1 )); then
echo "Illegal number of parameters"
echo "usage: services [create|start|stop]"
exit 1
fi
loadData () {
docker run --rm -v $(pwd)/import-data:/import-data \
--network fiware_default \
-e ORION_PORT="$
-e TUTORIAL_APP_PORT="${TUTORIAL_APP_PORT}" \
--entrypoint /bin/ash curlimages/curl import-data
waitForIoTAgent
docker run --rm -v $(pwd)/provision-devices:/provision-devices \
--network fiware_default \
-e ORION_PORT="${ORION_PORT}
" \
-e TUTORIAL_APP_PORT="$
" \
-e TUTORIAL_DUMMY_DEVICE_PORT="$
" \
-e IOTA_NORTH_PORT="$
" \
--entrypoint /bin/ash curlimages/curl provision-devices
echo ""
}
waitForKeyrock () {
echo -e "⏳ Waiting for \033[1;31mKeyrock\033[0m to be available\n"
while ! [ `docker inspect --format='.State.Health.Status' fiware-keyrock` == "healthy" ]
do
echo -e "Keyrock HTTP state: " `curl -s -o /dev/null -w %
sleep 5
done
echo -e " \033[1;32mdone\033[0m"
}
waitForWirecloud () {
echo -e "⏳ Waiting for \033[1;35mWirecloud\033[0m to be available\n"
while [ `curl -s -o /dev/null -w %{http_code}
'http://localhost:8000/api/features'` -eq 000 ]
do
echo -e "Wirecloud HTTP state: " `curl -s -o /dev/null -w %
sleep 5
done
echo -e " \033[1;32mdone\033[0m"
}
waitForMongo () {
echo -e "\n⏳ Waiting for \033[1mMongoDB\033[0m to be available\n"
while ! [ `docker inspect --format='.State.Health.Status' db-mongo` == "healthy" ]
do
sleep 1
done
}
waitForOrion () {
echo -e "\n⏳ Waiting for \033[1;34mOrion\033[0m to be available\n"
while ! [ `docker inspect --format='.State.Health.Status' fiware-orion` == "healthy" ]
do
echo -e "Context Broker HTTP state: " `curl -s -o /dev/null -w %{http_code}
'http://localhost:1026/version'` " (waiting for 200)"
sleep 1
done
}
waitForIoTAgent () {
echo -e "\n⏳ Waiting for \033[1;36mIoT-Agent\033[0m to be available\n"
while ! [ `docker inspect --format='.State.Health.Status' fiware-iot-agent` == "healthy" ]
do
echo -e "IoT Agent HTTP state: " `curl -s -o /dev/null -w %
'http://localhost:4041/version'` " (waiting for 200)"
sleep 1
done
}
addDatabaseIndex () {
printf "Adding appropriate \033[1mMongoDB\033[0m indexes for \033[1;34mOrion\033[0m ..."
docker exec db-mongo mongo --eval '
conn = new Mongo();db.createCollection("orion");
db = conn.getDB("orion");
db.createCollection("entities");
db.entities.createIndex(
,
{unique: true});
db.entities.createIndex(
);
db.entities.createIndex(
);' > /dev/null
docker exec db-mongo mongo --eval '
conn = new Mongo();db.createCollection("orion-openiot");
db = conn.getDB("orion-openiot");
db.createCollection("entities");
db.entities.createIndex(
,
{unique: true});
db.entities.createIndex(
);
db.entities.createIndex(
);' > /dev/null
echo -e " \033[1;32mdone\033[0m"
printf "Adding appropriate \033[1mMongoDB\033[0m indexes for \033[1;36mIoT-Agent\033[0m ..."
docker exec db-mongo mongo --eval '
conn = new Mongo();
db = conn.getDB("iotagentul");
db.createCollection("devices");
db.devices.createIndex(
);
db.devices.createIndex(
);
db.devices.createIndex(
);
db.createCollection("groups");
db.groups.createIndex(
);
db.groups.createIndex(
);' > /dev/null
echo -e " \033[1;32mdone\033[0m"
}
startContainers () {
echo ""
export IDM_HTTPS_ENABLED="$1"
$
echo ""
}
stoppingContainers () {
CONTAINERS=$(docker ps -aq)
if [[ -n $CONTAINERS ]]; then
echo "Stopping containers"
docker rm -f $CONTAINERS
fi
VOLUMES=$(docker volume ls -qf dangling=true)
if [[ -n $VOLUMES ]]; then
echo "Removing old volumes"
docker volume rm $VOLUMES
fi
}
command="$1"
case "${command}" in
"help")
echo "usage: services [create|start|stop]"
;;
"start")
export $(cat .env | grep "#" -v)
stoppingContainers
echo -e "Starting containers: \033[1;34mOrion\033[0m, \033[1;36mIoT-Agent\033[0m, \033[1;31mKeyrock\033[0m, \033[1;35mWirecloud\033[0m, \033[1mTutorial\033[0m"
echo -e "Along with the following databases: \033[1mMongoDB\033[0m, \033[1mPostGres\033[0m and \033[1mMySQL\033[0m"
echo -e "and microservices: \033[1mElasticSearch\033[0m, \033[1mMemCache\033[0m and \033[1;35mNGSI Proxy\033[0m\n"
echo
echo
echo
echo
echo
echo
startContainers false
waitForMongo
addDatabaseIndex
waitForOrion
loadData
waitForWirecloud
waitForKeyrock
echo -e "Now open \033[4mhttp://localhost:8000\033[0m"
;;
"stop")
export $(cat .env | grep "#" -v)
stoppingContainers
;;
"create")
export $(cat .env | grep "#" -v)
echo "Pulling Docker images"
docker pull curlimages/curl
${dockerCmd}
pull
;;
*)
echo "Command not Found."
echo "usage: services [create|start|stop]"
exit 127;
;;
esac
Activity
Field | Original Value | New Value |
---|---|---|
Component/s | FIWARE-TECH-HELP [ 10278 ] |
Assignee | Jason Fox [ jason.fox ] |
Resolution | Dismissed [ 10102 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Summary | [fiware-stackoverflow] ': not a valid identifiert: ` when running bash create command in windows | FIWARE.Question.Tech.': not a valid identifiert: ` when running bash create command in windows. |
Transition | Time In Source Status | Execution Times | Last Executer | Last Execution Date | |||||
---|---|---|---|---|---|---|---|---|---|
|
6d 2h 39m | 1 | Jason Fox | 20/Dec/21 9:11 AM |
2021-12-14 05:31|CREATED monitor | # answers= 0, accepted answer= False