Monday, 15 April 2013

Alfresco not starting failed to get IP address Solved


A new installation of Alfresco and I got

Caused by: org.alfresco.error.AlfrescoRuntimeException: 03140000 Failed to get server IP address

Now the IP address was fine.
Obtained via DHCP

The system originally worked as the router supplied the IP address. The machine could surf the web, download Alfresco, but it would load

I added the name of the machine to /etc/hostnames

And it worked.

Restoring a Backup in Alfresco

Taking backups in Alfresco is essential. But restoring this backup is equally important. Here is how I go about it.

I will assume you have taken a good backup. If not have a look at an earlier blog. Alfresco Backup



Install an Alfresco server from scratch and get it working
Stop Alfresco server:
sh /opt/alfresco-4.2.c/alfresco.sh stop

:
In /opt/alfresco-4.2.c/tomcat/shared/classes/alfresco-global.properties turn
### Solr indexing ###
index.subsystem.name=solr
dir.keystore=${dir.root}/keystore
solr.port.ssl=8443
into
### Solr indexing ###
index.subsystem.name=noindex
dir.keystore=${dir.root}/keystore
#solr.port.ssl=8443

:Make the essential configurations inside the new installation (e.g. server’s hostname, etc) AND turn indexing off as in the corresponding step above.

Change the alfresco global properties file. Cut and paste the changed lines into this config. I add the mail part

### E-mail site invitation setting ###
notification.email.siteinvite=true

### E-mail properties ###
mail.host=smtp.gmail.com
mail.port=465
mail.username=myemail@gmail.com
mail.password=abc123
mail.encoding=UTF-8
mail.from.default=alfresco@mymachine.name
mail.protocol=smtps
mail.smtp.auth=false
mail.smtp.starttls.enable=false

#use these properties to send test message during start of subsystem
mail.testmessage.send=true
mail.testmessage.to=philipmrussell@gmail.com
mail.testmessage.subject=Outbound SMTP Alfresco Server OK
mail.testmessage.text=The Outbound SMTP email subsystem on Alfresco Server is working.

# Additional Java Mail properties for SMTPS protocol
mail.smtps.auth=true
mail.smtps.starttls.enable=true


#
# Alfresco Email Service and Email Server
#-------------

# Enable/Disable the inbound email service.  The service could be used by processes other than
# the Email Server (e.g. direct RMI access) so this flag is independent of the Email Service.
#-------------
email.inbound.enabled=true

# Email Server properties
#-------------
email.server.enabled=true
email.server.port=25
email.server.domain=my.server.url
email.inbound.unknownUser=anonymous
email.server.connections.max=3


# A comma separated list of email REGEX patterns of allowed senders.
# If there are any values in the list then all sender email addresses
# must match. For example:
#   .*\@alfresco\.com, .*\@alfresco\.org, .*\@yahoo\.com, .*\@btinternet\.com,
# .*\@gmail\.com,  .*\@tiscali\.co\.uk
# Allow anyone:
#email.server.allowed.senders=.*\@yahoo\.com, .*\@btinternet\.com, .*\@gmail\.com,.*\@tiscali\.co\.uk


email.server.allowed.senders=.*

email,server.hideTLS=true
email,server.enableTLS=false
email,server.requireTLS=false

imap.server.enabled=false
imap.server.port=143
imap.server.host=localhost

Save the file


I have 3 files to copy into /opt/alf*/tomcat/shared/lib

Red theme
Share import/export
unzip share

- Start and stop alfresco server (throw a delay of 5 minutes between the two commands in order for the server to start properly)
# sh /opt/alfresco-4.2.c/alfresco.sh start && sleep 300 && sh /opt/alfresco-4.2.c/alfresco.sh stop
- Start new installation’s postgresql:
# sh /opt/alfresco-4.2.c/alfresco.sh start postgresql
- Drop new installation’s database, create the new one and restore the above backed up:
# su postgres
$ dropdb alfresco -h localhost -i
Database "alfresco" will be permanently removed.
Are you sure? (y/n) y
Password:
$ createdb -T template0 alfresco -h localhost
Password:
$ psql alfresco -h localhost < /temp/alfrescodbdump
Password:
(...)
ALTER TABLE
ALTER TABLE
REVOKE
REVOKE
GRANT
GRANT
$ exit
- Stop new Alfresco postgresql:
sh /opt/alfresco-4.2.c/alfresco.sh stop postgresql

in Dolphin go to backup location Typically /backup
 mv contentstore contentstore.deleted /opt/alfresco-4.2.b/alf_data/

or use Dolphin to copy 

contentstore

contentstore.deleted
- Start and stop the new alfresco server (again wait for 5 minutes between the two commands for the server to start properly):
sh /opt/alfresco-4.2.c/alfresco.sh start && sleep 300 && sh /opt/alfresco-4.2.c/alfresco.sh stop

- Revert the indexing back to on (Solr):
In /opt/alfresco-4.2.c/tomcat/shared/classes/alfresco-global.properties 

turn

### Solr indexing ###
index.subsystem.name=noindex
dir.keystore=${dir.root}/keystore
#solr.port.ssl=8443
into
### Solr indexing ###
index.subsystem.name=solr
dir.keystore=${dir.root}/keystore
solr.port.ssl=8443


Reindex
stop alfresco
sh /opt/alfresco-4.2.c/alfresco.sh stop

Delete

/opt/alfresco/alf_data/solr/workspace/SpacesStore
/opt/alfresco/alf_data/solr/archive/SpacesStore
/opt/alfresco/alf_data/solr/workspace-SpacesStore/alfrescoModels
/opt/alfresco/alf_data/solr/archive-SpacesStore/alfrescoModels

Restart Alfesco
sh /opt/alfresco-4.2.c/alfresco.sh start

And it should work